mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
amd: don't deinitialize device on success
This commit is contained in:
parent
eb027a6e2e
commit
0b0fc97f71
@ -72,13 +72,6 @@ std::variant<ReadError, ReadableValue>AMDPlugin::libdrmRead(amdgpu_device_handle
|
|||||||
}
|
}
|
||||||
|
|
||||||
AMDPlugin::AMDPlugin() {
|
AMDPlugin::AMDPlugin() {
|
||||||
/*Assignable a([](auto arg) {
|
|
||||||
return std::nullopt;
|
|
||||||
});
|
|
||||||
|
|
||||||
DeviceNode root{"AMD", a};
|
|
||||||
m_rootNode.appendChild(root);*/
|
|
||||||
|
|
||||||
struct FSInfo {
|
struct FSInfo {
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
@ -101,8 +94,8 @@ AMDPlugin::AMDPlugin() {
|
|||||||
int devInitRetval;
|
int devInitRetval;
|
||||||
if (fd > 0 &&
|
if (fd > 0 &&
|
||||||
v_ptr &&
|
v_ptr &&
|
||||||
(devInitRetval = amdgpu_device_initialize(fd, &m, &n, &dev)) == 0 &&
|
std::string(v_ptr->name).find(_AMDGPU_NAME) != std::string::npos &&
|
||||||
std::string(v_ptr->name).find(_AMDGPU_NAME) != std::string::npos) {
|
(devInitRetval = amdgpu_device_initialize(fd, &m, &n, &dev)) == 0) {
|
||||||
// Device uses amdgpu
|
// Device uses amdgpu
|
||||||
// Find hwmon path if available
|
// Find hwmon path if available
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
@ -122,7 +115,7 @@ AMDPlugin::AMDPlugin() {
|
|||||||
m_GPUInfoVec.push_back(AMDGPUInfo{hwmonPath, dev});
|
m_GPUInfoVec.push_back(AMDGPUInfo{hwmonPath, dev});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (devInitRetval == 0) amdgpu_device_deinitialize(dev);
|
//if (devInitRetval == 0) amdgpu_device_deinitialize(dev);
|
||||||
close(fd);
|
close(fd);
|
||||||
drmFreeVersion(v_ptr);
|
drmFreeVersion(v_ptr);
|
||||||
}
|
}
|
||||||
@ -133,6 +126,7 @@ AMDPlugin::AMDPlugin() {
|
|||||||
struct UnspecializedReadable {
|
struct UnspecializedReadable {
|
||||||
std::function<std::variant<ReadError, ReadableValue>(AMDGPUInfo)> func;
|
std::function<std::variant<ReadError, ReadableValue>(AMDGPUInfo)> func;
|
||||||
std::optional<std::string> unit;
|
std::optional<std::string> unit;
|
||||||
|
std::string nodeName;
|
||||||
};
|
};
|
||||||
|
|
||||||
// List of query functions for DynamicReadables
|
// List of query functions for DynamicReadables
|
||||||
@ -143,7 +137,8 @@ AMDPlugin::AMDPlugin() {
|
|||||||
AMDGPU_INFO_SENSOR_GPU_TEMP,
|
AMDGPU_INFO_SENSOR_GPU_TEMP,
|
||||||
std::function<uint(uint)>([](uint val) {return val / 1000;}));
|
std::function<uint(uint)>([](uint val) {return val / 1000;}));
|
||||||
},
|
},
|
||||||
std::nullopt
|
std::nullopt,
|
||||||
|
"Temperature"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -169,7 +164,6 @@ AMDPlugin::AMDPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TreeNode<DeviceNode> AMDPlugin::deviceRootNode() {
|
TreeNode<DeviceNode> AMDPlugin::deviceRootNode() {
|
||||||
;
|
|
||||||
return m_rootNode;
|
return m_rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user