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

git pushed a commit to branch devs/cedric/wl/drm-device
in repository efl.

View the commit online.

commit 063743d33d23a78a79d3c67354dc19c2d583c57c
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Aug 17 09:41:00 2026 -0600

    evas/gl_x11: ask for the EGLDisplay once and keep it
    
    eng_best_visual_get() gets an EGLDisplay and initialises it, then
    eng_window_new() gets the same one and initialises it again. EGL hands
    back the same EGLDisplay for the same native display either way, so
    remembering it changes nothing about what we use.
    
    It changes what we ask for. With libglvnd 1.7 in the way, asking again
    for a display that has already been initialised drops the
    EGL_DEVICE_EXT attribute on it: eglQueryDisplayAttribEXT keeps returning
    EGL_TRUE but writes a NULL device from then on, and it stays that way
    for the rest of the process. Reduced outside EFL: one
    eglGetPlatformDisplay plus any number of eglInitialize calls keeps the
    device, a second eglGetPlatformDisplay after the first eglInitialize
    loses it.
    
    That was enough to make evasglQueryDrmDevice() unable to name the GPU it
    renders on - it returned EINA_FALSE on a perfectly ordinary Panfrost
    setup, which would have left a compositor stuck on dmabuf version 3 with
    no way to tell a driver limitation from this.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    Claude-Session: https://claude.ai/code/session_01GyH3ReM1swci5M7yZ3wovr
---
 src/modules/evas/engines/gl_x11/evas_x_main.c | 39 ++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 06e05f8e4d..bac09af20b 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -185,22 +185,53 @@ _visuals_hash_index_get_from_info(Evas_Engine_Info_GL_X11 *info)
 
 #ifdef GL_GLES
 
+/* One EGLDisplay per X11 display, remembered.
+ *
+ * EGL says asking twice for the same native display hands back the same
+ * EGLDisplay, so caching changes nothing about what we return. It changes what
+ * we ask for: with libglvnd 1.7 in the way, asking again for a display that is
+ * already initialised loses the EGL_DEVICE_EXT attribute on it - the query
+ * still reports success but hands back a NULL device from then on. We ask
+ * twice as a matter of course, once from eng_best_visual_get() and once per
+ * window from eng_window_new(), which was enough to make
+ * evasglQueryDrmDevice() unable to name the GPU it renders on. */
+typedef struct _X11_Egl_Display
+{
+   Display   *x11_display;
+   EGLDisplay egldisp;
+} X11_Egl_Display;
+
+static Eina_List *_x11_egl_displays = NULL;
+
 static EGLDisplay *
 _x11_eglGetDisplay(Display *x11_display)
 {
    EGLDisplay (*eglsym_eglGetPlatformDisplay)
          (EGLenum platform, void *native_display, const EGLAttrib *attrib_list) = NULL;
    EGLDisplay *egldisp = EGL_NO_DISPLAY;
+   X11_Egl_Display *xed;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(_x11_egl_displays, l, xed)
+     if (xed->x11_display == x11_display) return xed->egldisp;
 
    eglsym_eglGetPlatformDisplay = dlsym(RTLD_DEFAULT, "eglGetPlatformDisplay");
    if (eglsym_eglGetPlatformDisplay)
+     egldisp = eglsym_eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
+                                            (EGLNativeDisplayType) x11_display, NULL);
+   if (!egldisp)
+     egldisp = eglGetDisplay((EGLNativeDisplayType) x11_display);
+   if (!egldisp) return EGL_NO_DISPLAY;
+
+   xed = calloc(1, sizeof(*xed));
+   if (xed)
      {
-        egldisp = eglsym_eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
-                                               (EGLNativeDisplayType) x11_display, NULL);
-        if (egldisp) return egldisp;
+        xed->x11_display = x11_display;
+        xed->egldisp = egldisp;
+        _x11_egl_displays = eina_list_append(_x11_egl_displays, xed);
      }
 
-   return eglGetDisplay((EGLNativeDisplayType) x11_display);
+   return egldisp;
 }
 
 #endif

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

Reply via email to