Mesa (staging/21.1): zink: when performing an implicit reset, sync qbos
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Apr 25 11:35:14 UTC 2021
Module: Mesa
Branch: staging/21.1
Commit: 7bfe17d4e64003d8a20fc17897f232f1da3e8b90
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7bfe17d4e64003d8a20fc17897f232f1da3e8b90
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Apr 15 15:13:02 2021 -0400
zink: when performing an implicit reset, sync qbos
resetting a query pool+qbo dumpsters the existing qbo results,
so these need to be copied to the new qbo if they exist, and then the query
id needs to be updated to match the expected result offset so everything
keeps working as expected
Fixes: 00fc85a0119 ("zink: reset queries when suspending if >50% of total pool is used")
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10268>
(cherry picked from commit 79790e276f61f23217badd80c51add755dfe18ac)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_query.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index d68973a74db..cf56e3e14e1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -382,7 +382,7 @@
"description": "zink: when performing an implicit reset, sync qbos",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "00fc85a01194e9fc150d4a0ec80826f2f16504ee"
},
diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index a0dfc75a6f4..d696da64e74 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -177,6 +177,23 @@ is_bool_query(struct zink_query *query)
query->type == PIPE_QUERY_GPU_FINISHED;
}
+static void
+qbo_sync_from_prev(struct zink_context *ctx, struct zink_query *query, unsigned id_offset, unsigned last_start)
+{
+ assert(id_offset);
+
+ struct zink_query_buffer *prev = list_last_entry(&query->buffers, struct zink_query_buffer, list);
+ unsigned result_size = get_num_results(query->type) * sizeof(uint64_t);
+ bool is_timestamp = query->type == PIPE_QUERY_TIMESTAMP || query->type == PIPE_QUERY_TIMESTAMP_DISJOINT;
+ /* this is get_buffer_offset() but without the zink_query object */
+ unsigned qbo_offset = is_timestamp ? 0 : zink_resource(prev->buffer)->obj->offset + last_start * get_num_results(query->type) * sizeof(uint64_t);
+ query->curr_query = id_offset;
+ query->curr_qbo->num_results = id_offset;
+ zink_copy_buffer(ctx, NULL, zink_resource(query->curr_qbo->buffer), zink_resource(prev->buffer), 0,
+ qbo_offset,
+ id_offset * result_size);
+}
+
static bool
qbo_append(struct pipe_screen *screen, struct zink_query *query)
{
@@ -542,6 +559,8 @@ copy_results_to_buffer(struct zink_context *ctx, struct zink_query *query, struc
static void
reset_pool(struct zink_context *ctx, struct zink_batch *batch, struct zink_query *q)
{
+ unsigned last_start = q->last_start;
+ unsigned id_offset = q->curr_query - q->last_start;
/* This command must only be called outside of a render pass instance
*
* - vkCmdResetQueryPool spec
@@ -568,6 +587,8 @@ reset_pool(struct zink_context *ctx, struct zink_batch *batch, struct zink_query
else
debug_printf("zink: qbo alloc failed on reset!");
}
+ if (id_offset)
+ qbo_sync_from_prev(ctx, q, id_offset, last_start);
}
static inline unsigned
More information about the mesa-commit
mailing list