[Mesa-dev] [PATCH 2/2] Make envvars set to zero actually be false
Matt Turner
mattst88 at gmail.com
Thu Oct 11 16:41:31 PDT 2012
On Thu, Oct 11, 2012 at 2:04 PM, Jose Fonseca <jfonseca at vmware.com> wrote:
> ----- Original Message -----
>> Previously, LIBGL_ALWAYS_SOFTWARE=0 glxgears would still run swrast.
>> This is not what people expect.
>> ---
>> Please check my logic. The Apple code checks the opposite (whether we
>> want software/indirect) whereas the other code checks if we have
>> acceleration.
>>
>> src/egl/drivers/dri2/platform_x11.c | 4 ++--
>> src/glx/apple/apple_visual.c | 5 +++--
>> src/glx/glxext.c | 7 +++++--
>> 3 files changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_x11.c
>> b/src/egl/drivers/dri2/platform_x11.c
>> index 936e380..38b001b 100644
>> --- a/src/egl/drivers/dri2/platform_x11.c
>> +++ b/src/egl/drivers/dri2/platform_x11.c
>> @@ -1205,8 +1205,8 @@ EGLBoolean
>> dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
>> {
>> EGLBoolean initialized = EGL_TRUE;
>> -
>> - int x11_dri2_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
>> + char *env = getenv("LIBGL_ALWAYS_SOFTWARE");
>> + int x11_dri2_accel = (!env || strcmp(env, "1"));
>
> Whereas LIBGL_ALWAYS_SOFTWARE=y would work before, it doesn't now. I think it is better to do strcmp(env, "0") == 0 instead of strcmp(env, "1") here and below for consistence.
Google gives me the following number of results:
LIBGL_ALWAYS_SOFTWARE=y - 7
LIBGL_ALWAYS_SOFTWARE=n - 5
"LIBGL_ALWAYS_SOFTWARE=1" - 10,500
"LIBGL_ALWAYS_SOFTWARE=0" - 5
Do you, or anyone else use =y/n?
> Also, it might make sense to have an helper for this. getenv() was simple enough, but if we are putting some brains on this, we should do it only once.
Yeah, that's probably true.
More information about the mesa-dev
mailing list