summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Boichat <[email protected]>2016-08-03 21:54:22 +0800
committerEmil Velikov <[email protected]>2016-08-23 18:08:17 +0100
commit4f3f8bb59dd98e39c363fe47a55a7f97e7df9f4b (patch)
treeb620e1ae8eb397b674ab580d5b2362847b0a6486
parent6687037f1fdc76089f3d0ad2f4d48aa8c2263f28 (diff)
egl/dri2: dri2_initialize: Do not reference-count TestOnly display
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@egl_khr_create_context@verify gl flavor (reproducible with LIBGL_ALWAYS_SOFTWARE=1). Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) Cc: "12.0" <[email protected]> Reported-by: Michel Dänzer <[email protected]> Signed-off-by: Nicolas Boichat <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index ac5ecbbf3fd..e854903a6f1 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: