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

git pushed a commit to branch wl/dmabuf-import
in repository enlightenment.

View the commit online.

commit d32a0a98f40bbaeb10dd4e339392a498964f5efb
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 29 21:08:55 2026 -0600

    tests - fail the GL dmabuf tests when only E refuses dmabuf
    
    The dmabuf tests skipped whenever E did not advertise
    zwp_linux_dmabuf_v1, which is also what E not offering it by mistake
    looks like: with the nested backend's dmabuf switched back off, both
    tests skipped and meson reported nothing wrong.
    
    run-gl.sh nests E in a Weston that draws with GL on the same GPU and
    Mesa, so Weston is a fair witness to whether import can work here. The
    tests now ask it, and fail when it offers dmabuf and E does not. They
    still skip when neither does.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/tests/wayland/e_wl_dmabufkit.h    | 56 +++++++++++++++++++++++++++++++++++
 src/tests/wayland/run-gl.sh           |  1 +
 src/tests/wayland/test_dmabuf_alpha.c |  6 +---
 src/tests/wayland/test_dmabuf_reuse.c |  6 +---
 4 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/src/tests/wayland/e_wl_dmabufkit.h b/src/tests/wayland/e_wl_dmabufkit.h
index 368e9f25d..50a01c3b3 100644
--- a/src/tests/wayland/e_wl_dmabufkit.h
+++ b/src/tests/wayland/e_wl_dmabufkit.h
@@ -6,6 +6,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 #include <gbm.h>
@@ -83,6 +84,61 @@ _dmabuf_wait(Ctx *ctx)
    return 0;
 }
 
+static void
+_host_global(void *data, struct wl_registry *registry __attribute__((unused)),
+             uint32_t name __attribute__((unused)), const char *iface,
+             uint32_t version __attribute__((unused)))
+{
+   int *offered = data;
+
+   if (!strcmp(iface, "zwp_linux_dmabuf_v1")) *offered = 1;
+}
+
+static void
+_host_global_remove(void *data __attribute__((unused)),
+                    struct wl_registry *registry __attribute__((unused)),
+                    uint32_t name __attribute__((unused)))
+{
+}
+
+static const struct wl_registry_listener _host_registry_listener =
+{
+   _host_global, _host_global_remove
+};
+
+/* Does the Weston that run-gl.sh nests E in offer dmabuf? It draws with GL on
+ * the same GPU and Mesa as E, so if it can import a dmabuf, E can too, and E
+ * not offering one is a failure rather than a reason to skip. */
+static inline int
+_host_offers_dmabuf(void)
+{
+   const char *host = getenv("E_TEST_GL_HOST");
+   struct wl_registry *registry;
+   struct wl_display *display;
+   int offered = 0;
+
+   if (!host) return 0;
+   display = wl_display_connect(host);
+   if (!display) return 0;
+   registry = wl_display_get_registry(display);
+   wl_registry_add_listener(registry, &_host_registry_listener, &offered);
+   wl_display_roundtrip(display);
+   wl_registry_destroy(registry);
+   wl_display_disconnect(display);
+   return offered;
+}
+
+/* Skips, exiting 77, when nothing on this machine can import a dmabuf. */
+static inline void
+_dmabuf_require(Ctx *ctx, const char *prog)
+{
+   if (_dmabuf_wait(ctx)) return;
+   if (_host_offers_dmabuf())
+     tk_fail(ctx->tk, "E does not offer zwp_linux_dmabuf_v1, its host does");
+   printf("%s: skipped, nothing here offers zwp_linux_dmabuf_v1\n", prog);
+   exit(77);
+}
+
 static inline struct gbm_device *
 _gbm_open(void)
 {
diff --git a/src/tests/wayland/run-gl.sh b/src/tests/wayland/run-gl.sh
index 2624fcf51..1f210c65b 100755
--- a/src/tests/wayland/run-gl.sh
+++ b/src/tests/wayland/run-gl.sh
@@ -52,4 +52,5 @@ if [ ! -S "$HOST/host" ] || ! grep -q 'Using GL renderer' "$HOST/weston.log"; th
 fi
 
 E_TEST_BACKEND=wl E_COMP_ENGINE=gl WAYLAND_DISPLAY="$HOST/host" \
+    E_TEST_GL_HOST="$HOST/host" \
     sh "$(dirname "$0")/run-nested.sh" "$@"
diff --git a/src/tests/wayland/test_dmabuf_alpha.c b/src/tests/wayland/test_dmabuf_alpha.c
index ea4713eab..a77a9b221 100644
--- a/src/tests/wayland/test_dmabuf_alpha.c
+++ b/src/tests/wayland/test_dmabuf_alpha.c
@@ -55,11 +55,7 @@ main(void)
    if (!ctx.tester) tk_fail(ctx.tk, "no wl_test version 9");
    wl_test_add_listener(ctx.tester, &_tester_listener, &ctx);
 
-   if (!_dmabuf_wait(&ctx))
-     {
-        printf(PROG ": skipped, E does not offer zwp_linux_dmabuf_v1\n");
-        return 77;
-     }
+   _dmabuf_require(&ctx, PROG);
    gbm = _gbm_open();
    if (!gbm)
      {
diff --git a/src/tests/wayland/test_dmabuf_reuse.c b/src/tests/wayland/test_dmabuf_reuse.c
index 0b7909904..fa2c47b37 100644
--- a/src/tests/wayland/test_dmabuf_reuse.c
+++ b/src/tests/wayland/test_dmabuf_reuse.c
@@ -60,11 +60,7 @@ main(void)
    if (!ctx.tester) tk_fail(ctx.tk, "no wl_test version 9");
    wl_test_add_listener(ctx.tester, &_tester_listener, &ctx);
 
-   if (!_dmabuf_wait(&ctx))
-     {
-        printf(PROG ": skipped, E does not offer zwp_linux_dmabuf_v1\n");
-        return 77;
-     }
+   _dmabuf_require(&ctx, PROG);
    gbm = _gbm_open();
    if (!gbm)
      {

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

Reply via email to