compositor: add early wl_buffer.release
authorPekka Paalanen <ppaalanen@gmail.com>
Tue, 4 Dec 2012 13:58:14 +0000 (15:58 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 6 Dec 2012 21:55:41 +0000 (16:55 -0500)
commitccfeae2ad7e024c04676fff0563a34fe04edb301
tree702af18ab4b4eba75b5d8666305e34547517313d
parentfb003d3457a7a39ed17d96373974295932363c13
compositor: add early wl_buffer.release

A client can reliably avoid allocating a second buffer per surface, if
the compositor sends the wl_buffer.release event before the frame
callback. To enable clients' single-buffering, release the wl_buffer
early if possible. Otherwise clients will double-buffer.

Releasing early is not possible, if the backend needs the buffer for
migrating a surface to or from a non-primary weston_plane. In that case,
a new buffer must arrive, before the old can be released. Backends will
indicate this by setting weston_surface:keep_buffer to 1 in
assign_planes().

A proper buffer reference in the backends would be better than the
keep_buffer flag, but that would require a per-surface backend private.

The rpi and DRM backends are updated to set keep_buffer, other backends
do not support planes, so do not have to set it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/compositor-drm.c
src/compositor-rpi.c
src/compositor.c
src/compositor.h