Introduce wlr_buffer
This PR introduces wlr_buffer
, as discussed in https://github.com/swaywm/wlroots/issues/1046#issuecomment-395679806.
wlr_buffer
s are ref-counted and hold a texture. When they are destroyed, the wl_buffer
is released and the texture is destroyed.
A compositor can reference the buffer when it needs to:
struct wlr_buffer *buffer = wlr_buffer_ref(surface->buffer);
// Use buffer->texture (can be NULL if client destroys the buffer)
wlr_buffer_unref(buffer);
@ammen99 Can you provide some feedback? Would this approach work for you?
-
We probably want to get rid of wlr_surface.texture
-
Listen for renderer destroy
Fixes #1046 (closed)