Mesa (master): egl/x11: cleanup init code

Emil Velikov evelikov at kemper.freedesktop.org
Thu Dec 15 11:50:30 UTC 2016


Module: Mesa
Branch: master
Commit: 08fc74663bea34d61761b02b6194cdef686baefe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=08fc74663bea34d61761b02b6194cdef686baefe

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Thu Dec  8 00:30:34 2016 +0000

egl/x11: cleanup init code

No functional change, just rewriting it in an easier-to-understand way.

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 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,25 +1467,21 @@ 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 (!dri2_initialize_x11_dri2(drv, disp)) {
-            initialized = dri2_initialize_x11_swrast(drv, disp);
-         }
-#ifdef HAVE_DRI3
-      }
-#endif
-   } else {
-      initialized = dri2_initialize_x11_swrast(drv, disp);
+
+      if (!initialized)
+         initialized = dri2_initialize_x11_dri2(drv, disp);
    }
 
+   if (!initialized)
+      initialized = dri2_initialize_x11_swrast(drv, disp);
+
    return initialized;
 }
 




More information about the mesa-commit mailing list