wl_surface::attach(NULL) release previous buffer?

John Cox jc at kynesim.co.uk
Fri Sep 22 14:47:13 UTC 2023


Hi

>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.

You've completely lost me with this example.  Are you suggesting that
the compositor is reusing my buffer for its own purposes?

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

Yup I got that (and you also have to wait for dmabuf fences if it is
that sort of buffer).

In the case that I was wondering about it was a compositor bug that kept
the buffer locked when it shouldn't have been.

Thanks

HJC


More information about the wayland-devel mailing list