diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2020-10-08 14:56:37 -0400 |
---|---|---|
committer | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2021-03-15 11:18:59 -0400 |
commit | e93ca92d4ae7ef414f7b18d5772b55b180e6b59a (patch) | |
tree | 3935a6f8cbbc66cf2661e578b051e363fb316f97 | |
parent | bbfeebabfdfe14c1945b4c93aa114c207b1dd96c (diff) |
zink: force explicit fence only on first frame flush
we have implicit sync hooked up for drivers now so we don't need to worry
about drawing over our frontbuffer unexpectedly
still a weird issue remaining where we miss the first frame without an explicit
fence, but I expect that will get resolved eventually by wsi
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
-rw-r--r-- | src/gallium/drivers/zink/zink_context.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_context.h | 1 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index eed7d06766a..6562db4eade 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1638,18 +1638,18 @@ zink_flush(struct pipe_context *pctx, zink_fence_reference(zink_screen(pctx->screen), (struct zink_fence **)pfence, batch->fence); - /* HACK: - * For some strange reason, we need to finish before presenting, or else - * we start rendering on top of the back-buffer for the next frame. This - * seems like a bug in the DRI-driver to me, because we really should - * be properly protected by fences here, and the back-buffer should - * either be swapped with the front-buffer, or blitted from. But for - * some strange reason, neither of these things happen. - */ - if (flags & PIPE_FLUSH_END_OF_FRAME) - pctx->screen->fence_finish(pctx->screen, pctx, - (struct pipe_fence_handle *)batch->fence, - PIPE_TIMEOUT_INFINITE); + + if (flags & PIPE_FLUSH_END_OF_FRAME) { + /* if the first frame has not yet occurred, we need an explicit fence here + * in some cases in order to correctly draw the first frame, though it's + * unknown at this time why this is the case + */ + if (!ctx->first_frame_done) + pctx->screen->fence_finish(pctx->screen, pctx, + (struct pipe_fence_handle *)batch->fence, + PIPE_TIMEOUT_INFINITE); + ctx->first_frame_done = true; + } } void diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 5db1b421f5c..d4d770f1581 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -214,6 +214,7 @@ struct zink_context { struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_OUTPUTS]; bool dirty_so_targets; bool xfb_barrier; + bool first_frame_done; }; static inline struct zink_context * |