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

Kenneth Graunke kenneth at whitecape.org
Wed Sep 25 14:07:53 PDT 2013


On 09/25/2013 01:00 PM, Chris Forbes wrote:
> 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;
>     }
> 

I would add a "glx: " prefix to the commit title.

Otherwise, this looks great.  I tested it by creating bogus i965_dri.so
and swrast_dri.so files in my $LIBGL_DRIVERS_PATH directory and running
glxinfo.  It fell back to indirect.  Then I used LIBGL_NEVER_INDIRECT=1
and it aborted, as I expected.

Tested-by: Kenneth Graunke <kenneth at whitecape.org>

Thanks!


More information about the mesa-dev mailing list