From 2c23a94be06bbda7489e0c225b60cae1770e0d0f Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 12 Dec 2023 16:47:52 +0100 Subject: [PATCH] tests/wayland-test-clients: Use WaylandBuffer in draw_surcace Most tests use the draw_surface function to draw a solid color to a surface. This moves it from the shm-only path to WaylandBuffer which makes all of those tests usable via dma-buf. Part-of: --- .../wayland-test-client-utils.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.c b/src/tests/wayland-test-clients/wayland-test-client-utils.c index d2c83fcf3..b6a53a4aa 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.c +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.c @@ -543,17 +543,20 @@ draw_surface (WaylandDisplay *display, int height, uint32_t color) { - struct wl_buffer *buffer; - void *buffer_data; - int size; + WaylandBuffer *buffer; - if (!create_shm_buffer (display, width, height, - &buffer, &buffer_data, &size)) - g_error ("Failed to create shm buffer"); + buffer = wayland_buffer_create (display, NULL, + width, height, + DRM_FORMAT_ARGB8888, + NULL, 0, + GBM_BO_USE_LINEAR); - fill (buffer_data, width, height, color); + if (!buffer) + g_error ("Failed to create buffer"); - wl_surface_attach (surface, buffer, 0, 0); + wayland_buffer_fill_color (buffer, color); + + wl_surface_attach (surface, wayland_buffer_get_wl_buffer (buffer), 0, 0); } static void