From 1c5179d3b04358ece32da9a4b8b14aa27fd24b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 20 Dec 2023 22:19:15 +0800 Subject: [PATCH] GPU (Intel): actually detect real time clock frequency --- src/detection/gpu/gpu_intel.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_intel.c b/src/detection/gpu/gpu_intel.c index 4b67c6eb3..b41d6e8ae 100644 --- a/src/detection/gpu/gpu_intel.c +++ b/src/detection/gpu/gpu_intel.c @@ -176,7 +176,25 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe } if (result.frequency) - *result.frequency = properties.Frequency / 1000.; + { + ctl_freq_handle_t freqs[16]; + uint32_t freqCount = sizeof(freqs) / sizeof(freqs[0]); + if (igclData.ffctlEnumFrequencyDomains(device, &freqCount, freqs) == CTL_RESULT_SUCCESS && freqCount > 0) + { + double sumValue = 0; + uint32_t availableCount = 0; + for (uint32_t iFreq = 0; iFreq < freqCount; iFreq++) + { + ctl_freq_state_t state = { .Size = sizeof(state), .Version = 0 }; + if (igclData.ffctlFrequencyGetState(freqs[iFreq], &state) == CTL_RESULT_SUCCESS) + { + sumValue += state.actual; + availableCount++; + } + } + *result.frequency = (sumValue / availableCount) / 1000.; + } + } return NULL; }