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 00fb94aef2428dee0548aa0c8459e187055cb6a1
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 29 18:30:07 2026 -0600

    evas:gl: hand Evas GL the canvas output, not the engine context
    
    The engine data callback that libevas gives to Evas GL ends up in the
    engine's display_get(), which takes an output. Since outputs and engine
    contexts were split, after 55e1b3f205 started handing over the engine
    context while they were still the same thing, it returns the wrong
    struct, and display_get() reads a display out of it that is not one.
    
    Evas GL only falls back on this callback when no Evas GL context is
    current, so it goes unnoticed while an application keeps its own
    context current. Once it lets go of it, for instance with
    evas_gl_make_current(evas_gl, NULL, NULL), evasglQueryDmaBufFormats()
    and evasglQueryDmaBufModifiers() fail, as does anything else that looks
    up the display of an Evas_GL that way.
    
    The test asks for the dmabuf formats with the context current and then
    without it, and expects the same answer. It needs a GL display that
    imports dmabufs, and skips without one.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/evas/canvas/evas_gl.c     |  9 +++++++-
 src/tests/evas/evas_test_evasgl.c | 44 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_gl.c b/src/lib/evas/canvas/evas_gl.c
index db4066a0e6..cb78ecd2b8 100644
--- a/src/lib/evas/canvas/evas_gl.c
+++ b/src/lib/evas/canvas/evas_gl.c
@@ -358,15 +358,22 @@ evas_gl_native_context_get(void *context)
    return ctx->data;
 }
 
+/* Despite the name, Evas GL wants an output here: what it gets is handed to
+ * the engine's display_get() and the other EVGL_Interface functions, which
+ * all take one. */
 static void *
 evas_gl_engine_data_get(void *evgl)
 {
    Evas_GL *evasgl = evgl;
+   Efl_Canvas_Output *output;
+   Eina_List *l;
 
    if (!evasgl) return NULL;
    if (!evasgl->evas) return NULL;
 
-   return _evas_engine_context(evasgl->evas);
+   EINA_LIST_FOREACH(evasgl->evas->outputs, l, output)
+     if (output->output) return output->output;
+   return NULL;
 }
 
 EVAS_API Evas_GL_Context *
diff --git a/src/tests/evas/evas_test_evasgl.c b/src/tests/evas/evas_test_evasgl.c
index 39635efb4e..8e04a74721 100644
--- a/src/tests/evas/evas_test_evasgl.c
+++ b/src/tests/evas/evas_test_evasgl.c
@@ -478,6 +478,47 @@ _test_evasgl_formats(const char *engine)
    END_EVASGL_TEST();
 }
 
+static void
+_test_evasgl_dmabuf_formats(const char *engine)
+{
+   /* the formats a display imports do not depend on what is current */
+
+   START_EVASGL_TEST(engine, NULL);
+   Evas_GL_Context *ctx;
+   Evas_GL_Surface *sfc;
+   Evas_GL_Config *cfg;
+   Evas_GL_API *gl;
+   Evas_GL *evgl;
+   int formats[256], count = 0, again;
+
+   fail_if(!(evgl = evas_gl_new(evas)));
+   fail_if(!(cfg = evas_gl_config_new()));
+   fail_if(!(sfc = evas_gl_surface_create(evgl, cfg, 1, 1)));
+   fail_if(!(ctx = evas_gl_context_create(evgl, NULL)));
+   fail_if(!evas_gl_make_current(evgl, sfc, ctx));
+   fail_if(!(gl = evas_gl_context_api_get(evgl, ctx)));
+
+   if (!gl->evasglQueryDmaBufFormats ||
+       !gl->evasglQueryDmaBufFormats(evgl, 256, formats, &count) || !count)
+     {
+        printf("No dmabuf import on this display. Skipping.\n");
+        goto end;
+     }
+
+   fail_if(!evas_gl_make_current(evgl, NULL, NULL));
+   again = 0;
+   fail_if(!gl->evasglQueryDmaBufFormats(evgl, 256, formats, &again));
+   fail_if(again != count);
+
+end:
+   fail_if(!evas_gl_make_current(evgl, NULL, NULL));
+   evas_gl_context_destroy(evgl, ctx);
+   evas_gl_surface_destroy(evgl, sfc);
+   evas_gl_config_free(cfg);
+   evas_gl_free(evgl);
+   END_EVASGL_TEST();
+}
+
 #define TEST_ADD_OPT(name, opt) \
    EFL_START_TEST(evas ## name ## _opengl_x11) \
    { name("opengl_x11"); } \
@@ -495,6 +536,7 @@ TEST_ADD(_test_evasgl_glreadpixels)
 TEST_ADD(_test_evasgl_fbo)
 TEST_ADD(_test_evasgl_formats)
 TEST_ADD(_test_evasgl_pbuffer)
+TEST_ADD(_test_evasgl_dmabuf_formats)
 
 /* APIs still to test:
  *
@@ -522,6 +564,7 @@ void evas_test_evasgl(TCase *tc)
         TEST_ADD(_test_evasgl_fbo);
         TEST_ADD(_test_evasgl_pbuffer);
         TEST_ADD(_test_evasgl_formats);
+        TEST_ADD(_test_evasgl_dmabuf_formats);
      }
 
 #undef TEST_ADD
@@ -535,4 +578,5 @@ void evas_test_evasgl(TCase *tc)
    TEST_ADD(_test_evasgl_fbo);
    TEST_ADD(_test_evasgl_pbuffer);
    TEST_ADD(_test_evasgl_formats);
+   TEST_ADD(_test_evasgl_dmabuf_formats);
 }

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

Reply via email to