[Mesa-dev] [PATCH] egl/dri2: dri2_initialize: Do not reference-count TestOnly display
Nicolas Boichat
drinkcat at chromium.org
Wed Aug 3 13:54:22 UTC 2016
In the case where dri2_initialize is called with a TestOnly display,
the display is not actually initialized, so dri2_egl_display always
fails, and we cannot do any reference counting.
Fixes piglit spec at egl_khr_create_context@verify gl flavor (reproducible
with LIBGL_ALWAYS_SOFTWARE=1) and spec at egl_khr_fence_sync@conformance.
Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable at lists.freedesktop.org>
Reported-by: Michel Dänzer <michel at daenzer.net>
Signed-off-by: Nicolas Boichat <drinkcat at chromium.org>
---
Compile-tested only, please give it a spin, thanks!
src/egl/drivers/dri2/egl_dri2.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a5cab68..8cdca6a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -788,45 +788,34 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
if (disp->Options.UseFallback)
return EGL_FALSE;
+ /* Nothing to initialize for a test only display */
+ if (disp->Options.TestOnly)
+ return EGL_TRUE;
+
switch (disp->Platform) {
#ifdef HAVE_SURFACELESS_PLATFORM
case _EGL_PLATFORM_SURFACELESS:
- if (disp->Options.TestOnly)
- ret = EGL_TRUE;
- else
- ret = dri2_initialize_surfaceless(drv, disp);
+ ret = dri2_initialize_surfaceless(drv, disp);
break;
#endif
#ifdef HAVE_X11_PLATFORM
case _EGL_PLATFORM_X11:
- if (disp->Options.TestOnly)
- ret = EGL_TRUE;
- else
- ret = dri2_initialize_x11(drv, disp);
+ ret = dri2_initialize_x11(drv, disp);
break;
#endif
#ifdef HAVE_DRM_PLATFORM
case _EGL_PLATFORM_DRM:
- if (disp->Options.TestOnly)
- ret = EGL_TRUE;
- else
- ret = dri2_initialize_drm(drv, disp);
+ ret = dri2_initialize_drm(drv, disp);
break;
#endif
#ifdef HAVE_WAYLAND_PLATFORM
case _EGL_PLATFORM_WAYLAND:
- if (disp->Options.TestOnly)
- ret = EGL_TRUE;
- else
- ret = dri2_initialize_wayland(drv, disp);
+ ret = dri2_initialize_wayland(drv, disp);
break;
#endif
#ifdef HAVE_ANDROID_PLATFORM
case _EGL_PLATFORM_ANDROID:
- if (disp->Options.TestOnly)
- ret = EGL_TRUE;
- else
- ret = dri2_initialize_android(drv, disp);
+ ret = dri2_initialize_android(drv, disp);
break;
#endif
default:
--
2.8.0.rc3.226.g39d4020
More information about the mesa-dev
mailing list