From 42b756e703ab14477e043a2f2031c1d23fa5d09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 24 Feb 2024 12:50:21 +0800 Subject: [PATCH] GPU (Linux): revert `show sub-device if available` --- src/detection/gpu/gpu.h | 2 +- src/detection/gpu/gpu_bsd.c | 2 +- src/detection/gpu/gpu_linux.c | 2 +- src/detection/gpu/gpu_pci.c | 9 +-------- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/detection/gpu/gpu.h b/src/detection/gpu/gpu.h index 8f404f243..9558af0b5 100644 --- a/src/detection/gpu/gpu.h +++ b/src/detection/gpu/gpu.h @@ -44,5 +44,5 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus); const char* ffGetGPUVendorString(unsigned vendorId); #if defined(__linux__) || defined(__FreeBSD__) -void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu); +void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu); #endif diff --git a/src/detection/gpu/gpu_bsd.c b/src/detection/gpu/gpu_bsd.c index ed0f7337d..e0ac12f11 100644 --- a/src/detection/gpu/gpu_bsd.c +++ b/src/detection/gpu/gpu_bsd.c @@ -74,7 +74,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) { if (pciids.length == 0) loadPciIds(&pciids); - ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, pc->pc_subvendor, pc->pc_subdevice, gpu); + ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu); } #ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index c97660b9d..1a8dead18 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -143,7 +143,7 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus) { if (!pciids.length) loadPciIds(&pciids); - ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, (uint16_t) subVendorId, (uint16_t) subDeviceId, gpu); + ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, gpu); } pciDetectDriver(gpu, &pciDir, &buffer); diff --git a/src/detection/gpu/gpu_pci.c b/src/detection/gpu/gpu_pci.c index e8d454aec..c4b1e56ff 100644 --- a/src/detection/gpu/gpu_pci.c +++ b/src/detection/gpu/gpu_pci.c @@ -1,6 +1,6 @@ #include "gpu.h" -void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu) +void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu) { if (content->length) { @@ -40,13 +40,6 @@ void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint if (start) { start += len; - - // Search for subvendor and subdevice - len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t\t%04x %04x ", subVendor, subDevice); - char* subStart = memmem(start, (size_t) (end - start), buffer, len); - if (subStart) - start = subStart + len; - end = memchr(start, '\n', (uint32_t) (end - start)); if (!end) end = content->chars + content->length;