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

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