From 559b7d6438486c9a9f13c5a96a3d17c9c4b536ee Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 4 Aug 2024 00:54:02 +0800 Subject: [PATCH 04/12] gpu_apple.*: fix for older systems --- src/detection/gpu/gpu_apple.c | 3 +++ src/detection/gpu/gpu_apple.m | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 16f9f9c0..d73383d8 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -4,6 +4,7 @@ #include "util/apple/cf_helpers.h" #include "util/apple/smc_temps.h" +#include #include const char* ffGpuDetectMetal(FFlist* gpus); @@ -99,7 +100,9 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET; gpu->type = FF_GPU_TYPE_UNKNOWN; gpu->frequency = FF_GPU_FREQUENCY_UNSET; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 && !defined(__ppc__) IORegistryEntryGetRegistryEntryID(registryEntry, &gpu->deviceId); +#endif ffStrbufInitStatic(&gpu->platformApi, "Metal"); ffStrbufInit(&gpu->driver); // Ok for both Apple and Intel diff --git a/src/detection/gpu/gpu_apple.m b/src/detection/gpu/gpu_apple.m index 95e4c305..2112005d 100644 --- a/src/detection/gpu/gpu_apple.m +++ b/src/detection/gpu/gpu_apple.m @@ -1,5 +1,7 @@ +#include #include "gpu.h" +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 #import #import @@ -10,9 +12,11 @@ #define MTLFeatureSet_macOS_GPUFamily1_v4 ((MTLFeatureSet) 10004) #define MTLFeatureSet_macOS_GPUFamily2_v1 ((MTLFeatureSet) 10005) #endif +#endif const char* ffGpuDetectDriverVersion(FFlist* gpus) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (@available(macOS 10.7, *)) { NSMutableArray* arr = NSMutableArray.new; @@ -30,11 +34,13 @@ const char* ffGpuDetectDriverVersion(FFlist* gpus) } } } +#endif return "Unsupported macOS version"; } const char* ffGpuDetectMetal(FFlist* gpus) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 if (@available(macOS 10.13, *)) { for (id device in MTLCopyAllDevices()) @@ -71,5 +77,6 @@ const char* ffGpuDetectMetal(FFlist* gpus) } return NULL; } +#endif return "Metal API is not supported by this macOS version"; } -- 2.47.0