[Mesa-dev] [PATCH] i965: Update MESA_INFO to eliminate error

Brian Paul brianp at vmware.com
Thu Oct 24 01:21:41 CEST 2013


On 10/23/2013 03:14 PM, Courtney Goeltzenleuchter wrote:
> On Wed, Oct 23, 2013 at 3:05 PM, Matt Turner <mattst88 at gmail.com
> <mailto:mattst88 at gmail.com>> wrote:
>
>     On Wed, Oct 23, 2013 at 12:41 PM, Courtney Goeltzenleuchter
>     <courtney at lunarg.com <mailto:courtney at lunarg.com>> wrote:
>      > If a user set MESA_INFO and the OpenGL application uses a
>      > 3.0 or later context then the MESA_INFO debug output will have
>      > an error when it queries for extensions using the deprecated
>      > enum GL_EXTENSIONS. Passing context argument allows code
>      > to return extension list directly regardless of profile.
>      > ---
>      >  src/mesa/main/context.c |  2 +-
>      >  src/mesa/main/debug.c   | 10 +++++++---
>      >  src/mesa/main/debug.h   |  2 +-
>      >  3 files changed, 9 insertions(+), 5 deletions(-)
>      >
>      > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>      > index 0d1f71c..8218153 100644
>      > --- a/src/mesa/main/context.c
>      > +++ b/src/mesa/main/context.c
>      > @@ -1522,7 +1522,7 @@ _mesa_make_current( struct gl_context *newCtx,
>      >            * information.
>      >            */
>      >          if (_mesa_getenv("MESA_INFO")) {
>      > -           _mesa_print_info();
>      > +           _mesa_print_info(newCtx);
>      >          }
>      >
>      >          newCtx->FirstTimeCurrent = GL_FALSE;
>      > diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
>      > index 9434c1e..99b2147 100644
>      > --- a/src/mesa/main/debug.c
>      > +++ b/src/mesa/main/debug.c
>      > @@ -103,7 +103,7 @@ _mesa_print_state( const char *msg, GLuint
>     state )
>      >  /**
>      >   * Print information about this Mesa version and build options.
>      >   */
>      > -void _mesa_print_info( void )
>      > +void _mesa_print_info( struct gl_context *ctx )
>      >  {
>      >     _mesa_debug(NULL, "Mesa GL_VERSION = %s\n",
>      >            (char *) _mesa_GetString(GL_VERSION));
>      > @@ -111,8 +111,12 @@ void _mesa_print_info( void )
>      >            (char *) _mesa_GetString(GL_RENDERER));
>      >     _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n",
>      >            (char *) _mesa_GetString(GL_VENDOR));
>      > -   _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n",
>      > -          (char *) _mesa_GetString(GL_EXTENSIONS));
>      > +
>      > +   /* use ctx as GL_EXTENSIONS will not work on 3.0 or higher
>      > +    * core contexts.
>      > +    */
>      > +   _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n",
>     ctx->Extensions.String);
>
>     I think I'd go ahead and make the same change for version, renderer,
>     and vendor now that the context is directly available.
>
>     Although, I've never heard of MESA_INFO before. It doesn't appear in
>     any of my IRC logs going back to April 2011 so I don't think anyone
>     else even knows about it, much less suggests it for debugging. It's
>     also not mentioned in the Mesa docs.
>
>     I don't see any information in it that would be useful that glxinfo
>     doesn't already provide. Maybe we should just throw the whole function
>     out.

 > Hi Matt,
 >
 > I think the intended use was to provide glxinfo-like information from
 > the app's perspective, i.e. if it asked for a compatibility context or
 > something like that. That was how I discovered it, I wanted to get at
 > the list of extensions that was being given to the app as it was
 > different than what glxinfo was reporting.
 > Other than that I'm not sure of it's usefulness.

The MESA_INFO env var is ancient, but seldom used.

I agree with Courtney though in that it's different from glxinfo in that 
it can tell us exactly what context profile/version/extensions are being 
used by the application.  For that reason it's probably more useful now 
than in the past.

Matt, we don't have ctx->Renderer and ctx->Vendor strings so we have to 
keep calling _mesa_GetString() for those.

I'm OK with the patch as-is.

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list