summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-03-16 15:21:16 -0400
committerMarge Bot <eric+marge@anholt.net>2021-04-01 13:25:51 +0000
commit2d38fb7e612713b5ca485a27fcd5a18e84d7deac (patch)
treef49fe5ea4a2f61a672ec535284c94409162a31a8 /src
parenta4e34f40a3053bf7570eed26efd55d31a10041e6 (diff)
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@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9963>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/zink/zink_fence.c17
1 files 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 */