xfree86/common: omit unnecessary search for matching devices

It is patch 3/3 of a series that makes adding GPU screens
more controllable.

If AutoAddGPU is "off", matching devices for autoconfigured
drivers are sought for anyway, and then the unused list is
freed. This patch cancels an unnecessary search.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
This commit is contained in:
Oleh Nykyforchyn
2025-12-27 23:03:39 +02:00
committed by Enrico Weigelt, metux IT consult
parent 1dea31ce5c
commit 3a367c5a47

View File

@@ -640,20 +640,18 @@ xf86platformAddGPUDevices(DriverPtr drvp)
GDevPtr *devList;
int j;
if (!drvp->platformProbe)
if (!drvp->platformProbe || !xf86Info.autoAddGPU)
return FALSE;
xf86MatchDevice(drvp->driverName, &devList);
/* if autoaddgpu devices is enabled then go find any unclaimed platform
* devices and add them as GPU screens */
if (xf86Info.autoAddGPU) {
for (j = 0; j < xf86_num_platform_devices; j++) {
if (probeSingleDevice(&xf86_platform_devices[j], drvp,
devList ? devList[0] : NULL,
PLATFORM_PROBE_GPU_SCREEN))
foundScreen = TRUE;
}
for (j = 0; j < xf86_num_platform_devices; j++) {
if (probeSingleDevice(&xf86_platform_devices[j], drvp,
devList ? devList[0] : NULL,
PLATFORM_PROBE_GPU_SCREEN))
foundScreen = TRUE;
}
free(devList);