Global: removes FFlist::elementSize

Improves performance of module Sound and PhysicalMemory
This commit is contained in:
李通洲
2026-04-14 10:41:18 +08:00
committed by Carter Li
parent ee7f574349
commit c7ecc33b64
170 changed files with 669 additions and 585 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ const char* detectByOpenGL(FFlist* gpus) {
FF_DEBUG("OpenGL detection returns: %s", error ?: "success");
if (!error) {
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
gpu->type = FF_GPU_TYPE_UNKNOWN;
ffStrbufInitMove(&gpu->vendor, &result.vendor);
ffStrbufInitMove(&gpu->name, &result.renderer);
+1 -1
View File
@@ -112,7 +112,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) {
continue;
}
FFGPUResult* gpu = ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
gpu->index = FF_GPU_INDEX_UNSET;
ffStrbufInit(&gpu->memoryType);
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
+2 -2
View File
@@ -56,7 +56,7 @@ static const char* detectByDrm(const FFGPUOptions* options, FFlist* gpus) {
const char* path = dev->nodes[DRM_NODE_PRIMARY];
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInit(&gpu->vendor);
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
@@ -179,7 +179,7 @@ static const char* detectByPci(const FFGPUOptions* options, FFlist* gpus) {
continue; // Likely an auxiliary display controller (#2034)
}
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(pc->pc_vendor));
ffStrbufInit(&gpu->name);
ffStrbufInitS(&gpu->driver, pc->pd_name);
+1 -1
View File
@@ -117,7 +117,7 @@ const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpu
uint16_t vendorId = data[PCI_VENDOR_ID] | (data[PCI_VENDOR_ID + 1] << 8);
uint16_t deviceId = data[PCI_DEVICE_ID] | (data[PCI_DEVICE_ID + 1] << 8);
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(vendorId));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
+1 -1
View File
@@ -24,7 +24,7 @@ const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpu
continue; // Likely an auxiliary display controller (#2034)
}
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(dev.vendor_id));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
+2 -2
View File
@@ -392,7 +392,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
return "Likely an auxiliary display controller"; // #2034
}
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString((uint16_t) vendorId));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
@@ -528,7 +528,7 @@ static const char* detectOf(FFlist* gpus, FFstrbuf* buffer, FFstrbuf* drmDir, co
++name;
}
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
gpu->index = FF_GPU_INDEX_UNSET;
gpu->deviceId = 0;
ffStrbufInit(&gpu->name);
+1 -1
View File
@@ -83,7 +83,7 @@ const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpu
continue; // Likely an auxiliary display controller (#2034)
}
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(PCI_VENDOR(pciid)));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
+1 -1
View File
@@ -72,7 +72,7 @@ const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpu
continue; // Likely an auxiliary display controller (#2034)
}
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(PCI_VENDOR(pciid)));
ffStrbufInit(&gpu->name);
ffStrbufInit(&gpu->driver);
+1 -1
View File
@@ -7,7 +7,7 @@ static int walkDevTree(di_node_t node, FF_A_UNUSED di_minor_t minor, FFlist* gpu
int* vendorId;
int* deviceId;
if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "vendor-id", &vendorId) > 0 && di_prop_lookup_ints(DDI_DEV_T_ANY, node, "device-id", &deviceId) > 0) {
FFGPUResult* gpu = (FFGPUResult*) ffListAdd(gpus);
FFGPUResult* gpu = FF_LIST_ADD(FFGPUResult, *gpus);
ffStrbufInitS(&gpu->vendor, ffGPUGetVendorString((uint16_t) *vendorId));
ffStrbufInit(&gpu->name);
ffStrbufInitS(&gpu->driver, di_driver_name(node));
+4 -2
View File
@@ -32,13 +32,15 @@ static bool queryDeviceIdsFallback(D3DKMT_ADAPTERADDRESS adapterAddress, D3DKMT_
}
static FFlist deviceIdsCache;
static bool initialized;
typedef struct {
D3DKMT_DEVICE_IDS deviceIds;
D3DKMT_ADAPTERADDRESS adapterAddress;
} CacheEntry;
if (deviceIdsCache.elementSize == 0) {
ffListInit(&deviceIdsCache, sizeof(CacheEntry));
if (!initialized) {
initialized = true;
ffListInit(&deviceIdsCache);
ULONG devIdListSize = 0;
if (CM_Get_Device_ID_List_SizeW(&devIdListSize, GUID_DEVCLASS_DISPLAY_STRING, CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT) != CR_SUCCESS || devIdListSize <= 1) {