xfree86: Make adding unclaimed devices as GPU devices a separate step

This is primarily a preparation patch for fixing the xserver exiting with
a "no screens found" error even though there are supported video cards,
due to the server not recognizing any card as the primary card.

This also fixes the (mostly theoretical) case of a platformBus capable
driver adding a device as GPUscreen before a driver which only supports
the old PCI probe method gets a chance to claim it as a normal screen.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2016-09-30 11:59:04 +02:00 committed by Adam Jackson
parent b72d161cad
commit 7121b03d32
3 changed files with 25 additions and 0 deletions

View File

@ -125,6 +125,10 @@ xf86BusConfig(void)
xf86CallDriverProbe(xf86DriverList[i], FALSE);
}
for (i = 0; i < xf86NumDrivers; i++) {
xf86platformAddGPUDevices(xf86DriverList[i]);
}
/* If nothing was detected, return now */
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR, "No devices detected.\n");

View File

@ -475,6 +475,21 @@ xf86platformProbeDev(DriverPtr drvp)
isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);
}
return foundScreen;
}
int
xf86platformAddGPUDevices(DriverPtr drvp)
{
Bool foundScreen = FALSE;
GDevPtr *devList;
int j;
if (!drvp->platformProbe)
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) {

View File

@ -41,6 +41,7 @@ struct xf86_platform_device {
#ifdef XSERVER_PLATFORM_BUS
int xf86platformProbe(void);
int xf86platformProbeDev(DriverPtr drvp);
int xf86platformAddGPUDevices(DriverPtr drvp);
extern int xf86_num_platform_devices;
extern struct xf86_platform_device *xf86_platform_devices;
@ -156,6 +157,11 @@ xf86PlatformMatchDriver(char *matches[], int nmatches);
extern void xf86platformVTProbe(void);
extern void xf86platformPrimary(void);
#else
static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
#endif
#endif