xorg-server: Changes to 'ubuntu++1'
debian/patches/xf86-add--gpu-switch.patch | 118 ++++++++++++++++++++++++++++++
1 file changed, 118 insertions(+)
New commits:
commit 29a09f2757f2a0d0014e5a54f30335205e0e93d2
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date: Sun Jun 9 08:15:05 2013 +0200
fixup add -gpu switch patch
diff --git a/debian/patches/xf86-add--gpu-switch.patch b/debian/patches/xf86-add--gpu-switch.patch
new file mode 100644
index 0000000..5d92129
--- /dev/null
+++ b/debian/patches/xf86-add--gpu-switch.patch
@@ -0,0 +1,118 @@
+--- a/hw/xfree86/common/xf86Init.c
++++ b/hw/xfree86/common/xf86Init.c
+@@ -95,6 +95,9 @@
+ #endif
+ static Bool xorgHWOpenConsole = FALSE;
+
++int xf86gpu_idx = -1;
++const char *xf86gpu_name = NULL;
++
+ /* Common pixmap formats */
+
+ static PixmapFormatRec formats[MAXFORMATS] = {
+@@ -1435,6 +1438,23 @@
+ xf86PointerName = argv[++i];
+ return 2;
+ }
++ if (!strcmp(argv[i], "-gpu")) {
++ char *ptr;
++ long idx;
++ CHECK_FOR_REQUIRED_ARGUMENT();
++
++ idx = strtol(argv[++i], &ptr, 10);
++
++ if (idx >= 0 && *argv[i] && !ptr[0]) {
++ xf86gpu_idx = idx;
++ xf86gpu_name = NULL;
++ } else if (strchr(argv[i], ':')) {
++ xf86gpu_idx = -1;
++ xf86gpu_name = argv[i];
++ } else
++ FatalError("Invalid argument passed for -gpu.\n");
++ return 2;
++ }
+ if (!strcmp(argv[i], "-keyboard")) {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86KeyboardName = argv[++i];
+@@ -1543,6 +1563,7 @@
+ ("-keyboard name specify the core keyboard InputDevice name\n");
+ ErrorF
+ ("-pointer name specify the core pointer InputDevice name\n");
++ ErrorF("-gpu <index|name> select the primary gpu\n");
+ ErrorF("-nosilk disable Silken Mouse\n");
+ ErrorF("-flipPixels swap default black/white Pixel values\n");
+ #ifdef XF86VIDMODE
+--- a/hw/xfree86/common/xf86Priv.h
++++ b/hw/xfree86/common/xf86Priv.h
+@@ -98,6 +98,11 @@
+
+ extern ScrnInfoPtr *xf86GPUScreens; /* List of pointers to ScrnInfoRecs */
+ extern int xf86NumGPUScreens;
++
++extern int xf86gpu_idx;
++extern const char *xf86gpu_name;
++
++
+ #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;
++ }
++ }
+
+ /* 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;
+ }
+ }
+
+ 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;
++ }
++
+ foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], 0);
+ if (!foundScreen)
+ continue;
Reply to: