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

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