File fbdev_fallback_fail_fix.diff of Package xorg-x11-server

Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86Bus.c
===================================================================
--- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86Bus.c
+++ xorg-server-1.6.3.901/hw/xfree86/common/xf86Bus.c
@@ -429,7 +429,7 @@ xf86GetEntityInfo(int entityIndex)
     EntityInfoPtr pEnt;
     int i;
     
-    if (entityIndex >= xf86NumEntities)
+    if (entityIndex < 0 || entityIndex >= xf86NumEntities)
 	return NULL;
     
     pEnt = xnfcalloc(1,sizeof(EntityInfoRec));
@@ -1816,6 +1816,20 @@ checkRoutingForScreens(xf86State state)
     xf86FreeResList(pResVGA);
 }
 
+CARD16
+xf86BusesClaimed(void)
+{
+    CARD16 ret = 0;
+
+    if (pciSlotClaimed) ret |= 1 << BUS_PCI;
+    if (fbSlotClaimed) ret |= 1 << BUS_NONE;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+    if (sbusSlotClaimed) ret |= 1 << BUS_SBUS;
+#endif
+
+    return ret;
+}
+
 /*
  * xf86PostProbe() -- Allocate all non conflicting resources
  * This function gets called by xf86Init().
Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86Priv.h
===================================================================
--- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86Priv.h
+++ xorg-server-1.6.3.901/hw/xfree86/common/xf86Priv.h
@@ -123,6 +123,7 @@ extern RootWinPropPtr *xf86RegisteredPro
 
 /* xf86Bus.c */
 
+CARD16 xf86BusesClaimed(void);
 void xf86BusProbe(void);
 void xf86ChangeBusIndex(int oldIndex, int newIndex);
 void xf86AccessInit(void);
Index: xorg-server-1.6.3.901/hw/xfree86/common/xf86fbBus.c
===================================================================
--- xorg-server-1.6.3.901.orig/hw/xfree86/common/xf86fbBus.c
+++ xorg-server-1.6.3.901/hw/xfree86/common/xf86fbBus.c
@@ -58,7 +58,10 @@ xf86ClaimFbSlot(DriverPtr drvp, int chip
 {
     EntityPtr p;
     int num;
-    
+
+    if (xf86BusesClaimed() & ~(1 << BUS_NONE))
+        return -1;
+
     num = xf86AllocateEntity();
     p = xf86Entities[num];
     p->driver = drvp;
openSUSE Build Service is sponsored by