loader/dri3: Allocate up to 4 back buffers for page flips
authorMichel Dänzer <mdaenzer@redhat.com>
Fri, 2 Oct 2020 13:55:05 +0000 (15:55 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 22 Oct 2020 15:52:33 +0000 (15:52 +0000)
commit31e9de9c8ac72399427cb0fc15f19205dd8182c9
tree0dd916d253adfa8466c4bad50c6e1b8139b8a90d
parent16a7cc4d449efa51f9ec2fd47df38a76c12e8e52
loader/dri3: Allocate up to 4 back buffers for page flips

With swap interval 0, i.e. sync-to-vblank disabled.

This can be necessary for unthrottled drawing with Xwayland:

1) One buffer can be scanned out
2) One buffer can be pending in the kernel for a page flip
3) One buffer can be pending in the Wayland compositor

Therefore, with 3 buffers, the frame-rate could be capped much lower
than the throughput the GPU is capable of, in the worst case at the
Wayland compositor refresh rate.

(The native Wayland EGL backend always uses up to 4 buffers)

Leave the maximum number of buffers at 3 for swap interval != 0, it's
sufficient in that case to always be able to queue one frame ahead of
time.

https://gitlab.gnome.org/GNOME/mutter/-/issues/1455
https://gitlab.gnome.org/GNOME/mutter/-/issues/1462

Cc: mesa-stable
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7033>
src/loader/loader_dri3_helper.c