[Mesa-dev] [PATCH] add LIBGL_NEVER_INDIRECT env var to disable fallback to indirect

Chris Forbes chrisf at ijw.co.nz
Wed Sep 25 13:00:14 PDT 2013


This is useful when working on the drivers, since falling back to
indirect rendering means we broke our driver's ability to load somehow.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 docs/envvars.html |  1 +
 src/glx/glxext.c  | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 67d8e29..07e82b5 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -30,6 +30,7 @@ sometimes be useful for debugging end-user issues.
    If set to 'verbose' additional information will be printed.
 <li>LIBGL_DRIVERS_PATH - colon-separated list of paths to search for DRI drivers
 <li>LIBGL_ALWAYS_INDIRECT - forces an indirect rendering context/connection.
+<li>LIBGL_NEVER_INDIRECT - disables fallback to indirect rendering (will abort instead)
 <li>LIBGL_ALWAYS_SOFTWARE - if set, always use software rendering
 <li>LIBGL_NO_DRAWARRAYS - if set do not use DrawArrays GLX protocol (for debugging)
 <li>LIBGL_SHOW_FPS - print framerate to stdout based on the number of glXSwapBuffers
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index bea1ccb..491f3e2 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -781,8 +781,14 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
       if (psc == NULL)
          psc = applegl_create_screen(i, priv);
 #else
-      if (psc == NULL)
-	 psc = indirect_create_screen(i, priv);
+      if (psc == NULL) {
+         if (getenv("LIBGL_NEVER_INDIRECT") != NULL) {
+            printf("Would fall back to indirect rendering, but giving up"
+                   " due to LIBGL_NEVER_INDIRECT.\n");
+            abort();
+         }
+         psc = indirect_create_screen(i, priv);
+      }
 #endif
       priv->screens[i] = psc;
    }
-- 
1.8.4



More information about the mesa-dev mailing list