55028b
From b3872657c551d884141196cb098f53d3c01d1d3d Mon Sep 17 00:00:00 2001
55028b
From: Fedora X Ninjas <x@fedoraproject.org>
55028b
Date: Tue, 23 Jun 2009 13:52:23 +1000
55028b
Subject: [PATCH] autoconfig: select nouveau by default for NVIDIA GPUs
55028b
55028b
Also, don't treat DRI setup failure as an error for nouveau.
55028b
---
55028b
 glx/glxdri.c                       |    7 +++++--
55028b
 glx/glxdri2.c                      |    7 +++++--
55028b
 hw/xfree86/common/xf86AutoConfig.c |   27 ++++++++++++++++++++++++++-
55028b
 3 files changed, 36 insertions(+), 5 deletions(-)
55028b
55028b
diff --git a/glx/glxdri.c b/glx/glxdri.c
55028b
index 5fb75a4..45c79c9 100644
55028b
--- a/glx/glxdri.c
55028b
+++ b/glx/glxdri.c
55028b
@@ -967,6 +967,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
55028b
     const __DRIconfig **driConfigs;
55028b
     const __DRIextension **extensions;
55028b
     int i;
55028b
+    int from = X_ERROR;
55028b
 
55028b
     if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
55028b
 	!DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
55028b
@@ -1046,7 +1047,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
55028b
 
55028b
     screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
55028b
     if (screen->driver == NULL) {
55028b
-	LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
55028b
+	if (!strcmp(driverName, "nouveau"))
55028b
+	    from = X_INFO;
55028b
+	LogMessage(from, "AIGLX error: dlopen of %s failed (%s)\n",
55028b
 		   filename, dlerror());
55028b
         goto handle_error;
55028b
     }
55028b
@@ -1183,7 +1186,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
55028b
 
55028b
     xfree(screen);
55028b
 
55028b
-    LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
55028b
+    LogMessage(from, "AIGLX: reverting to software rendering\n");
55028b
 
55028b
     return NULL;
55028b
 }
55028b
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
55028b
index 529b2df..ff4490b 100644
55028b
--- a/glx/glxdri2.c
55028b
+++ b/glx/glxdri2.c
55028b
@@ -587,6 +587,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
55028b
     const __DRIextension **extensions;
55028b
     const __DRIconfig **driConfigs;
55028b
     int i;
55028b
+    int from = X_ERROR;
55028b
 
55028b
     screen = xcalloc(1, sizeof *screen);
55028b
     if (screen == NULL)
55028b
@@ -613,7 +614,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
55028b
 
55028b
     screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
55028b
     if (screen->driver == NULL) {
55028b
-	LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
55028b
+	if (!strcmp(driverName, "nouveau"))
55028b
+	    from = X_INFO;
55028b
+	LogMessage(from, "AIGLX error: dlopen of %s failed (%s)\n",
55028b
 		   filename, dlerror());
55028b
         goto handle_error;
55028b
     }
55028b
@@ -692,7 +695,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
55028b
 
55028b
     xfree(screen);
55028b
 
55028b
-    LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
55028b
+    LogMessage(from, "AIGLX: reverting to software rendering\n");
55028b
 
55028b
     return NULL;
55028b
 }
55028b
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
55028b
index bc4c80b..d8fa80f 100644
55028b
--- a/hw/xfree86/common/xf86AutoConfig.c
55028b
+++ b/hw/xfree86/common/xf86AutoConfig.c
ff26d9
@@ -180,7 +180,23 @@ videoPtrToDriverList(struct pci_device *dev,
55028b
 	    break;
55028b
 	case 0x102b:		    driverList[0] = "mga";	break;
55028b
 	case 0x10c8:		    driverList[0] = "neomagic"; break;
55028b
-	case 0x10de: case 0x12d2:   driverList[0] = "nv";	break;
55028b
+	case 0x10de: case 0x12d2:
55028b
+	    switch (dev->device_id) {
55028b
+	    /* NV1 */
55028b
+	    case 0x0008:
55028b
+	    case 0x0009:
55028b
+		driverList[0] = "vesa";
55028b
+		break;
55028b
+	    /* NV3 */
55028b
+	    case 0x0018:
55028b
+	    case 0x0019:
55028b
+		driverList[0] = "nv";
55028b
+		break;
55028b
+	    default:
ff26d9
+		driverList[0] = "nouveau";
55028b
+		break;
55028b
+	    }
55028b
+	    break;
55028b
 	case 0x1106:		    driverList[0] = "openchrome"; break;
55028b
 	case 0x1163:		    driverList[0] = "rendition"; break;
55028b
 	case 0x5333:
55028b
-- 
55028b
1.6.2.2
55028b