Skip to content

Commit e5a04ee

Browse files
committed
GPU (Linux): ignore disabled PCI devices
1 parent fea2d80 commit e5a04ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/detection/gpu/gpu_linux.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
192192
if (sscanf(pPciPath, "%" SCNx32 ":%" SCNx32 ":%" SCNx32 ".%" SCNx32, &pciDomain, &pciBus, &pciDevice, &pciFunc) != 4)
193193
return "Invalid PCI device path";
194194

195+
ffStrbufAppendS(deviceDir, "/enable");
196+
if (ffReadFileBuffer(deviceDir->chars, buffer))
197+
{
198+
if (!ffStrbufStartsWithC(buffer, '1'))
199+
return "GPU disabled";
200+
}
201+
195202
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
196203
ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString((uint16_t) vendorId));
197204
ffStrbufInit(&gpu->name);

0 commit comments

Comments
 (0)