Imported Debian patch 2:1.15.1-0ubuntu2.6
[deb_xorg-server.git] / debian / patches / xf86-fixup-detection.patch
diff --git a/debian/patches/xf86-fixup-detection.patch b/debian/patches/xf86-fixup-detection.patch
new file mode 100644 (file)
index 0000000..e454c75
--- /dev/null
@@ -0,0 +1,79 @@
+--- a/hw/xfree86/common/xf86pciBus.c
++++ b/hw/xfree86/common/xf86pciBus.c
+@@ -546,6 +546,15 @@
+                     for (k = 0; k < xf86NumEntities; k++) {
+                         EntityPtr pEnt = xf86Entities[k];
++#ifdef XSERVER_PLATFORM_BUS
++                        if (pEnt->bus.type == BUS_PLATFORM &&
++                            pEnt->bus.id.plat->pdev &&
++                            MATCH_PCI_DEVICES(pEnt->bus.id.plat->pdev, pPci)) {
++                            foundScreen = TRUE;
++                            break;
++                        }
++#endif
++
+                         if (pEnt->bus.type != BUS_PCI)
+                             continue;
+                         if (pEnt->bus.id.pci == pPci) {
+--- a/hw/xfree86/common/xf86platformBus.c
++++ b/hw/xfree86/common/xf86platformBus.c
+@@ -167,11 +167,12 @@
+     for (i = 0; i < xf86NumEntities; i++) {
+         const EntityPtr u = xf86Entities[i];
+-        if (pd->pdev && u->bus.type == BUS_PCI)
+-            return !MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci);
+-        if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) {
++        if (pd->pdev && u->bus.type == BUS_PCI &&
++            MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci))
++            return FALSE;
++
++        if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat))
+             return FALSE;
+-        }
+     }
+     return TRUE;
+ }
+@@ -302,6 +303,11 @@
+         for (nent = 0; nent < xf86NumEntities; nent++) {
+             EntityPtr pEnt = xf86Entities[nent];
++            if (dev->pdev && pEnt->bus.type == BUS_PCI &&
++                MATCH_PCI_DEVICES(dev->pdev, pEnt->bus.id.pci)) {
++                return FALSE;
++            }
++
+             if (pEnt->bus.type != BUS_PLATFORM)
+                 continue;
+             if (pEnt->bus.id.plat == dev) {
+@@ -368,18 +374,15 @@
+                 /* for non-seat0 servers assume first device is the master */
+                 if (ServerIsNotSeat0())
+                     break;
+-                if (xf86_platform_devices[j].pdev) {
+-                    if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
+-                        break;
+-                }
+-                else {
++                if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
++                    break;
++                else
+                     /* there's no way to handle real platform devices at this point,
+                      * as there's no valid busID to be used, so try to move forward
+                      * in case there's only one platform device, and see if the
+                      * driver's probe succeeds or not at least once */
+                     if ((xf86_num_platform_devices == 1) && (!foundScreen))
+                         break;
+-                }
+             }
+         }
+@@ -398,6 +401,7 @@
+         }
+     }
++    free(devList);
+     return foundScreen;
+ }