summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-09-30 11:59:04 +0200
committerTimo Aaltonen <tjaalton@debian.org>2018-02-13 10:32:15 +0200
commit8e008a5fef473a7210889cf8ea7c1b8409a7180a (patch)
tree957c1eb3596ee38bd9564a7f7c36f15a586e2b81
parent72abbbf5d9facbdde0116223619a3412bf0bdb92 (diff)
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> (cherry picked from commit 7121b03d324fccf687d49b63c53da7c8d93038c9)
-rw-r--r--hw/xfree86/common/xf86Bus.c4
-rw-r--r--hw/xfree86/common/xf86platformBus.c15
-rw-r--r--hw/xfree86/common/xf86platformBus.h6
3 files changed, 25 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 27c6b1b8b..a3a989866 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -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");
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 39fb1dd36..8dd0d5da7 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -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) {
diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
index a7335b9da..0f5c0ef29 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -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