glx: try swrastg_dri, if swrast_dri fails
authorGeorge Sapountzis <gsapountzis@gmail.com>
Sat, 27 Mar 2010 12:06:05 +0000 (14:06 +0200)
committerGeorge Sapountzis <gsapountzis@gmail.com>
Sat, 27 Mar 2010 12:06:05 +0000 (14:06 +0200)
This needs a patch for xserver/glx also. An enviroment variable will be added
at some point, it chould be for swrastg only or all gallium drivers.

src/glx/drisw_glx.c

index 3db2d63f1f70cdb1052e52b0f695a9a422d432f0..99f8f2cbf068bd047c1f78223c029f7b737d3dba 100644 (file)
@@ -360,6 +360,20 @@ driDestroyScreen(__GLXscreenConfigs * psc)
       dlclose(psc->driver);
 }
 
+static void *
+driOpenSwrast(void)
+{
+   void *driver = NULL;
+
+   if (driver == NULL)
+      driver = driOpenDriver("swrast");
+
+   if (driver == NULL)
+      driver = driOpenDriver("swrastg");
+
+   return driver;
+}
+
 static __GLXDRIscreen *
 driCreateScreen(__GLXscreenConfigs * psc, int screen,
                 __GLXdisplayPrivate * priv)
@@ -367,14 +381,13 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
    __GLXDRIscreen *psp;
    const __DRIconfig **driver_configs;
    const __DRIextension **extensions;
-   const char *driverName = "swrast";
    int i;
 
    psp = Xcalloc(1, sizeof *psp);
    if (psp == NULL)
       return NULL;
 
-   psc->driver = driOpenDriver(driverName);
+   psc->driver = driOpenSwrast();
    if (psc->driver == NULL)
       goto handle_error;