Imported Debian patch 2:1.15.1-0ubuntu2.6
[deb_xorg-server.git] / debian / patches / 105_nvidia_fglrx_autodetect.patch
diff --git a/debian/patches/105_nvidia_fglrx_autodetect.patch b/debian/patches/105_nvidia_fglrx_autodetect.patch
new file mode 100644 (file)
index 0000000..1d08205
--- /dev/null
@@ -0,0 +1,53 @@
+diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
+index 43c746b..750b425 100644
+--- a/hw/xfree86/common/xf86AutoConfig.c
++++ b/hw/xfree86/common/xf86AutoConfig.c
+@@ -75,6 +75,13 @@
+       "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
+       "EndSection\n\n"
++#define BUILTIN_SCREEN_SECTION_PROPRIETARY \
++      "Section \"Screen\"\n" \
++      "\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \
++      "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
++      "\tDefaultDepth\t24\n" \
++      "EndSection\n\n"
++
+ #define BUILTIN_LAYOUT_SECTION_PRE \
+       "Section \"ServerLayout\"\n" \
+       "\tIdentifier\t\"Builtin Default Layout\"\n"
+@@ -153,7 +160,11 @@ xf86AutoConfig(void)
+     for (p = deviceList; *p; p++) {
+         snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
+         AppendToConfig(buf);
+-        snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
++        if (strcmp(*p, "fglrx") == 0 || strcmp(*p, "nvidia") == 0)
++            snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION_PROPRIETARY, *p,
++                     0, *p, 0);
++        else
++            snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
+         AppendToConfig(buf);
+     }
+diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
+index e52f1da..bd62a7e 100644
+--- a/hw/xfree86/common/xf86pciBus.c
++++ b/hw/xfree86/common/xf86pciBus.c
+@@ -1107,7 +1107,8 @@ videoPtrToDriverList(struct pci_device *dev,
+         driverList[0] = "ast";
+         break;
+     case 0x1002:
+-        driverList[0] = "ati";
++        driverList[0] = "fglrx";
++        driverList[1] = "ati";
+         break;
+     case 0x102c:
+         driverList[0] = "chips";
+@@ -1143,6 +1144,7 @@ videoPtrToDriverList(struct pci_device *dev,
+     {
+         int idx = 0;
++        driverList[idx++] = "nvidia";
+ #ifdef __linux__
+         driverList[idx++] = "nouveau";
+ #endif