[PATCH] hw/xfree86: improve detection of devices
Maarten Lankhorst
maarten.lankhorst at canonical.com
Wed Jun 12 06:57:07 PDT 2013
xf86_check_platform_slot should not exit prematurely, this causes intel to be added twice
when using pci devices like the nvidia blob.
Probing is changed slightly, xf86platform probe returns false if a pci device is found,
to force a fallback to pci detection. pci probe returns TRUE if a platform device is found,
just because falling back to old probe method is probably not a good idea.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
---
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 258988a..c0f8a97 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -546,6 +546,15 @@ xf86PciProbeDev(DriverPtr drvp)
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) {
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index e368dee..1f048c0 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -167,11 +167,12 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
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 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
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,10 +374,8 @@ xf86platformProbeDev(DriverPtr drvp)
/* 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;
- }
+ if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
+ break;
}
}
@@ -390,6 +394,7 @@ xf86platformProbeDev(DriverPtr drvp)
}
}
+ free(devList);
return foundScreen;
}
More information about the xorg-devel
mailing list