From 41d0f61ee0a1ee97941fa3413bbb527ba004d1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 13 May 2025 13:39:42 +0800 Subject: [PATCH] GPU (AMD): remove usage of `ADL2_Adapter_VRAMUsage_Get` It reports dedicated GPU memory usage too. Ref: https://github.com/GPUOpen-LibrariesAndSDKs/display-library/issues/48 --- src/detection/gpu/adl.h | 3 --- src/detection/gpu/gpu_amd.c | 17 ----------------- 2 files changed, 20 deletions(-) diff --git a/src/detection/gpu/adl.h b/src/detection/gpu/adl.h index 8b80572d0..ddf948ec6 100644 --- a/src/detection/gpu/adl.h +++ b/src/detection/gpu/adl.h @@ -20,9 +20,6 @@ extern int ADL2_Adapter_Graphic_Core_Info_Get(ADL_CONTEXT_HANDLE context, int iA // Function to retrieve memory information from the adapter. Version 2 extern int ADL2_Adapter_MemoryInfo2_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLMemoryInfo2* lpMemoryInfo2); -// This function retrieves the VRAM usage of given adapter. -extern int ADL2_Adapter_VRAMUsage_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* iVRAMUsageInMB); - // This function retrieves the Dedicated VRAM usage of given adapter. extern int ADL2_Adapter_DedicatedVRAMUsage_Get(ADL_CONTEXT_HANDLE context, int iAdapterIndex, int* iVRAMUsageInMB); diff --git a/src/detection/gpu/gpu_amd.c b/src/detection/gpu/gpu_amd.c index 0537b6d78..11edf9fa2 100644 --- a/src/detection/gpu/gpu_amd.c +++ b/src/detection/gpu/gpu_amd.c @@ -49,7 +49,6 @@ struct FFAdlData { FF_LIBRARY_SYMBOL(ADL2_Adapter_Graphic_Core_Info_Get) FF_LIBRARY_SYMBOL(ADL2_Adapter_MemoryInfo2_Get) FF_LIBRARY_SYMBOL(ADL2_Adapter_DedicatedVRAMUsage_Get) - FF_LIBRARY_SYMBOL(ADL2_Adapter_VRAMUsage_Get) FF_LIBRARY_SYMBOL(ADL2_Adapter_ASICFamilyType_Get) FF_LIBRARY_SYMBOL(ADL2_Overdrive_Caps) FF_LIBRARY_SYMBOL(ADL2_OverdriveN_CapabilitiesX2_Get) @@ -91,7 +90,6 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Adapter_Graphic_Core_Info_Get) FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Adapter_MemoryInfo2_Get) FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Adapter_DedicatedVRAMUsage_Get) - FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Adapter_VRAMUsage_Get) FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Adapter_ASICFamilyType_Get) FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_Overdrive_Caps) FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(atiadl, adlData, ADL2_OverdriveN_CapabilitiesX2_Get) @@ -196,21 +194,6 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu } } - if (result.sharedMemory) - { - int vramUsage = 0; - int status = adlData.ffADL2_Adapter_VRAMUsage_Get(adlData.apiHandle, device->iAdapterIndex, &vramUsage); - FF_DEBUG("ADL2_Adapter_VRAMUsage_Get returned %s (%d), usage: %d MB", - ffAdlStatusToString(status), status, vramUsage); - - if (status == ADL_OK && vramUsage >= 0) { - result.sharedMemory->used = (uint64_t) vramUsage * 1024 * 1024; - FF_DEBUG("Shared VRAM usage: %llu bytes (%d MB)", result.sharedMemory->used, vramUsage); - } else { - FF_DEBUG("Failed to get total VRAM usage"); - } - } - if (result.memoryType) { ADLMemoryInfo2 memoryInfo;