wl_surface::attach(NULL) release previous buffer?
Pekka Paalanen
ppaalanen at gmail.com
Mon Sep 25 07:55:51 UTC 2023
On Fri, 22 Sep 2023 15:47:13 +0100
John Cox <jc at kynesim.co.uk> wrote:
> 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?
Not re-using, but simply for needing the old surface contents for
longer than the client would expect.
Window closing animations are a good example of that: if the window is
unmapped (e.g. removing the contents by committing a NULL wl_buffer is
a way to unmap a surface, if the surface role allows it), instead of
removing the window from screen in the very next refresh, the
compositor may start an animation instead where it needs the last known
contents of the surface. The window might fade out, shrink and
disappear, or fly away, whatever. The compositor needs the last
contents to be able to draw that animation over time.
From client perspective there is no difference on the wl_surface
though, the window is unmapped immediately when the compositor
processes the unmapping request. The client does not know about any
closing animation, it only sees the buffer release taking a relatively
long time. During the closing animation, the compositor won't send
input on the wl_surface etc. because from the client perspective it was
already unmapped. What's being animated is just a ghost of a window.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20230925/bff672df/attachment.sig>
More information about the wayland-devel
mailing list