GPU: better nvidia GPU temp detection

This commit is contained in:
李通洲
2023-10-27 21:05:03 +08:00
parent 130d5a5202
commit dd3109cd89
6 changed files with 6901 additions and 2205 deletions
+5 -1
View File
@@ -243,7 +243,11 @@ static void pciHandleDevice(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
#endif
if (gpu->temperature != gpu->temperature && gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA)
ffDetectNvidiaGpuTemp(&gpu->temperature, device->device_id);
{
char pciDeviceId[32];
snprintf(pciDeviceId, sizeof(pciDeviceId) - 1, "%04x:%02x:%02x.%d", device->domain, device->bus, device->dev, device->func);
ffDetectNvidiaGpuTemp(&gpu->temperature, pciDeviceId, 0, 0);
}
}
jmp_buf pciInitJmpBuf;
+9 -7
View File
@@ -75,13 +75,6 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
gpu->dedicated.total = dedicatedVideoMemory + dedicatedSystemMemory;
gpu->shared.total = sharedSystemMemory;
}
if (options->temp && gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA)
{
uint32_t deviceId;
if(ffRegReadUint(hDirectxKey, L"DeviceId", &deviceId, NULL))
ffDetectNvidiaGpuTemp(&gpu->temperature, deviceId);
}
}
else if (!ffRegReadUint64(hKey, L"HardwareInformation.qwMemorySize", &gpu->dedicated.total, NULL))
{
@@ -91,6 +84,15 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
gpu->type = gpu->dedicated.total > 1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
}
}
if (options->temp && gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA)
{
uint32_t vendorId, deviceId, subSystemId;
// See: https://download.nvidia.com/XFree86/Linux-x86_64/545.23.06/README/supportedchips.html
// displayDevice.DeviceID = MatchingDeviceId "PCI\\VEN_10DE&DEV_2782&SUBSYS_513417AA&REV_A1"
if (swscanf(displayDevice.DeviceID, L"PCI\\VEN_%x&DEV_%x&SUBSYS_%x", &vendorId, &deviceId, &subSystemId) == 3)
ffDetectNvidiaGpuTemp(&gpu->temperature, NULL, (deviceId << 16) | vendorId, subSystemId);
}
}
return NULL;