[Mesa-dev] [PATCH 2/2] Make envvars set to zero actually be false
Jose Fonseca
jfonseca at vmware.com
Fri Oct 12 02:05:44 PDT 2012
----- Original Message -----
> 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?
"y" was just an example. It could be "boo" or "foo", or "true", or "yes". My point was that before, _anything_ would set it to true, where as now only "1" will set it to true. It's pratically diametrically opposite! There is absolutely no good reason to change the semantics of everything else when your concern was "0".
And, as your google search shows, it will be hard to stop at "0". You'd soon need to fix "n", "no", "false", "f", "n", "nein", ... etc.
I have to agree with Dave. It's impossible to be consistent with all expectations. Lets at least be consistent with the expectations of those who already know how to use these vars.
Jose
More information about the mesa-dev
mailing list