window: implement shm triple-buffering
authorPekka Paalanen <ppaalanen@gmail.com>
Thu, 25 Apr 2013 10:57:47 +0000 (13:57 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 10 May 2013 18:35:53 +0000 (14:35 -0400)
commitaef0254dd58bcfd4310f5e3986c3485f32d48284
tree9565062ade8239dc68fa3a6e40e713af50c0eefc
parentb836664c4249d496416f7c8a99dac03d04a3cf77
window: implement shm triple-buffering

Increase the maximum number of shm "leaves" to three, and rewrite the
leaf release and pick algorithms. The new algorithms hopefully improve
on buffer re-use while freeing unused buffers.

The goal of the new release algorithm is to always leave one free leaf
with storage allocated, so that the next redraw could start straight on
it.

The new leaf picking algorithm will prefer a free leaf that already has
some storage allocated, instead of just picking the first free leaf that
may need to allocate a new buffer.

Triple-buffering is especially for sub-surfaces, where the compositor
may have one wl_buffer busy on screen, and another wl_buffer busy in the
sub-surface cached state due to the synchronized commit mode. To be
able to forcibly repaint at that situation for e.g. resize, we need a
third buffer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
clients/window.c