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>
(cherry picked from commit
b111e8aa4940e8b155f38b5ef238c295ded8a6b4)
"description": "egl: handle NULL loaderPrivate in dri_is_thread_safe",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
}
static GLboolean
-dri_is_thread_safe(void *loaderPrivate)
+dri_is_thread_safe(UNUSED void *loaderPrivate)
{
+#ifdef HAVE_X11_PLATFORM
struct dri2_egl_surface *dri2_surf = loaderPrivate;
- UNUSED _EGLDisplay *display = dri2_surf->base.Resource.Display;
-#ifdef HAVE_X11_PLATFORM
+ /* 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