SDL: x11: Explicitly specify EGL platform (b40b7)

From b40b73d9549ce413a15dd6a461a1f20b3ac7295c Mon Sep 17 00:00:00 2001
From: Akihiko Odaki <[EMAIL REDACTED]>
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 c278ac1e5135b..92f9976f8fdab 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)