debian/patches/series | 2 debian/patches/xf86-add--gpu-switch.patch | 236 ++++++++++++++++++++++-------- debian/patches/xf86-fixup-detection.patch | 79 ++++++++++ 3 files changed, 259 insertions(+), 58 deletions(-)
New commits: commit ef7a883c40fe43d9ba301cc7f9979ff883fe1968 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Thu Jun 13 11:04:27 2013 +0200 make -gpu work correctly diff --git a/debian/patches/series b/debian/patches/series index 5ff1f8b..9e10a04 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -45,4 +45,6 @@ dix-fixup-build-failure.patch config-add-no-removal.patch xf86-detach-scanout.patch xf86-fixup-unbind.patch +xf86-fixup-detection.patch 228_autobind_gpu.patch +xf86-add--gpu-switch.patch diff --git a/debian/patches/xf86-add--gpu-switch.patch b/debian/patches/xf86-add--gpu-switch.patch index 5d92129..3e6cc44 100644 --- a/debian/patches/xf86-add--gpu-switch.patch +++ b/debian/patches/xf86-add--gpu-switch.patch @@ -1,6 +1,8 @@ +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 91ec4c8..b9a1065 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c -@@ -95,6 +95,9 @@ +@@ -95,6 +95,9 @@ void (*xf86OSPMClose) (void) = NULL; #endif static Bool xorgHWOpenConsole = FALSE; @@ -10,7 +12,7 @@ /* Common pixmap formats */ static PixmapFormatRec formats[MAXFORMATS] = { -@@ -1435,6 +1438,23 @@ +@@ -1399,6 +1402,23 @@ ddxProcessArgument(int argc, char **argv, int i) xf86PointerName = argv[++i]; return 2; } @@ -34,7 +36,7 @@ if (!strcmp(argv[i], "-keyboard")) { CHECK_FOR_REQUIRED_ARGUMENT(); xf86KeyboardName = argv[++i]; -@@ -1543,6 +1563,7 @@ +@@ -1507,6 +1527,7 @@ ddxUseMsg(void) ("-keyboard name specify the core keyboard InputDevice name\n"); ErrorF ("-pointer name specify the core pointer InputDevice name\n"); @@ -42,9 +44,11 @@ ErrorF("-nosilk disable Silken Mouse\n"); ErrorF("-flipPixels swap default black/white Pixel values\n"); #ifdef XF86VIDMODE +diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h +index 58cfe0a..a639fbd 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h -@@ -98,6 +98,11 @@ +@@ -96,6 +96,11 @@ extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable; extern ScrnInfoPtr *xf86GPUScreens; /* List of pointers to ScrnInfoRecs */ extern int xf86NumGPUScreens; @@ -56,63 +60,179 @@ #ifndef DEFAULT_VERBOSE #define DEFAULT_VERBOSE 0 #endif ---- a/hw/xfree86/common/xf86platformBus.c -+++ b/hw/xfree86/common/xf86platformBus.c -@@ -355,7 +355,14 @@ - Bool foundScreen = FALSE; - GDevPtr *devList; - const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList); -- int i, j; -+ int i, j, primary_idx = 0; -+ -+ for (i = 0; i < xf86_num_platform_devices; ++i) { -+ if (xf86_platform_devices[j].pdev && xf86IsPrimaryPlatform(&xf86_platform_devices[i])) { -+ primary_idx = i; -+ break; -+ } -+ } +diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c +index 258988a..51a3b53 100644 +--- a/hw/xfree86/common/xf86pciBus.c ++++ b/hw/xfree86/common/xf86pciBus.c +@@ -77,6 +77,10 @@ int pciSlotClaimed = 0; + (((c) & 0x00ffff00) \ + == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8))) - /* find the main device or any device specificed in xorg.conf */ - for (i = 0; i < numDevs; i++) { -@@ -369,23 +376,35 @@ - if (ServerIsNotSeat0()) - break; - if (xf86_platform_devices[j].pdev) { -- if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) -+ if (xf86gpu_idx >= 0) - break; -- } -- else { -+ else if (j == primary_idx) -+ break; -+ } else if ((xf86_num_platform_devices == 1) && (!foundScreen)) - /* 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; -- } -+ break; ++#define IS_3D(c) \ ++ (((c) & 0x00ffff00) \ ++ == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_3D << 8))) ++ + static struct pci_slot_match xf86IsolateDevice = { + PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0 + }; +@@ -88,6 +92,7 @@ static struct pci_slot_match xf86IsolateDevice = { + void + xf86PciProbe(void) + { ++ int primary_idx = -1; + int i = 0, k; + int num = 0; + struct pci_device *info; +@@ -113,6 +118,7 @@ xf86PciProbe(void) + if (primaryBus.type == BUS_NONE && pci_device_is_boot_vga(info)) { + primaryBus.type = BUS_PCI; + primaryBus.id.pci = info; ++ primary_idx = num - 1; } + info->user_data = 0; } +@@ -128,10 +134,12 @@ xf86PciProbe(void) + pci_device_cfg_read_u16(info, &command, 4); - if (j == xf86_num_platform_devices) - continue; - -+ /* -+ * When xf86gpu_idx is set the primary device will come first. -+ * The rest will be reordered, this way -gpu 0 will always map -+ * to the default. -+ */ -+ if (xf86gpu_idx >= 0) { -+ if (j < primary_idx) { -+ if (j + 1 != xf86gpu_idx) -+ continue; -+ } else if (j - primary_idx != xf86gpu_idx) -+ continue; -+ } + if ((command & PCI_CMD_MEM_ENABLE) +- && ((num == 1) || IS_VGA(info->device_class))) { ++ && (num == 1 || IS_VGA(info->device_class) || ++ IS_3D(info->device_class))) { + if (primaryBus.type == BUS_NONE) { + primaryBus.type = BUS_PCI; + primaryBus.id.pci = info; ++ primary_idx = i; + } + else { + xf86Msg(X_NOTICE, +@@ -142,6 +150,17 @@ xf86PciProbe(void) + } + } + ++ if (xf86gpu_idx > 0 && primary_idx >= 0) { ++ if (xf86gpu_idx >= num) ++ FatalError("invalid -gpu %i specified devices, only %i cards found\n", xf86gpu_idx, num); + - foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], 0); - if (!foundScreen) ++ primaryBus.type = BUS_PCI; ++ if (xf86gpu_idx > primary_idx) ++ primaryBus.id.pci = xf86PciVideoInfo[xf86gpu_idx]; ++ else ++ primaryBus.id.pci = xf86PciVideoInfo[xf86gpu_idx - 1]; ++ } ++ + /* Print a summary of the video devices found */ + for (k = 0; k < num; k++) { + const char *prim = " "; +@@ -153,7 +172,7 @@ xf86PciProbe(void) continue; + + if (xf86IsPrimaryPci(info)) +- prim = "*"; ++ prim = xf86gpu_idx > 0 ? "o" : "*"; + + xf86Msg(X_PROBED, "PCI:%s(%u:%u:%u:%u) %04x:%04x:%04x:%04x ", prim, + info->domain, info->bus, info->dev, info->func, +diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c +index e368dee..2fb4694 100644 +--- a/hw/xfree86/common/xf86platformBus.c ++++ b/hw/xfree86/common/xf86platformBus.c +@@ -131,7 +131,7 @@ xf86IsPrimaryPlatform(struct xf86_platform_device *plat) + return ((primaryBus.type == BUS_PLATFORM) && (plat == primaryBus.id.plat)); + } + +-static void ++static int + platform_find_pci_info(struct xf86_platform_device *pd, char *busid) + { + struct pci_slot_match devmatch; +@@ -143,20 +143,22 @@ platform_find_pci_info(struct xf86_platform_device *pd, char *busid) + &devmatch.domain, &devmatch.bus, &devmatch.dev, + &devmatch.func); + if (ret != 4) +- return; ++ return 0; + + iter = pci_slot_match_iterator_create(&devmatch); + info = pci_device_next(iter); ++ ret = 0; + if (info) { + pd->pdev = info; + pci_device_probe(info); + if (pci_device_is_boot_vga(info)) { + primaryBus.type = BUS_PLATFORM; + primaryBus.id.plat = pd; ++ ret = 1; + } + } + pci_iterator_destroy(iter); +- ++ return ret; + } + + static Bool +@@ -216,22 +219,46 @@ xf86PlatformMatchDriver(char *matches[], int nmatches) + int + xf86platformProbe(void) + { +- int i; +- Bool pci = TRUE; ++ int i, primary_idx = 0; + + config_odev_probe(xf86PlatformDeviceProbe); + +- if (!xf86scanpci()) { +- pci = FALSE; +- } ++ if (!xf86scanpci()) ++ return 0; + + for (i = 0; i < xf86_num_platform_devices; i++) { + char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID); + +- if (pci && (strncmp(busid, "pci:", 4) == 0)) { +- platform_find_pci_info(&xf86_platform_devices[i], busid); ++ if (strncmp(busid, "pci:", 4) == 0) { ++ if (platform_find_pci_info(&xf86_platform_devices[i], busid)) ++ primary_idx = i; + } + } ++ ++ if (xf86gpu_idx > 0 && ++ xf86gpu_idx < xf86_num_platform_devices) { ++ if (xf86gpu_idx <= primary_idx) ++ primaryBus.id.plat = &xf86_platform_devices[xf86gpu_idx - 1]; ++ else ++ primaryBus.id.plat = &xf86_platform_devices[xf86gpu_idx]; ++ } ++ ++ for (i = 0; i < xf86_num_platform_devices; i++) { ++ const char *prim = " "; ++ Bool memdone = FALSE, iodone = FALSE; ++ struct xf86_platform_device *dev = &xf86_platform_devices[i]; ++ ++ if (xf86IsPrimaryPlatform(dev)) ++ prim = xf86gpu_idx > 0 ? "o" : "*"; ++ ++ xf86Msg(X_PROBED, "[%s%i] %s %s %s %04x:%04x\n", prim, i, ++ xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID), ++ xf86_get_platform_attrib(i, ODEV_ATTRIB_PATH), ++ xf86_get_platform_attrib(i, ODEV_ATTRIB_SYSPATH), ++ dev->pdev ? dev->pdev->vendor_id : 0xffff, ++ dev->pdev ? dev->pdev->device_id : 0xffff); ++ } ++ + return 0; + } + +diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h +index f69e55b..1183b7a 100644 +--- a/hw/xfree86/os-support/bus/xf86Pci.h ++++ b/hw/xfree86/os-support/bus/xf86Pci.h +@@ -173,6 +173,7 @@ + /* 0x03 display subclasses */ + #define PCI_SUBCLASS_DISPLAY_VGA 0x00 + #define PCI_SUBCLASS_DISPLAY_XGA 0x01 ++#define PCI_SUBCLASS_DISPLAY_3D 0x02 + #define PCI_SUBCLASS_DISPLAY_MISC 0x80 + + /* 0x04 multimedia subclasses */ diff --git a/debian/patches/xf86-fixup-detection.patch b/debian/patches/xf86-fixup-detection.patch new file mode 100644 index 0000000..e454c75 --- /dev/null +++ b/debian/patches/xf86-fixup-detection.patch @@ -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; + } + -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1uoysn-0001tm...@vasks.debian.org