From 45d6f2140203ed832c8e059d24e7188927af56b0 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sat, 17 Sep 2022 02:59:07 +0800 Subject: [PATCH] GPU: better support Intel GPUs --- src/detection/gpu/gpu_apple.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 745704457..e756b9467 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -34,8 +34,20 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) ffStrbufInit(&gpu->name); //IOAccelerator returns model property for Apple Silicon, but not for Intel Iris GPUs. //Still needs testing for AMD's - if(!ffCfDictGetString(properties, CFSTR("model"), &gpu->name) && gpu->driver.length > 0) - ffStrbufAppendS(&gpu->name, gpu->driver.chars + ffStrbufLastIndexC(&gpu->driver, '.') + 1); + if(!ffCfDictGetString(properties, CFSTR("model"), &gpu->name)) + { + CFRelease(properties); + + io_registry_entry_t parentEntry; + IORegistryEntryGetParentEntry(registryEntry, kIOServicePlane, &parentEntry); + if(IORegistryEntryCreateCFProperties(parentEntry, &properties, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess) + { + IOObjectRelease(parentEntry); + IOObjectRelease(registryEntry); + continue; + } + ffCfDictGetString(properties, CFSTR("model"), &gpu->name); + } if(!ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;