This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tests/browser-gpu
in repository enlightenment.
View the commit online.
commit e1cf363451e10400231c9ffa7c972caab442f3bc
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Nov 30 22:55:19 2026 -0600
tests - draw a real browser's dmabufs on a GL canvas
The dmabuf tests so far drive E with buffers they make themselves. This
one runs Chromium and Brave on the GPU against E on its GL canvas, nested
in a headless Weston by run-gl.sh, and checks the whole path with a
client nobody here wrote: the formats and feedback E offers, the browser
choosing from them, the import and the draw. The browser's window must
show a dmabuf, and the page's background must come out on the screen in
its own colour.
Telling a dmabuf from shm takes wl_test, so version 13 adds
get_buffer_types: the kinds of buffer attached to a window's surface and
to its subsurfaces, where a browser may put its page. browser-run.sh
keeps the GPU on when E_TEST_BROWSER_GPU=1; the other browser tests stay
on software rendering, which the test canvas cannot import.
With the GPU turned off in browser-run.sh, both tests fail: the
browsers attach shm buffers only. Each passed 20 runs out of 20. Like
the other browser tests, they run only with --suite browser, and skip
when the browser, Weston or a render node is missing. Firefox is left
out for now: it has not been tried on the GPU here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/modules/wl_test/e_mod_main.c | 35 +++++++++-
src/protocol/wl-test.xml | 22 +++++-
src/tests/wayland/browser-run.sh | 9 ++-
src/tests/wayland/meson.build | 26 ++++++++
src/tests/wayland/test_browser_gpu.c | 126 +++++++++++++++++++++++++++++++++++
5 files changed, 213 insertions(+), 5 deletions(-)
diff --git a/src/modules/wl_test/e_mod_main.c b/src/modules/wl_test/e_mod_main.c
index ad360f009..72aba4559 100644
--- a/src/modules/wl_test/e_mod_main.c
+++ b/src/modules/wl_test/e_mod_main.c
@@ -8,6 +8,7 @@
* wire. It is also, for the same reason, coupled to E's internals and will
* need updating when they move. Keep the surface area small.
*/
+#define E_COMP_WL
#include "e.h"
#include "wl-test-server-protocol.h"
@@ -708,6 +709,37 @@ _wl_test_cb_get_format_alpha(struct wl_client *client EINA_UNUSED, struct wl_res
e_pixmap_format_has_alpha(format));
}
+static unsigned int
+_wl_test_buffer_types(E_Client *ec)
+{
+ E_Comp_Wl_Buffer *buffer;
+ unsigned int types = 0;
+ E_Client *sub;
+ Eina_List *l;
+
+ buffer = e_pixmap_resource_get(ec->pixmap);
+ if (buffer)
+ {
+ if (buffer->shm_buffer) types |= WL_TEST_BUFFER_TYPE_SHM;
+ if (buffer->dmabuf_buffer) types |= WL_TEST_BUFFER_TYPE_DMABUF;
+ if (buffer->single_pixel) types |= WL_TEST_BUFFER_TYPE_SINGLE_PIXEL;
+ }
+ if (!ec->comp_data) return types;
+ EINA_LIST_FOREACH(ec->comp_data->sub.list, l, sub)
+ types |= _wl_test_buffer_types(sub);
+ return types;
+}
+
+static void
+_wl_test_cb_get_buffer_types(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id)
+{
+ E_Client *ec;
+
+ ec = _wl_test_client_by_id(resource, id);
+ if (!ec) return;
+ wl_test_send_buffer_types(resource, id, _wl_test_buffer_types(ec));
+}
+
static const struct wl_test_interface _wl_test_implementation =
{
_wl_test_cb_destroy,
@@ -735,6 +767,7 @@ static const struct wl_test_interface _wl_test_implementation =
_wl_test_cb_output_scale_set,
_wl_test_cb_output_remove,
_wl_test_cb_get_format_alpha,
+ _wl_test_cb_get_buffer_types,
};
static void
@@ -768,7 +801,7 @@ e_modapi_init(E_Module *m)
return NULL;
}
- _wl_test_global = wl_global_create(e_comp_wl->wl.disp, &wl_test_interface, 12,
+ _wl_test_global = wl_global_create(e_comp_wl->wl.disp, &wl_test_interface, 13,
NULL, _wl_test_cb_bind);
if (!_wl_test_global)
{
diff --git a/src/protocol/wl-test.xml b/src/protocol/wl-test.xml
index 87e22d7c7..402b2566f 100644
--- a/src/protocol/wl-test.xml
+++ b/src/protocol/wl-test.xml
@@ -23,7 +23,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
- <interface name="wl_test" version="12">
+ <interface name="wl_test" version="13">
<description summary="private interface for the compositor test suite">
A back door into the compositor for its own test suite. It exposes
internal state and synthesises input, so it is only built with
@@ -395,5 +395,25 @@
<arg name="format" type="uint"/>
<arg name="alpha" type="uint" summary="1 if blended, 0 if opaque"/>
</event>
+
+ <enum name="buffer_type" bitfield="true" since="13">
+ <entry name="shm" value="0x1"/>
+ <entry name="dmabuf" value="0x2"/>
+ <entry name="single_pixel" value="0x4"/>
+ </enum>
+
+ <request name="get_buffer_types" since="13">
+ <description summary="ask what kinds of buffer a window shows">
+ Answers with a buffer_types event: the kinds of buffer attached to
+ the window's surface and to its subsurfaces, where a browser may
+ put its page.
+ </description>
+ <arg name="id" type="uint" summary="a window id from client_info"/>
+ </request>
+
+ <event name="buffer_types" since="13">
+ <arg name="id" type="uint"/>
+ <arg name="types" type="uint" enum="buffer_type"/>
+ </event>
</interface>
</protocol>
diff --git a/src/tests/wayland/browser-run.sh b/src/tests/wayland/browser-run.sh
index a4952b095..df8ce6514 100755
--- a/src/tests/wayland/browser-run.sh
+++ b/src/tests/wayland/browser-run.sh
@@ -69,15 +69,18 @@ JS
;;
chromium|brave)
# Software rendering: the test canvas cannot import GPU buffers, and a
- # browser finding that out at startup is slow. E_TEST_BROWSER_FLAGS is for
- # a test that needs a feature turned on.
+ # browser finding that out at startup is slow. E_TEST_BROWSER_GPU=1 is
+ # for a test on a GL canvas, and E_TEST_BROWSER_FLAGS for one that needs
+ # a feature turned on.
+ GPU=--disable-gpu
+ [ "${E_TEST_BROWSER_GPU:-0}" = 1 ] && GPU=
set -- "$BIN" --user-data-dir="$PROFILE" --incognito \
--no-first-run --no-default-browser-check \
--disable-search-engine-choice-screen \
--password-store=basic --use-mock-keychain \
--disable-component-update --disable-background-networking \
--host-resolver-rules="MAP * ~NOTFOUND" \
- --ozone-platform=wayland --disable-gpu ${E_TEST_BROWSER_FLAGS:-} \
+ --ozone-platform=wayland $GPU ${E_TEST_BROWSER_FLAGS:-} \
"$URL"
;;
esac
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index d21613cf0..7bc7009f7 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -214,6 +214,32 @@ foreach b: ['firefox', 'chromium', 'brave']
)
endforeach
+# The same page drawn on the GPU, on a GL canvas: the browser has to hand E
+# dmabufs, and E has to draw them. Needs what run-gl.sh needs as well.
+if dep_gbm.found()
+ test_browser_gpu = executable('test_wl_browser_gpu',
+ ['test_browser_gpu.c', tk_src, test_proto_src],
+ dependencies: [dependency('wayland-client')],
+ )
+ foreach b: ['chromium', 'brave']
+ test('browser-gpu-' + b,
+ find_program('run-gl.sh'),
+ args: [test_browser_gpu, b, 'e-browser-probe', '0x2b6cb0'],
+ env: {
+ 'E_TEST_COMPOSITOR': e_test_compositor,
+ 'E_TEST_APP': ' '.join([browser_run, b,
+ 'file://' + meson.current_source_dir() / 'pages' / 'probe.html']),
+ 'E_TEST_APP_CHECK': ' '.join([browser_run, '--find', b]),
+ 'E_TEST_BROWSER_GPU': '1',
+ 'E_TEST_WAIT_SECONDS': '60',
+ },
+ suite: ['browser', 'gl'],
+ is_parallel: false,
+ timeout: 300,
+ )
+ endforeach
+endif
+
test_browser_text_input = executable('test_wl_browser_text_input',
['test_browser_text_input.c', tk_src, test_proto_src],
dependencies: [dependency('wayland-client')],
diff --git a/src/tests/wayland/test_browser_gpu.c b/src/tests/wayland/test_browser_gpu.c
new file mode 100644
index 000000000..61e889624
--- /dev/null
+++ b/src/tests/wayland/test_browser_gpu.c
@@ -0,0 +1,126 @@
+/* A real browser drawing on the GPU, on E's GL canvas: its page must reach
+ * E as a dmabuf and come out on the screen in its own colour. This is the
+ * whole dmabuf path with a client nobody here wrote: the formats and the
+ * feedback E offers, the browser choosing from them, the import, and the
+ * draw.
+ *
+ * argv[1] part of the browser's app_id
+ * argv[2] the title of the page it was given
+ * argv[3] the page's background, as 0xRRGGBB */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "e_wl_testkit.h"
+
+#define PROG "test-browser-gpu"
+
+typedef struct
+{
+ unsigned int types, argb;
+ int answered;
+} Answer;
+
+static void
+_pixel(void *data, struct wl_test *t __attribute__((unused)),
+ int32_t x __attribute__((unused)), int32_t y __attribute__((unused)),
+ uint32_t argb)
+{
+ Answer *answer = data;
+
+ answer->argb = argb;
+ answer->answered = 1;
+}
+
+static void
+_buffer_types(void *data, struct wl_test *t __attribute__((unused)),
+ uint32_t id __attribute__((unused)), uint32_t types)
+{
+ Answer *answer = data;
+
+ answer->types = types;
+ answer->answered = 1;
+}
+
+/* Only the requests this test sends are answered on its own wl_test. */
+static const struct wl_test_listener _tester_listener =
+{
+ .pixel = _pixel,
+ .buffer_types = _buffer_types
+};
+
+static int
+_titled(const Tk_Client *c, void *data)
+{
+ return !!strstr(c->title, data);
+}
+
+static int
+_wait_seconds(void)
+{
+ const char *s = getenv("E_TEST_WAIT_SECONDS");
+
+ return s ? atoi(s) : TK_WAIT_SECONDS;
+}
+
+int
+main(int argc, char **argv)
+{
+ struct timespec step = { 0, 100000000 };
+ struct wl_test *tester;
+ Answer answer = { 0 };
+ unsigned int id, want;
+ char app_id[256];
+ Tk_Client *c;
+ int i, x, y;
+ Tk *tk;
+
+ if (argc < 4) return 2;
+ want = 0xff000000 | strtoul(argv[3], NULL, 16);
+ tk = tk_connect(PROG);
+ tester = tk_bind(tk, &wl_test_interface, 13);
+ if (!tester) tk_fail(tk, "no wl_test version 13");
+ wl_test_add_listener(tester, &_tester_listener, &answer);
+
+ c = tk_wait_window(tk, argv[1]);
+ id = c->id;
+ snprintf(app_id, sizeof(app_id), "%s", c->app_id);
+ tk_wait(tk, app_id, _titled, argv[2], "the browser to show the page");
+
+ /* A browser may draw its first frames before its GPU process is up. */
+ for (i = 0; i < _wait_seconds() * 10; i++)
+ {
+ answer.answered = 0;
+ wl_test_get_buffer_types(tester, id);
+ tk_sync(tk);
+ if (!answer.answered) tk_fail(tk, "no answer to get_buffer_types");
+ if (answer.types & WL_TEST_BUFFER_TYPE_DMABUF) break;
+ nanosleep(&step, NULL);
+ }
+ if (!(answer.types & WL_TEST_BUFFER_TYPE_DMABUF))
+ tk_fail(tk, "'%s' never showed a dmabuf (buffer types 0x%x)", app_id,
+ answer.types);
+ printf(PROG ": '%s' shows a dmabuf (buffer types 0x%x)\n", app_id,
+ answer.types);
+
+ c = tk_expect(tk, app_id);
+ x = c->x + (c->w / 2);
+ y = c->y + ((c->h * 3) / 4);
+ for (i = 0; i < _wait_seconds() * 10; i++)
+ {
+ answer.answered = 0;
+ wl_test_get_pixel(tester, x, y);
+ tk_sync(tk);
+ if (!answer.answered) tk_fail(tk, "no answer to get_pixel");
+ if (answer.argb == want) break;
+ nanosleep(&step, NULL);
+ }
+ if (answer.argb != want)
+ tk_fail(tk, "the page at %d,%d is %#x, wanted %#x", x, y, answer.argb,
+ want);
+ printf(PROG ": the page is on the screen at %d,%d in %#x\n", x, y, want);
+
+ tk_disconnect(tk);
+ return 0;
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.