wl_surface::attach(NULL) release previous buffer?

Vlad Zahorodnii vlad.zahorodnii at kde.org
Thu Sep 14 11:30:00 UTC 2023


On 9/14/23 14:24, John Cox wrote:

> Hi
>
> A, hopefully, simple question - should I expect a wl_buffer::release
> event from the buffer previously committed to a surface after I've
> attached (and invalidated & committed) a NULL buffer to the surface? it
> doesn't seem to happen for me (I have WAYLAND_DEBUG=1 logs showing it
> not happening).
>
> If I shouldn't expect a release - when is it safe to reuse/free the
> buffer storage?

The compositor may continue using the buffer even if you attach a null 
buffer to the wl_surface. For example, the compositor may do it to play 
an animation if the window is unmapped.

It is safe to reuse the buffer when you receive wl_buffer.release event 
from the compositor.

Regards,
Vlad



More information about the wayland-devel mailing list