Skip to content

Commit d2b3a07

Browse files
committed
GPU (Windows): actually use correct OD fns for recent AMD GPUs
1 parent f139148 commit d2b3a07

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

src/detection/gpu/gpu_amd.c

+15-19
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static const char* ffAdlStatusToString(int status) {
3636
}
3737

3838
// Memory allocation function
39-
void* __attribute__((__stdcall__)) ADL_Main_Memory_Alloc(int iSize)
39+
static void* __attribute__((__stdcall__)) ffAdlMainMemoryAlloc(int iSize)
4040
{
4141
return malloc((size_t) iSize);
4242
}
@@ -97,7 +97,7 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
9797
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Overdrive6_StateInfo_Get)
9898
FF_DEBUG("ADL library loaded");
9999

100-
int result = ffADL2_Main_Control_Create(ADL_Main_Memory_Alloc, 1 /*iEnumConnectedAdapters*/, &adlData.apiHandle);
100+
int result = ffADL2_Main_Control_Create(ffAdlMainMemoryAlloc, 1 /*iEnumConnectedAdapters*/, &adlData.apiHandle);
101101
FF_DEBUG("ADL2_Main_Control_Create returned %s (%d)", ffAdlStatusToString(result), result);
102102
if (result != ADL_OK)
103103
return "ffADL2_Main_Control_Create() failed";
@@ -243,15 +243,18 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
243243
FF_DEBUG("Setting adapter name: %s", device->strAdapterName);
244244
}
245245

246-
int overdrive_supported = 0;
247-
int odParam = 0;
248-
int activity_supported = 0;
249-
int caps_status = adlData.ffADL2_Overdrive_Caps(adlData.apiHandle, device->iAdapterIndex, &overdrive_supported, &odParam, &activity_supported);
250-
FF_DEBUG("ADL2_Overdrive_Caps returned %s (%d), overdrive_supported: %d", ffAdlStatusToString(caps_status), caps_status, overdrive_supported);
246+
int odVersion = 0;
251247

252-
if (overdrive_supported >= 7)
253248
{
254-
FF_DEBUG("Using OverdriveN API");
249+
int odSupported = 0;
250+
int odEnabled = 0;
251+
int status = adlData.ffADL2_Overdrive_Caps(adlData.apiHandle, device->iAdapterIndex, &odSupported, &odEnabled, &odVersion);
252+
FF_DEBUG("ADL2_Overdrive_Caps returned %s (%d); supported %d, enabled %d; version %d", ffAdlStatusToString(status), status, odSupported, odEnabled, odVersion);
253+
}
254+
255+
if (odVersion >= 6)
256+
{
257+
FF_DEBUG("Using OverdriveN API (odVersion=%d)", odVersion);
255258

256259
if (result.frequency)
257260
{
@@ -305,13 +308,9 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
305308
}
306309
}
307310
}
308-
else if (overdrive_supported >= 6)
309-
{
310-
FF_DEBUG("Using Overdrive8 API; to be supported");
311-
}
312311
else
313312
{
314-
FF_DEBUG("Using Overdrive6 API");
313+
FF_DEBUG("Using Overdrive6 API (odVersion=%d)", odVersion);
315314

316315
if (result.frequency)
317316
{
@@ -346,11 +345,8 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
346345

347346
if (apiStatus == ADL_OK)
348347
{
349-
if (result.coreUsage)
350-
{
351-
*result.coreUsage = status.iActivityPercent;
352-
FF_DEBUG("Got GPU activity: %d%%", status.iActivityPercent);
353-
}
348+
*result.coreUsage = status.iActivityPercent;
349+
FF_DEBUG("Got GPU activity: %d%%", status.iActivityPercent);
354350
}
355351
else
356352
{

0 commit comments

Comments
 (0)