From 467ed54a3b0fe35bde0c9aa364b35802423fed0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 12 Feb 2024 10:12:22 +0800 Subject: [PATCH] GPU (Linux): lazy load pci.ids --- src/detection/gpu/gpu_linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index cec11dbe0..c97660b9d 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -81,7 +81,6 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus) FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate(); - loadPciIds(&pciids); struct dirent* entry; while((entry = readdir(dirp)) != NULL) @@ -141,7 +140,11 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus) } if (gpu->name.length == 0) + { + if (!pciids.length) + loadPciIds(&pciids); ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, (uint16_t) subVendorId, (uint16_t) subDeviceId, gpu); + } pciDetectDriver(gpu, &pciDir, &buffer); ffStrbufSubstrBefore(&pciDir, pciDevDirLength);