This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/292/head
in repository efl.
View the commit online.
commit 341682a8e9ff7d8668cf0a5e3d7534f356885140
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Dec 2 20:54:04 2026 -0600
evas:gl_drm: do not leave EGL_PLATFORM set in the environment
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 around that one call and put back whatever
was there before. Mesa reads the variable once, in the first
eglGetDisplay(), so nothing later depends on it staying set. 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. The legacy
fallback is not covered: no EGL at hand lacks the platform
extensions.
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 | 22 +++++++++++++++++++++-
src/tests/evas/evas_test_render_engines.c | 21 +++++++++++++++++++++
3 files changed, 42 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..222956bd00 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -164,6 +164,26 @@ _evas_outbuf_init(void)
return EINA_TRUE;
}
+/* Legacy path for stacks predating the platform extensions:
+ * eglGetDisplay() only knows its argument is a gbm_device from
+ * EGL_PLATFORM. Mesa reads it once, there, and anything left set is
+ * inherited by every process this one starts. */
+static EGLDisplay
+_evas_outbuf_legacy_egl_display_get(struct gbm_device *gbm)
+{
+ char *platform_env = eina_strdup(getenv("EGL_PLATFORM"));
+ EGLDisplay disp;
+
+ setenv("EGL_PLATFORM", "drm", 1);
+ disp = eglGetDisplay((EGLNativeDisplayType)gbm);
+ if (platform_env)
+ setenv("EGL_PLATFORM", platform_env, 1);
+ else
+ unsetenv("EGL_PLATFORM");
+ free(platform_env);
+ return disp;
+}
+
static Eina_Bool
_evas_outbuf_egl_setup(Outbuf *ob)
{
@@ -219,7 +239,7 @@ _evas_outbuf_egl_setup(Outbuf *ob)
NULL);
#endif
if (ob->egl.disp == EGL_NO_DISPLAY)
- ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm);
+ ob->egl.disp = _evas_outbuf_legacy_egl_display_get(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.