From 1d3e62c67f07a180fca02a6df1cf9648f2b50349 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Sun, 12 Mar 2023 16:48:58 -0400 Subject: Stop pooling background surface buffers The wl_buffers for the background surface only need to be updated when the output dimensions change. Using the fixed pool of two buffers to cache these buffers does not help, since if a new buffer is needed, it will have a different size than whatever buffers were cached. Furthermore, because the pool has fixed size, it is possible to run out of buffers if configure events arrive faster than pool buffers are marked not busy, which can lead to protocol errors when the background surface is committed after acknowledging a new size, but without attaching a buffer that matches that size. --- include/swaylock.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/swaylock.h') diff --git a/include/swaylock.h b/include/swaylock.h index 9de8ab6..bb71c8c 100644 --- a/include/swaylock.h +++ b/include/swaylock.h @@ -98,11 +98,10 @@ struct swaylock_surface { struct swaylock_state *state; struct wl_output *output; uint32_t output_global_name; - struct wl_surface *surface; - struct wl_surface *child; // surface made into subsurface + struct wl_surface *surface; // surface for background + struct wl_surface *child; // indicator surface made into subsurface struct wl_subsurface *subsurface; struct ext_session_lock_surface_v1 *ext_session_lock_surface_v1; - struct pool_buffer buffers[2]; struct pool_buffer indicator_buffers[2]; bool frame_pending, dirty; uint32_t width, height; @@ -110,6 +109,8 @@ struct swaylock_surface { enum wl_output_subpixel subpixel; char *output_name; struct wl_list link; + // Dimensions of last wl_buffer committed to background surface + int last_buffer_width, last_buffer_height; }; // There is exactly one swaylock_image for each -i argument -- cgit v1.2.3