|
|
7084842 |
From 02bcb6f189c4ad8b2e73ce99cfa3c10f0c244a88 Mon Sep 17 00:00:00 2001
|
|
|
c72d21a |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
c72d21a |
Date: Fri, 30 Sep 2016 12:29:09 +0200
|
|
|
7084842 |
Subject: [PATCH xserver v2 7/7] xfree86: Try harder to find atleast 1 non GPU
|
|
|
c72d21a |
Screen
|
|
|
c72d21a |
|
|
|
c72d21a |
If we did not find any non GPU Screens, try again ignoring the notion
|
|
|
c72d21a |
of any video devices being the primary device. This fixes Xorg exiting
|
|
|
c72d21a |
with a "no screens found" error when using virtio-vga in a
|
|
|
c72d21a |
virtual-machine and when using a device driven by simpledrm.
|
|
|
c72d21a |
|
|
|
c72d21a |
This is a somewhat ugly solution, but it is the best I can come up with
|
|
|
c72d21a |
without major surgery to the bus and probe code.
|
|
|
c72d21a |
|
|
|
c72d21a |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
c72d21a |
---
|
|
|
c72d21a |
hw/xfree86/common/xf86.h | 1 +
|
|
|
c72d21a |
hw/xfree86/common/xf86Bus.c | 26 +++++++++++++++++++++++---
|
|
|
c72d21a |
hw/xfree86/common/xf86Globals.c | 1 +
|
|
|
c72d21a |
hw/xfree86/common/xf86pciBus.c | 4 ++++
|
|
|
c72d21a |
hw/xfree86/common/xf86platformBus.c | 4 ++++
|
|
|
c72d21a |
5 files changed, 33 insertions(+), 3 deletions(-)
|
|
|
c72d21a |
|
|
|
c72d21a |
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
|
|
|
c72d21a |
index e54c811..f724688 100644
|
|
|
c72d21a |
--- a/hw/xfree86/common/xf86.h
|
|
|
c72d21a |
+++ b/hw/xfree86/common/xf86.h
|
|
|
c72d21a |
@@ -55,6 +55,7 @@
|
|
|
c72d21a |
extern _X_EXPORT int xf86DoConfigure;
|
|
|
c72d21a |
extern _X_EXPORT int xf86DoShowOptions;
|
|
|
c72d21a |
extern _X_EXPORT Bool xf86DoConfigurePass1;
|
|
|
c72d21a |
+extern _X_EXPORT Bool xf86ProbeIgnorePrimary;
|
|
|
c72d21a |
extern _X_EXPORT Bool xorgHWAccess;
|
|
|
c72d21a |
|
|
|
c72d21a |
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
|
|
|
c72d21a |
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
|
|
|
c72d21a |
index a3a9898..9836803 100644
|
|
|
c72d21a |
--- a/hw/xfree86/common/xf86Bus.c
|
|
|
c72d21a |
+++ b/hw/xfree86/common/xf86Bus.c
|
|
|
c72d21a |
@@ -117,14 +117,34 @@ xf86BusConfig(void)
|
|
|
c72d21a |
int i, j;
|
|
|
c72d21a |
|
|
|
c72d21a |
/*
|
|
|
c72d21a |
- * Now call each of the Probe functions. Each successful probe will
|
|
|
c72d21a |
- * result in an extra entry added to the xf86Screens[] list for each
|
|
|
c72d21a |
- * instance of the hardware found.
|
|
|
c72d21a |
+ * 3 step probe to (hopefully) ensure that we always find at least 1
|
|
|
c72d21a |
+ * (non GPU) screen:
|
|
|
c72d21a |
+ *
|
|
|
c72d21a |
+ * 1. Call each drivers probe function normally,
|
|
|
c72d21a |
+ * Each successful probe will result in an extra entry added to the
|
|
|
c72d21a |
+ * xf86Screens[] list for each instance of the hardware found.
|
|
|
c72d21a |
*/
|
|
|
c72d21a |
for (i = 0; i < xf86NumDrivers; i++) {
|
|
|
c72d21a |
xf86CallDriverProbe(xf86DriverList[i], FALSE);
|
|
|
c72d21a |
}
|
|
|
c72d21a |
|
|
|
c72d21a |
+ /*
|
|
|
c72d21a |
+ * 2. If no Screens were found, call each drivers probe function with
|
|
|
c72d21a |
+ * ignorePrimary = TRUE, to ensure that we do actually get a
|
|
|
c72d21a |
+ * Screen if there is atleast one supported video card.
|
|
|
c72d21a |
+ */
|
|
|
c72d21a |
+ if (xf86NumScreens == 0) {
|
|
|
c72d21a |
+ xf86ProbeIgnorePrimary = TRUE;
|
|
|
c72d21a |
+ for (i = 0; i < xf86NumDrivers && xf86NumScreens == 0; i++) {
|
|
|
c72d21a |
+ xf86CallDriverProbe(xf86DriverList[i], FALSE);
|
|
|
c72d21a |
+ }
|
|
|
c72d21a |
+ xf86ProbeIgnorePrimary = FALSE;
|
|
|
c72d21a |
+ }
|
|
|
c72d21a |
+
|
|
|
c72d21a |
+ /*
|
|
|
c72d21a |
+ * 3. Call xf86platformAddGPUDevices() to add any additional video cards as
|
|
|
c72d21a |
+ * GPUScreens (GPUScreens are only supported by platformBus drivers).
|
|
|
c72d21a |
+ */
|
|
|
c72d21a |
for (i = 0; i < xf86NumDrivers; i++) {
|
|
|
c72d21a |
xf86platformAddGPUDevices(xf86DriverList[i]);
|
|
|
c72d21a |
}
|
|
|
c72d21a |
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
|
|
|
c72d21a |
index 07cfabf..e962b75 100644
|
|
|
c72d21a |
--- a/hw/xfree86/common/xf86Globals.c
|
|
|
c72d21a |
+++ b/hw/xfree86/common/xf86Globals.c
|
|
|
c72d21a |
@@ -152,6 +152,7 @@ XF86ConfigPtr xf86configptr = NULL;
|
|
|
c72d21a |
Bool xf86Resetting = FALSE;
|
|
|
c72d21a |
Bool xf86Initialising = FALSE;
|
|
|
c72d21a |
Bool xf86DoConfigure = FALSE;
|
|
|
c72d21a |
+Bool xf86ProbeIgnorePrimary = FALSE;
|
|
|
c72d21a |
Bool xf86DoShowOptions = FALSE;
|
|
|
c72d21a |
DriverPtr *xf86DriverList = NULL;
|
|
|
c72d21a |
int xf86NumDrivers = 0;
|
|
|
c72d21a |
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
|
|
|
c72d21a |
index 8158c2b..9adfee5 100644
|
|
|
c72d21a |
--- a/hw/xfree86/common/xf86pciBus.c
|
|
|
c72d21a |
+++ b/hw/xfree86/common/xf86pciBus.c
|
|
|
c72d21a |
@@ -352,6 +352,10 @@ xf86ComparePciBusString(const char *busID, int bus, int device, int func)
|
|
|
c72d21a |
Bool
|
|
|
c72d21a |
xf86IsPrimaryPci(struct pci_device *pPci)
|
|
|
c72d21a |
{
|
|
|
c72d21a |
+ /* Add max. 1 screen for the IgnorePrimary fallback path */
|
|
|
c72d21a |
+ if (xf86ProbeIgnorePrimary && xf86NumScreens == 0)
|
|
|
c72d21a |
+ return TRUE;
|
|
|
c72d21a |
+
|
|
|
c72d21a |
if (primaryBus.type == BUS_PCI)
|
|
|
c72d21a |
return pPci == primaryBus.id.pci;
|
|
|
c72d21a |
#ifdef XSERVER_PLATFORM_BUS
|
|
|
c72d21a |
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
|
|
|
c72d21a |
index 8dd0d5d..063e81c 100644
|
|
|
c72d21a |
--- a/hw/xfree86/common/xf86platformBus.c
|
|
|
c72d21a |
+++ b/hw/xfree86/common/xf86platformBus.c
|
|
|
c72d21a |
@@ -114,6 +114,10 @@ xf86_find_platform_device_by_devnum(int major, int minor)
|
|
|
c72d21a |
static Bool
|
|
|
c72d21a |
xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
|
|
|
c72d21a |
{
|
|
|
c72d21a |
+ /* Add max. 1 screen for the IgnorePrimary fallback path */
|
|
|
c72d21a |
+ if (xf86ProbeIgnorePrimary && xf86NumScreens == 0)
|
|
|
c72d21a |
+ return TRUE;
|
|
|
c72d21a |
+
|
|
|
c72d21a |
if (primaryBus.type == BUS_PLATFORM)
|
|
|
c72d21a |
return plat == primaryBus.id.plat;
|
|
|
c72d21a |
#ifdef XSERVER_LIBPCIACCESS
|
|
|
c72d21a |
--
|
|
|
c72d21a |
2.9.3
|
|
|
c72d21a |
|