Client: Prune stale buffers in QWaylandShmBackingStore


A backing store may sometimes allocate an extra buffer and keep it even
though the buffer is never touched again.

This change makes the QWaylandShmBackingStore clean up the old buffers
more aggressively.

Specifically,

* if a buffer is referenced by the compositor and has a different size,
  there is no need to wait for the buffer to be released, it can be
  destroyed immediately
* if a buffer has not been used for the past 50 frames, it probably
  won't be used any time soon so it can be disposed

Depending on the compositor implementation details, the
QWaylandShmBackingStore is likely to hold either one or two buffers
now. Note that the backing store can still sometimes have more buffers
because Qt widgets not always use QWindow::requestUpdate().

Change-Id: I57428d457d889dd07c4beb641cf380b1aceb88c2
Reviewed-by: David Edmundson <davidedmundson@kde.org>
commitfeb2707cb11a30776666f1f2b28c269614b7ea44
parent24735372c5fbf0d3c0ca9a3624ad156632dfb244
authorVlad Zahorodnii <vlad.zahorodnii@kde.org>
committerVlad Zahorodnii <vlad.zahorodnii@kde.org>
commit timeWed, 5 Feb 2025 02:34:06 +0200