Mesa (master): zink: handle expired deferred fences more reasonably
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 1 13:33:53 UTC 2021
Module: Mesa
Branch: master
Commit: 2d38fb7e612713b5ca485a27fcd5a18e84d7deac
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d38fb7e612713b5ca485a27fcd5a18e84d7deac
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Mar 16 15:21:16 2021 -0400
zink: handle expired deferred fences more reasonably
now that there's some tracking for the last-finished batch id, this can
be used to detect when an application holds onto a sync object for way too long,
to the point that the sync object has expired so far into the past that we
no longer have any record of it existing
fixes things like unigine superposition
Acked-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9963>
---
src/gallium/drivers/zink/zink_fence.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c
index 515edf456e0..d54dc5b13cd 100644
--- a/src/gallium/drivers/zink/zink_fence.c
+++ b/src/gallium/drivers/zink/zink_fence.c
@@ -168,12 +168,17 @@ zink_fence_finish(struct zink_screen *screen, struct pipe_context *pctx, struct
pctx = threaded_context_unwrap_sync(pctx);
struct zink_context *ctx = zink_context(pctx);
- if (pctx && mfence->deferred_ctx == pctx && mfence->deferred_id == ctx->curr_batch) {
- zink_context(pctx)->batch.has_work = true;
- /* this must be the current batch */
- pctx->flush(pctx, NULL, !timeout_ns ? PIPE_FLUSH_ASYNC : 0);
- if (!timeout_ns)
- return false;
+ if (pctx && mfence->deferred_ctx == pctx) {
+ if (mfence->deferred_id == ctx->curr_batch) {
+ zink_context(pctx)->batch.has_work = true;
+ /* this must be the current batch */
+ pctx->flush(pctx, NULL, !timeout_ns ? PIPE_FLUSH_ASYNC : 0);
+ if (!timeout_ns)
+ return false;
+ }
+ /* this batch is known to have finished */
+ if (mfence->deferred_id <= screen->last_finished)
+ return true;
}
/* need to ensure the tc mfence has been flushed before we wait */
More information about the mesa-commit
mailing list