----- 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.

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.

Jose

>  
>     if (x11_dri2_accel) {
>        if (!dri2_initialize_x11_dri2(drv, disp)) {
> diff --git a/src/glx/apple/apple_visual.c
> b/src/glx/apple/apple_visual.c
> index 282934f..bef50ca 100644
> --- a/src/glx/apple/apple_visual.c
> +++ b/src/glx/apple/apple_visual.c
> @@ -72,6 +72,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj *
> pfobj, const struct glx_config * m
>     int numattr = 0;
>     GLint vsref = 0;
>     CGLError error = 0;
> +   char *env;
>  
>     /* Request an OpenGL 3.2 profile if one is available */
>     if(apple_cgl.version_major > 1 || (apple_cgl.version_major == 1
>     && apple_cgl.version_minor >= 3)) {
> @@ -87,13 +88,13 @@ apple_visual_create_pfobj(CGLPixelFormatObj *
> pfobj, const struct glx_config * m
>        attr[numattr++] = kCGLPFAColorSize;
>        attr[numattr++] = 32;
>     }
> -   else if (getenv("LIBGL_ALWAYS_SOFTWARE") != NULL) {
> +   else if ((env = getenv("LIBGL_ALWAYS_SOFTWARE")) && strcmp(env,
> "0")) {
>        apple_glx_diagnostic
>           ("Software rendering requested.  Using
>           kCGLRendererGenericFloatID.\n");
>        attr[numattr++] = kCGLPFARendererID;
>        attr[numattr++] = kCGLRendererGenericFloatID;
>     }
> -   else if (getenv("LIBGL_ALLOW_SOFTWARE") != NULL) {
> +   else if ((env = getenv("LIBGL_ALLOW_SOFTWARE")) && strcmp(env,
> "0")) {
>        apple_glx_diagnostic
>           ("Software rendering is not being excluded.  Not using
>           kCGLPFAAccelerated.\n");
>     }
> diff --git a/src/glx/glxext.c b/src/glx/glxext.c
> index 4d59a06..a33c85f 100644
> --- a/src/glx/glxext.c
> +++ b/src/glx/glxext.c
> @@ -776,6 +776,7 @@ __glXInitialize(Display * dpy)
>     struct glx_display *dpyPriv, *d;
>  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
>     Bool glx_direct, glx_accel;
> +   char *glx_direct_env, *glx_accel_env;
>  #endif
>     int i;
>  
> @@ -829,8 +830,10 @@ __glXInitialize(Display * dpy)
>     dpyPriv->glXDrawHash = __glxHashCreate();
>  
>  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
> -   glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL);
> -   glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
> +   glx_direct_env = getenv("LIBGL_ALWAYS_INDIRECT");
> +   glx_accel_env = getenv("LIBGL_ALWAYS_SOFTWARE");
> +   glx_direct = (!glx_direct_env || strcmp(glx_direct_env, "1"));
> +   glx_accel = (!glx_accel_env || strcmp(glx_accel_env, "1"));
>  
>     dpyPriv->drawHash = __glxHashCreate();
>  
> --
> 1.7.8.6
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to