Blame SOURCES/0001-xfree86-Allow-mixed-fbdev-and-pci-setups.patch

0bac9e
From 3c12c28f448fa76d17e9009995c89f56cccb0abb Mon Sep 17 00:00:00 2001
4724a4
From: Adam Jackson <ajax@redhat.com>
4724a4
Date: Tue, 5 Aug 2014 12:16:31 -0400
4724a4
Subject: [PATCH] xfree86: Allow mixed fbdev and pci setups
4724a4
4724a4
You'd like to be able to do this because (for example) that way you'd be
4724a4
able to drive both intel and udlfb at once.  There's no fundamental
4724a4
reason why that can't work, so just delete the check in PostProbe that
4724a4
forbids it.  Also in the fbdev driver, we're now actually passing the PCI
4724a4
device in at init time, so we can look up the device node sanely.
4724a4
4724a4
That almost works!  Except then you break HyperV, because hyperv_fb
4724a4
binds to the vmbus device, not the PCI device, because why the hell not.
4724a4
So then the PCI probe path fails (because we try to find the fbdev node
4724a4
under the PCI device tree, and fail), but the legacy probe path
4724a4
succeeds; but then Init fails because we don't preserve that fd (or even
4724a4
which /dev node we opened!), and since it _is_ a PCI device we try
4724a4
fbdev_open_pci and that fails like it did during PCI probe.  "I know",
4724a4
you think, "I'll just record the choice made at probe time", and then
4724a4
you remember you have nowhere to hang it.
4724a4
4724a4
So, whatever.  If we make it to Init we know Probe succeeded one way or
4724a4
the other, so just fall back from pci-style to handwave-style in Init
4724a4
once if it seem appropriate.  And in all cases, use the explicit-device
4724a4
open path even for PCI devices so that Option "fbdev" actually takes
4724a4
effect.
4724a4
4724a4
I think this is the best you can do without breaking the Probe
4724a4
interface, though admittedly burning this all to the ground is a noble
4724a4
goal.
4724a4
4724a4
Signed-off-by: Adam Jackson <ajax@redhat.com>
4724a4
---
0bac9e
 hw/xfree86/common/xf86Bus.c  | 15 ---------------
4724a4
 hw/xfree86/fbdevhw/fbdevhw.c | 18 +++++++++++++++---
0bac9e
 2 files changed, 15 insertions(+), 18 deletions(-)
4724a4
4724a4
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
0bac9e
index 6bbf489..3186478 100644
4724a4
--- a/hw/xfree86/common/xf86Bus.c
4724a4
+++ b/hw/xfree86/common/xf86Bus.c
0bac9e
@@ -536,21 +536,6 @@ xf86GetDevFromEntity(int entityIndex, int instance)
0bac9e
 void
0bac9e
 xf86PostProbe(void)
4724a4
 {
4724a4
-    if (fbSlotClaimed && (
4724a4
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
4724a4
-                             sbusSlotClaimed ||
4724a4
-#endif
4724a4
-#ifdef XSERVER_PLATFORM_BUS
4724a4
-                             platformSlotClaimed ||
4724a4
-#endif
4724a4
-#ifdef XSERVER_LIBPCIACCESS
4724a4
-                             pciSlotClaimed
4724a4
-#else
4724a4
-                             TRUE
4724a4
-#endif
4724a4
-        ))
4724a4
-        FatalError("Cannot run in framebuffer mode. Please specify busIDs "
4724a4
-                   "       for all framebuffer devices\n");
0bac9e
 }
0bac9e
 
0bac9e
 int
4724a4
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
0bac9e
index 0bd77df..a2cf78f 100644
4724a4
--- a/hw/xfree86/fbdevhw/fbdevhw.c
4724a4
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
0bac9e
@@ -351,7 +351,7 @@ fbdevHWProbe(struct pci_device *pPci, char *device, char **namep)
4724a4
 {
4724a4
     int fd;
4724a4
 
4724a4
-    if (pPci)
4724a4
+    if (pPci && !device)
4724a4
         fd = fbdev_open_pci(pPci, namep);
4724a4
     else
4724a4
         fd = fbdev_open(-1, device, namep);
0bac9e
@@ -365,16 +365,28 @@ fbdevHWProbe(struct pci_device *pPci, char *device, char **namep)
4724a4
 Bool
4724a4
 fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device)
4724a4
 {
4724a4
+    static Bool been_here;
4724a4
     fbdevHWPtr fPtr;
4724a4
 
4724a4
     fbdevHWGetRec(pScrn);
4724a4
     fPtr = FBDEVHWPTR(pScrn);
4724a4
 
4724a4
     /* open device */
4724a4
-    if (pPci)
4724a4
+    if (pPci && !device)
4724a4
         fPtr->fd = fbdev_open_pci(pPci, NULL);
4724a4
     else
4724a4
-        fPtr->fd = fbdev_open(pScrn->scrnIndex, device, NULL);
4724a4
+	fPtr->fd = fbdev_open(pScrn->scrnIndex, device, NULL);
4724a4
+
4724a4
+    if (pPci && fPtr->fd == -1) {
4724a4
+	if (been_here != serverGeneration) {
4724a4
+	    fPtr->fd = fbdev_open(pScrn->scrnIndex, device, NULL);
4724a4
+	    been_here = serverGeneration;
4724a4
+	} else {
4724a4
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
4724a4
+		       "Please specify Option \"fbdev\" to use this device\n");
4724a4
+	}
4724a4
+    }
4724a4
+
4724a4
     if (-1 == fPtr->fd) {
4724a4
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
4724a4
                    "Failed to open framebuffer device, consult warnings"
4724a4
-- 
0bac9e
2.17.0
4724a4