loader/dri3: Only allocate additional buffers if needed
authorMichel Dänzer <mdaenzer@redhat.com>
Fri, 2 Oct 2020 13:20:17 +0000 (15:20 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 22 Oct 2020 15:52:33 +0000 (15:52 +0000)
commit60585fc4e34858aa277286209f3cf61e83770181
tree2f628756ab317eeba0b10d5dbd304150440d1532
parentea326912575fad09af59486ad62d126c4ea0ede7
loader/dri3: Only allocate additional buffers if needed

Previously, we would always allocate 3 buffers for page flipping. But 2
buffers can suffice for clients which always wait for buffer swaps to
complete before starting a new frame.

Therefore, keep track of the maximum number of buffers separately from
the current number, and only bump the latter if both current buffers are
busy.

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
src/loader/loader_dri3_helper.h