From b3aa7083e28bc01277eb7650cb3860272fed77f2 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Thu, 11 Jun 2026 20:31:57 +0900 Subject: [PATCH] x11: Explicitly specify EGL platform Mesa's eglGetDisplay() chooses the native EGL platform from EGL_PLATFORM, limited autodetection, or the build-time default. If that selects Wayland while SDL is using the X11 video backend, Mesa can treat the X11 Display pointer as a wl_display and crash during eglInitialize(). See: https://gitlab.com/qemu-project/qemu/-/work_items/3540 --- src/video/x11/SDL_x11opengles.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c index c278ac1e51..92f9976f8f 100644 --- a/src/video/x11/SDL_x11opengles.c +++ b/src/video/x11/SDL_x11opengles.c @@ -53,7 +53,8 @@ int X11_GLES_LoadLibrary(_THIS, const char *path) #endif } - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, + EGL_PLATFORM_X11_KHR); } XVisualInfo *X11_GLES_GetVisual(_THIS, Display *display, int screen)