From dcf04aa4fe0d113a344ca09301f66f3aa7745762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 13 Jan 2023 15:44:52 +0800 Subject: [PATCH] GPU: detect type based on vendor --- src/detection/gpu/gpu_apple.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 5d4d05eae..413e65746 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -67,13 +67,25 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId)) { if(vendorId == 0x106b) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_APPLE); + gpu->type = FF_GPU_TYPE_INTEGRATED; + } else if(wmemchr((const wchar_t[]) {0x1002, 0x1022}, (wchar_t)vendorId, 2)) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_AMD); + gpu->type = FF_GPU_TYPE_DISCRETE; // Apple never used AMD CPUs + } else if(wmemchr((const wchar_t[]) {0x03e7, 0x8086, 0x8087}, (wchar_t)vendorId, 3)) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_INTEL); + gpu->type = FF_GPU_TYPE_INTEGRATED; + } else if(wmemchr((const wchar_t[]) {0x0955, 0x10de, 0x12d2}, (wchar_t)vendorId, 3)) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_NVIDIA); + gpu->type = FF_GPU_TYPE_DISCRETE; + } } ffStrbufInit(&gpu->driver);