Mesa (master): zink: handle checking batch completion from other contexts without timelines
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 9 13:40:39 UTC 2021
Module: Mesa
Branch: master
Commit: b7a0265c27ad754ecb4cb4e3a97dbb63ae85b050
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7a0265c27ad754ecb4cb4e3a97dbb63ae85b050
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Apr 8 10:08:00 2021 -0400
zink: handle checking batch completion from other contexts without timelines
if a batch state can't be found, it may exist on a different context, so the screen
value needs to be checked
if the screen value indicates that the batch hasn't completed and we're waiting,
force a flush so there's a fence that can be waited upon
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Tested-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10115>
---
src/gallium/drivers/zink/zink_context.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 68c997debeb..de0f1ea8b8d 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -2067,9 +2067,14 @@ zink_wait_on_batch(struct zink_context *ctx, uint32_t batch_id)
fence = ctx->last_fence;
else {
struct hash_entry *he = _mesa_hash_table_search_pre_hashed(&ctx->batch_states, batch_id, (void*)(uintptr_t)batch_id);
- /* if we can't find it, it must have finished already */
if (!he) {
simple_mtx_unlock(&ctx->batch_mtx);
+ /* if we can't find it, it either must have finished already or is on a different context */
+ if (!zink_screen_check_last_finished(zink_screen(ctx->base.screen), batch_id)) {
+ /* if it hasn't finished, it's on another context, so force a flush so there's something to wait on */
+ ctx->batch.has_work = true;
+ zink_fence_wait(&ctx->base);
+ }
return;
}
fence = he->data;
@@ -2103,10 +2108,11 @@ zink_check_batch_completion(struct zink_context *ctx, uint32_t batch_id)
fence = ctx->last_fence;
else {
struct hash_entry *he = _mesa_hash_table_search_pre_hashed(&ctx->batch_states, batch_id, (void*)(uintptr_t)batch_id);
- /* if we can't find it, it must have finished already */
+ /* if we can't find it, it either must have finished already or is on a different context */
if (!he) {
simple_mtx_unlock(&ctx->batch_mtx);
- return true;
+ /* return compare against last_finished, since this has info from all contexts */
+ return zink_screen_check_last_finished(zink_screen(ctx->base.screen), batch_id);
}
fence = he->data;
}
More information about the mesa-commit
mailing list