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

git pushed a commit to branch evas-gl-drm-egl-platform
in repository efl.

View the commit online.

commit b7e3ed654d4413735669e1d1383551b894464d8a
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Dec 2 20:54:04 2026 -0600

    evas:gl_drm: only set EGL_PLATFORM where eglGetDisplay() reads it
    
    Loading the gl_drm engine set EGL_PLATFORM=drm for the whole process
    and never removed it. Enlightenment, running as a Wayland compositor
    on DRM, then hands it to every client it starts. Mesa reads that
    variable to decide what the argument of eglGetDisplay() is, so a
    client calling eglGetDisplay() on its wl_display has it taken for a
    GBM device, and EGL fails to initialize. Firefox probes the GPU that
    way: under Enlightenment it gives up on EGL and renders in software
    (FEATURE_FAILURE_SOFTWARE_GL in about:support).
    
    The engine gets its own display from eglGetPlatformDisplayEXT() with
    EGL_PLATFORM_GBM_MESA, which ignores the variable. Only the
    eglGetDisplay() fallback, for an EGL without EGL_EXT_platform_base,
    still needs it, so set it there, as wayland_egl already does for its
    legacy path. The old comment blamed eglGetProcAddress() for loading
    the Wayland platform, but module_open() makes no EGL call at all, so
    nothing there relied on the variable.
    
    The test loads every built engine and checks that none of them sets
    EGL_PLATFORM. gl_drm is added to the list of engines the render
    engine tests expect, so they also check that it loads.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/modules/evas/engines/gl_drm/evas_engine.c |  4 ----
 src/modules/evas/engines/gl_drm/evas_outbuf.c |  7 ++++++-
 src/tests/evas/evas_test_render_engines.c     | 21 +++++++++++++++++++++
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c
index f1629d8e7f..fac0a1c547 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -1330,10 +1330,6 @@ module_open(Evas_Module *em)
    ORD(image_plane_assign);
    ORD(image_plane_release);
 
-   /* Mesa's EGL driver loads wayland egl by default. (called by eglGetProcaddr() )
-    * implicit env set (EGL_PLATFORM=drm) prevent that. */
-   setenv("EGL_PLATFORM", "drm", 1);
-
    symbols();
 
    /* now advertise out own api */
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index 0f825ca48c..e5c6e095b5 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -219,7 +219,12 @@ _evas_outbuf_egl_setup(Outbuf *ob)
                                                    NULL);
 #endif
    if (ob->egl.disp == EGL_NO_DISPLAY)
-     ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm);
+     {
+        /* Legacy path for stacks predating the platform extensions, where
+         * eglGetDisplay() has to be steered by the environment. */
+        setenv("EGL_PLATFORM", "drm", 1);
+        ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm);
+     }
    if (ob->egl.disp == EGL_NO_DISPLAY)
      {
         ERR("eglGetDisplay() fail. code=%#x", eglGetError());
diff --git a/src/tests/evas/evas_test_render_engines.c b/src/tests/evas/evas_test_render_engines.c
index 643f623238..777326920a 100644
--- a/src/tests/evas/evas_test_render_engines.c
+++ b/src/tests/evas/evas_test_render_engines.c
@@ -32,6 +32,9 @@ static const char *built_engines[] = {
 #ifdef BUILD_ENGINE_GL_X11
   "gl_x11",
 #endif
+#ifdef BUILD_ENGINE_GL_DRM
+  "gl_drm",
+#endif
 #ifdef BUILD_ENGINE_SOFTWARE_GDI
   "software_gdi",
 #endif
@@ -80,6 +83,23 @@ EFL_START_TEST(evas_render_lookup)
 }
 EFL_END_TEST
 
+EFL_START_TEST(evas_render_lookup_keeps_egl_platform)
+{
+   const char **itr;
+
+   unsetenv("EGL_PLATFORM");
+   for (itr = built_engines; *itr != NULL; itr++)
+     {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
+        fail_if(evas_render_method_lookup(*itr) == 0, "could not load engine: %s", *itr);
+        fail_if(getenv("EGL_PLATFORM") != NULL,
+                "loading engine %s set EGL_PLATFORM for the whole process", *itr);
+#pragma GCC diagnostic pop
+     }
+}
+EFL_END_TEST
+
 static unsigned int counter;
 
 static void
@@ -137,5 +157,6 @@ void evas_test_render_engines(TCase *tc)
 {
    tcase_add_test(tc, evas_render_engines);
    tcase_add_test(tc, evas_render_lookup);
+   tcase_add_test(tc, evas_render_lookup_keeps_egl_platform);
    tcase_add_test(tc, evas_render_callbacks);
 }

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

Reply via email to