[Mesa-dev] [PATCH mesa] egl/x11: cleanup init code

Emil Velikov emil.l.velikov at gmail.com
Thu Dec 8 20:17:21 UTC 2016


On 8 December 2016 at 00:30, Eric Engestrom <eric at engestrom.ch> wrote:
> No functional change, just rewriting it in an easier-to-understand way.
>
I might be mislead by the diff, but it seems that there's functionality change.

> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
>  src/egl/drivers/dri2/platform_x11.c | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index df39ca8..db7d3b9 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -1467,24 +1467,20 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
>  EGLBoolean
>  dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
>  {
> -   EGLBoolean initialized = EGL_TRUE;
> +   EGLBoolean initialized = EGL_FALSE;
>
> -   int x11_dri2_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
> -
> -   if (x11_dri2_accel) {
> +   if (!getenv("LIBGL_ALWAYS_SOFTWARE")) {
>  #ifdef HAVE_DRI3
> -      if (getenv("LIBGL_DRI3_DISABLE") != NULL ||
> -          !dri2_initialize_x11_dri3(drv, disp)) {
> +      if (!getenv("LIBGL_DRI3_DISABLE"))
> +         initialized = dri2_initialize_x11_dri3(drv, disp);
>  #endif
> +
> +      if (!initialized)
> -         if (!dri2_initialize_x11_dri2(drv, disp)) {
> +         initialized = dri2_initialize_x11_dri2(drv, disp);
> -            initialized = dri2_initialize_x11_swrast(drv, disp);
> -         }
> -#ifdef HAVE_DRI3
> -      }
> -#endif
> -   } else {
> +   }
> +
> +   if (!initialized)
Namely here: by dropping the else, we fall-back to swrast if dri3/dri2 fails.
Not too sure how much we should care bth, although I have been
wondering if we should not start honouring
_egl_display::Options::UseFallback.

-Emil


More information about the mesa-dev mailing list