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