From 8afb4d8bf08c54ddb7f531ff6a253a2a88470ab1 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 19 Jul 2021 19:04:38 +0200 Subject: buffer: re-use wlr_shm_client_buffer The first time wlr_buffer_from_resource is called with a wl_buffer resource that originates from wl_shm, create a new wlr_shm_client_buffer as usual. If wlr_buffer_from_resource is called multiple times, re-use the existing wlr_shm_client_buffer. This commit changes how the wlr_shm_client_buffer lifetime is managed: previously it was destroyed as soon as the wlr_buffer was released. With this commit it's destroyed when the wl_buffer resource is. Apart from de-duplicating wlr_shm_client_buffer creations, this allows to easily track when a wlr_shm_client_buffer is re-used. This is useful for the renderer and the backends, e.g. the Pixman renderer can keep using the same Pixman image if the buffer is re-used. In the future, this will also allow to re-use resources in the Wayland and X11 backends (remote wl_buffer objects for Wayland, pixmaps for X11). --- include/types/wlr_buffer.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/types/wlr_buffer.h b/include/types/wlr_buffer.h index 896109fd..4817e23f 100644 --- a/include/types/wlr_buffer.h +++ b/include/types/wlr_buffer.h @@ -22,9 +22,6 @@ struct wlr_shm_client_buffer { struct wl_listener release; }; -struct wlr_shm_client_buffer *shm_client_buffer_create( - struct wl_resource *resource); - /** * A read-only buffer that holds a data pointer. * -- cgit v1.2.3