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