Skip to content

egl/wayland: break double/tripple buffering feedback loops

Lucas Stach requested to merge lynxeye/mesa:egl-wayland-feedback-loop into main

Currently we dispose any unneeded color buffers immediately if we detect that there are more unlocked buffers than we need. This can lead to feedback loops between the compositor and the application causing rapid toggling between double and tripple buffering.

Scenario: 2 buffers already queued to the compositor, egl/wayland allocates a new back buffer to avoid throttling, slowing down the frame. This allows the compositor to catch up and unlock both buffers. EGL detects that there are more buffers than currently needed, freeing the buffer, restarting the loop shortly after.

To avoid wasting CPU time on rapidly freeing and reallocating color buffers break those feedback loops by letting the unneeded buffers sit around for a short while before disposing them.

Merge request reports