From patchwork Thu Jun 11 11:58:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 89759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D86CCD98D5 for ; Thu, 11 Jun 2026 11:58:50 +0000 (UTC) Received: from www3579.sakura.ne.jp (www3579.sakura.ne.jp [49.212.243.89]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.43667.1781179125161381910 for ; Thu, 11 Jun 2026 04:58:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: no key for signature: lookup rs20250326._domainkey.rsg.ci.i.u-tokyo.ac.jp on 127.0.0.53:53: no such host" header.i=@rsg.ci.i.u-tokyo.ac.jp header.s=rs20250326 header.b=uY76W601; spf=pass (domain: rsg.ci.i.u-tokyo.ac.jp, ip: 49.212.243.89, mailfrom: odaki@rsg.ci.i.u-tokyo.ac.jp) Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 65BBwJ9O051609 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 11 Jun 2026 20:58:23 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=EWetuJiHT7vGcULrusmUiGSo0APax55alXNWEdS4eJk=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1781179103; v=1; b=uY76W6012C0JrjJUGrXmS25D5+zBHFxdfJ9qq8VaeAn2FyF6bZJPlplwEM2hAkQz cBeQ871ZNVPe2Ir/JmF8InlN2lVwCQ+N8hbeipoEMybfutv5VoZaD2AidyDPWp/a idJixBGBDLukkGAvP1BwREcMnLxLXfYO9aTx96GNnRAt2NQhkZrvZKYqOHtp5OyS OvJbdhvkv/Mozn6idWoAX7c4KQEnKaxYwSvaRToy5GGhvbj2Bo0s563YPebxqVZz QIX7nzRtw884Wlb7qT4x9J66EhDKHWNown0MNiM475SpapNIso8q8cCrx8gJjWTX rznsExj27ipASok7BeUFlg== From: Akihiko Odaki Date: Thu, 11 Jun 2026 20:58:03 +0900 Subject: [PATCH] ui/sdl2: Explicitly specify EGL platform MIME-Version: 1.0 Message-Id: <20260611-sdl-v1-1-93d4a51684bb@rsg.ci.i.u-tokyo.ac.jp> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDM0ND3eKUHN1EQxOL5BQTM0tzI3MloMqCotS0zAqwKdGxEH5xaVJWanI JSKtSbS0Ax9Ff/2cAAAA= X-Change-ID: 20260611-sdl-a148cd469727 To: qemu-devel@nongnu.org Cc: Alexander Kanavin , =?utf-8?q?Marc-Andr=C3=A9_Lu?= =?utf-8?q?reau?= , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Purdie , Mathieu Dubois-Briand , openembedded-core@lists.openembedded.org, Quan.Sun@windriver.com, Pierre-Eric Pelloux-Prayer , Akihiko Odaki X-Mailer: b4 0.16-dev-16047 X-Developer-Signature: v=1; a=openpgp-sha256; l=2811; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=ZmOFnUB6Z9kyemQSEXpuabyAQJBIFF6ju13VCv3aA7c=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ5bWojtG2znkXW+86dxmL1veFmcd6SeqZcK5+tXWJSoV7 UoLZ+7vKGVhEONikBVTZEkp2s2tEV37qTAhvgVmDisTyBAGLk4BmEhrBsP/NLW3tcq62jwdv4x2 Nj37u7V+0+8vXXfv7Fzlynno59S4UoY/HG9a/Pd/3/xl94PPT7/XrZtis/9Iecb6BmODar608lV buAE= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 11 Jun 2026 11:58:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/238438 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(). Probe EGL with the X11 platform explicitly before enabling SDL_HINT_VIDEO_X11_FORCE_EGL. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3540 Signed-off-by: Akihiko Odaki Reviewed-by: Marc-André Lureau --- Resolving the issue described in the GitLab work item also requires: https://github.com/libsdl-org/SDL/pull/15806 --- include/ui/egl-helpers.h | 5 +++++ ui/egl-helpers.c | 4 ++-- ui/sdl2.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) --- base-commit: 2db91528542672cf0db78b3f2cc0e22b36302b38 change-id: 20260611-sdl-a148cd469727 Best regards, -- Akihiko Odaki diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h index acf993fcf52f..c97a0d5c248f 100644 --- a/include/ui/egl-helpers.h +++ b/include/ui/egl-helpers.h @@ -61,6 +61,11 @@ void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf); EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win); +#if defined(CONFIG_X11) || defined(CONFIG_GBM) || defined(WIN32) +EGLDisplay qemu_egl_get_display(EGLNativeDisplayType native, + EGLenum platform); +#endif + #if defined(CONFIG_X11) || defined(CONFIG_GBM) int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode); diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index e3f2872cc14b..069a52495541 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -520,8 +520,8 @@ EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win) * platform extensions (EGL_KHR_platform_gbm and friends) yet it doesn't seem * like mesa will be able to advertise these (even though it can do EGL 1.5). */ -static EGLDisplay qemu_egl_get_display(EGLNativeDisplayType native, - EGLenum platform) +EGLDisplay qemu_egl_get_display(EGLNativeDisplayType native, + EGLenum platform) { EGLDisplay dpy = EGL_NO_DISPLAY; diff --git a/ui/sdl2.c b/ui/sdl2.c index 4fcdbd79d3c0..ce14bd1f4e15 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -862,7 +862,8 @@ static void sdl2_set_hint_x11_force_egl(void) } /* Prefer EGL over GLX to get dma-buf support. */ - egl_display = eglGetDisplay((EGLNativeDisplayType)x_disp); + egl_display = qemu_egl_get_display((EGLNativeDisplayType)x_disp, + EGL_PLATFORM_X11_KHR); if (egl_display != EGL_NO_DISPLAY) { /*