egl: handle NULL loaderPrivate in dri_is_thread_safe

This can happen when a context is created from
loader_dri3_blit_context_get and glthread is enabled.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7949
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7960
Cc: mesa-stable

Acked-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20479>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2023-01-02 17:27:41 +01:00
committed by Marge Bot
parent 5449b6927a
commit b111e8aa49
+12 -4
View File
@@ -160,12 +160,20 @@ dri2_gl_flush()
}
static GLboolean
dri_is_thread_safe(void *loaderPrivate)
dri_is_thread_safe(UNUSED void *loaderPrivate)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
UNUSED _EGLDisplay *display = dri2_surf->base.Resource.Display;
#ifdef HAVE_X11_PLATFORM
struct dri2_egl_surface *dri2_surf = loaderPrivate;
/* loader_dri3_blit_context_get creates a context with
* loaderPrivate being NULL. Enabling glthread for a blitting
* context isn't useful so return false.
*/
if (!loaderPrivate)
return false;
_EGLDisplay *display = dri2_surf->base.Resource.Display;
Display *xdpy = (Display*)display->PlatformDisplay;
/* Check Xlib is running in thread safe mode when running on EGL/X11-xlib