[Mesa-dev] [PATCH 01/14] mesa: add env var to force enable the KHR_no_error ctx flag

Michel Dänzer michel at daenzer.net
Wed Apr 19 01:39:33 UTC 2017


On 18/04/17 07:35 PM, Nicolai Hähnle wrote:
> On 18.04.2017 02:09, Timothy Arceri wrote:
>> V2: typo know -> known
>> ---
>>  docs/envvars.html       | 3 +++
>>  src/mesa/main/context.c | 3 +++
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/docs/envvars.html b/docs/envvars.html
>> index 6537365..a064f56 100644
>> --- a/docs/envvars.html
>> +++ b/docs/envvars.html
>> @@ -39,20 +39,23 @@ sometimes be useful for debugging end-user issues.
>>
>>
>>
>>  <h2>Core Mesa environment variables</h2>
>>
>>  <ul>
>>  <li>MESA_NO_ASM - if set, disables all assembly language optimizations
>>  <li>MESA_NO_MMX - if set, disables Intel MMX optimizations
>>  <li>MESA_NO_3DNOW - if set, disables AMD 3DNow! optimizations
>>  <li>MESA_NO_SSE - if set, disables Intel SSE optimizations
>> +<li>MESA_NO_ERROR - if set error checking is disabled as per
>> KHR_no_error.
>> +   This will result in undefined behaviour for invalid use of the
>> api, but
>> +   can reduce CPU use for apps that are known to be error free.</li>
>>  <li>MESA_DEBUG - if set, error messages are printed to stderr.  For
>> example,
>>     if the application generates a GL_INVALID_ENUM error, a
>> corresponding error
>>     message indicating where the error occurred, and possibly why,
>> will be
>>     printed to stderr.<br>
>>
>>     For release builds, MESA_DEBUG defaults to off (no debug output).
>>
>>     MESA_DEBUG accepts the following comma-separated list of named
>>     flags, which adds extra behaviour to just set MESA_DEBUG=1:
>>     <ul>
>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>> index 8876ca2..33bdbd7 100644
>> --- a/src/mesa/main/context.c
>> +++ b/src/mesa/main/context.c
>> @@ -1201,20 +1201,23 @@ _mesa_initialize_context(struct gl_context *ctx,
>>        shared = _mesa_alloc_shared_state(ctx);
>>        if (!shared)
>>           return GL_FALSE;
>>     }
>>
>>     _mesa_reference_shared_state(ctx, &ctx->Shared, shared);
>>
>>     if (!init_attrib_groups( ctx ))
>>        goto fail;
>>
>> +   if (getenv("MESA_NO_ERROR"))
>> +      ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
>> +
> 
> This seems like the kind of setting that should be ignored for setuid
> processes. Not that we're particularly clean about this in general, and
> GL apps really shouldn't be setuid in the first place, but still...

Also, there should be a way to force error checking, even if the
application asks to disable it, so that we can still detect incorrect
application behaviour. Either using e.g. MESA_NO_ERROR=0 or a different
environment variable.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list