This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch fix-release-build
in repository efl.

View the commit online.

commit b5fb7ded6ca7e010fec69d9b0f9df5cbdea9b4a4
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Aug 4 22:01:48 2026 -0600

    evas/wayland_egl: check the platform extension we actually use
    
    eng_window_new() tests for EXT_platform_base and then calls
    eglGetPlatformDisplayEXT() with EGL_PLATFORM_WAYLAND_EXT. Those are two
    different extensions: EGL_EXT_platform_base is what supplies the entry
    point, EGL_EXT_platform_wayland (or its KHR alias) is what makes that
    platform token legal to pass it. A driver with the former and not the
    latter gets handed a platform it never claimed to support, and the
    fallback that was meant to catch exactly this never triggers.
    
    Test for both, and match the full extension name while here - the
    substring "EXT_platform_base" also matches nothing else today, but only
    by luck.
    
    Also drop the two unconditional setenv("EGL_PLATFORM", "wayland") calls
    in the engine setup. They date from eglGetDisplay() autodetection
    picking X11 for a wl_display, which is what the platform display path
    above exists to avoid; eng_window_new() still sets it on the legacy path
    where it is genuinely needed. Setting it process wide pins every other
    EGL backend in the same process to the wayland platform.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
 src/modules/evas/engines/wayland_egl/evas_engine.c  | 20 ++++++++------------
 src/modules/evas/engines/wayland_egl/evas_wl_main.c | 12 ++++++++++--
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 3d1b106ecf..3bed36ebe0 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -85,13 +85,11 @@ symbols(void)
 
    if (done) return;
 
-   /* FIXME: Remove this line as soon as eglGetDisplay() autodetection
-    * gets fixed. Currently it is incorrectly detecting wl_display and
-    * returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND.
-    *
-    * See ticket #1972 for more info.
+   /* NB: eng_window_new() sets EGL_PLATFORM itself, but only on the
+    * legacy path where the EGL platform extensions are missing.  Forcing
+    * it here as well would pin the whole process to the wayland platform
+    * even when another engine in the same process wants gbm or x11.
     */
-   setenv("EGL_PLATFORM", "wayland", 1);
 
 #define LINK2GENERIC(sym) \
    glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
@@ -539,13 +537,11 @@ eng_output_setup(void *engine, void *info, unsigned int w, unsigned int h)
 
    swap_mode = _eng_swap_mode_get();
 
-   /* FIXME: Remove this line as soon as eglGetDisplay() autodetection
-    * gets fixed. Currently it is incorrectly detecting wl_display and
-    * returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND.
-    *
-    * See ticket #1972 for more info.
+   /* NB: eng_window_new() sets EGL_PLATFORM itself, but only on the
+    * legacy path where the EGL platform extensions are missing.  Forcing
+    * it here as well would pin the whole process to the wayland platform
+    * even when another engine in the same process wants gbm or x11.
     */
-   setenv("EGL_PLATFORM", "wayland", 1);
 
    /* try to allocate space for a new render engine */
    if (!(re = calloc(1, sizeof(Render_Engine))))
diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
index 58406f95c2..f3cbb4ad87 100644
--- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c
+++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
@@ -47,8 +47,14 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap
    context_attrs[2] = EGL_NONE;
 
    wl_disp = ecore_wl2_display_get(gw->wl2_disp);
+   /* EGL_EXT_platform_base gives us eglGetPlatformDisplayEXT; it is
+    * EGL_EXT_platform_wayland (or its KHR alias) that makes
+    * EGL_PLATFORM_WAYLAND_EXT a legal token for it.  Checking only the
+    * former can hand the driver a platform it never claimed to support. */
    const char *s = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
-   if (s && strstr(s, "EXT_platform_base"))
+   if (s && strstr(s, "EGL_EXT_platform_base") &&
+       (strstr(s, "EGL_EXT_platform_wayland") ||
+        strstr(s, "EGL_KHR_platform_wayland")))
      {
         EGLDisplay (*func) (EGLenum platform, void *native_display, const EGLint *attrib_list);
         func = (void *)eglGetProcAddress("eglGetPlatformDisplayEXT");
@@ -58,7 +64,9 @@ eng_window_new(Evas_Engine_Info_Wayland *einfo, int w, int h, Render_Output_Swap
    else
      {
 noext:
-        putenv("EGL_PLATFORM=wayland");
+        /* Legacy path for stacks predating the platform extensions, where
+         * eglGetDisplay() has to be steered by the environment. */
+        setenv("EGL_PLATFORM", "wayland", 1);
         gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)wl_disp);
      }
    if (!gw->egl_disp)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to