loader_dri3: Honor the request to preserve back buffer content
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 10 Aug 2017 14:14:23 +0000 (16:14 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 17 Aug 2017 05:39:42 +0000 (07:39 +0200)
commit1e83baeb4b6b6d557ae8b9c219347b1b252b27c7
treeb907be53bf669f565a8dcdc3810d1a6d65f891d3
parentf71e174bb8d01855b56523348e5b8f50a6a5ce78
loader_dri3: Honor the request to preserve back buffer content

EGL uses the force_copy parameter to loader_dri3_swap_buffers_msc() to indicate
that it wants to preserve back buffer contents across a buffer swap.

While the loader then turns off server-side page-flipping there's nothing to
guarantee that a new backbuffer isn't chosen when EGL starts to render again,
and that buffer's content is of course undefined.

So rework the functionality:
If the client supports local blits, allow server-side page flipping and when
a new back is grabbed, if needed, blit the old back's content to the new back.
If the client doesn't support local blits, disallow server-side page-flipping
to avoid a client deadlock and then, when grabbing a new back buffer, sleep
until the old back is idle, which may take a substantial time depending on
swap interval.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/loader/loader_dri3_helper.c
src/loader/loader_dri3_helper.h