From 6f4da83b3613a9a5248183026cf98615369cde4d Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 12 Dec 2023 16:48:36 +0100 Subject: [PATCH] tests/wayland-test-clients: Remove unused create_shm_buffer We moved the last user of `create_shm_buffer` and can now get rid of it. Part-of: --- .../wayland-test-client-utils.c | 77 ------------------- .../wayland-test-client-utils.h | 7 -- 2 files changed, 84 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 b6a53a4aa..7c36fa5cb 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.c +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.c @@ -459,83 +459,6 @@ wayland_display_init (WaylandDisplay *display) { } -static void -handle_buffer_release (void *data, - struct wl_buffer *buffer) -{ - wl_buffer_destroy (buffer); -} - -static const struct wl_buffer_listener buffer_listener = { - handle_buffer_release -}; - -gboolean -create_shm_buffer (WaylandDisplay *display, - int width, - int height, - struct wl_buffer **out_buffer, - void **out_data, - int *out_size) -{ - struct wl_shm_pool *pool; - static struct wl_buffer *buffer; - int fd, size, stride; - int bytes_per_pixel; - void *data; - - bytes_per_pixel = 4; - stride = width * bytes_per_pixel; - size = stride * height; - - fd = create_anonymous_file (size); - if (fd < 0) - { - fprintf (stderr, "Creating a buffer file for %d B failed: %m\n", - size); - return FALSE; - } - - data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (data == MAP_FAILED) - { - fprintf (stderr, "mmap failed: %m\n"); - close (fd); - return FALSE; - } - - pool = wl_shm_create_pool (display->shm, fd, size); - buffer = wl_shm_pool_create_buffer (pool, 0, - width, height, - stride, - WL_SHM_FORMAT_ARGB8888); - wl_buffer_add_listener (buffer, &buffer_listener, buffer); - wl_shm_pool_destroy (pool); - close (fd); - - *out_buffer = buffer; - *out_data = data; - *out_size = size; - - return TRUE; -} - -static void -fill (void *buffer_data, - int width, - int height, - uint32_t color) -{ - uint32_t *pixels = buffer_data; - int x, y; - - for (y = 0; y < height; y++) - { - for (x = 0; x < width; x++) - pixels[y * width + x] = color; - } -} - void draw_surface (WaylandDisplay *display, struct wl_surface *surface, diff --git a/src/tests/wayland-test-clients/wayland-test-client-utils.h b/src/tests/wayland-test-clients/wayland-test-client-utils.h index f42726d56..9bec78bac 100644 --- a/src/tests/wayland-test-clients/wayland-test-client-utils.h +++ b/src/tests/wayland-test-clients/wayland-test-client-utils.h @@ -99,13 +99,6 @@ WaylandSurface * wayland_surface_new (WaylandDisplay *display, int default_height, uint32_t color); -gboolean create_shm_buffer (WaylandDisplay *display, - int width, - int height, - struct wl_buffer **out_buffer, - void **out_data, - int *out_size); - void draw_surface (WaylandDisplay *display, struct wl_surface *surface, int width,