Skip to content

Commit

Permalink
GPU (Linux): lazy load pci.ids
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Feb 12, 2024
1 parent 7ea8882 commit 467ed54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/detection/gpu/gpu_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 467ed54

Please sign in to comment.