gallium/xlib: call fence_finish() in XMesaSwapBuffers()

Before we can present the buffer we need to wait for the fence to
finish.  This fixes severe flickering of unfinished rendering in
many demos/tests.  This has been broken for a while, I think.

Note, this is for the non-DRI / Xlib-based GLX.

Signed-off-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21993>
This commit is contained in:
Brian Paul 2023-03-17 14:23:29 -06:00 committed by Marge Bot
parent bbde684ca0
commit 5e039dbf8e

View File

@ -1343,7 +1343,16 @@ void XMesaSwapBuffers( XMesaBuffer b )
}
if (xmctx && xmctx->xm_buffer == b) {
st_context_flush(xmctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
struct pipe_fence_handle *fence = NULL;
st_context_flush(xmctx->st, ST_FLUSH_FRONT, &fence, NULL, NULL);
/* Wait until all rendering is complete */
if (fence) {
XMesaDisplay xmdpy = xmesa_init_display(b->xm_visual->display);
struct pipe_screen *screen = xmdpy->screen;
xmdpy->screen->fence_finish(screen, NULL, fence,
PIPE_TIMEOUT_INFINITE);
xmdpy->screen->fence_reference(screen, &fence, NULL);
}
}
xmesa_swap_st_framebuffer(b->drawable);