Mesa (main): zink: set VK_QUERY_RESULT_WAIT_BIT when copying to qbo

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 00:13:25 UTC 2022


Module: Mesa
Branch: main
Commit: 373c8001d6615d70d112c7526ea4f4953257b6b9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=373c8001d6615d70d112c7526ea4f4953257b6b9

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Apr 19 16:01:35 2022 -0400

zink: set VK_QUERY_RESULT_WAIT_BIT when copying to qbo

according to spec, this ensures that drivers will accurately
return results relative to when the query was ended

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16049>

---

 src/gallium/drivers/zink/zink_query.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index 1b0c3501c27..07727062cf8 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -768,7 +768,17 @@ update_qbo(struct zink_context *ctx, struct zink_query *q)
       copy_pool_results_to_buffer(ctx, q, start->vkq[i]->pool->query_pool, start->vkq[i]->query_id,
                                   zink_resource(qbo->buffers[i]),
                                   offset,
-                                  1, VK_QUERY_RESULT_64_BIT);
+                                  1,
+                                  /*
+                                     there is an implicit execution dependency from
+                                     each such query command to all query commands previously submitted to the same queue. There
+                                     is one significant exception to this; if the flags parameter of vkCmdCopyQueryPoolResults does not
+                                     include VK_QUERY_RESULT_WAIT_BIT, execution of vkCmdCopyQueryPoolResults may happen-before
+                                     the results of vkCmdEndQuery are available.
+
+                                   * - Chapter 18. Queries
+                                   */
+                                  VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
    }
 
    if (!is_timestamp)
@@ -1227,6 +1237,16 @@ zink_get_query_result_resource(struct pipe_context *pctx,
       return;
    }
 
+   /*
+      there is an implicit execution dependency from
+      each such query command to all query commands previously submitted to the same queue. There
+      is one significant exception to this; if the flags parameter of vkCmdCopyQueryPoolResults does not
+      include VK_QUERY_RESULT_WAIT_BIT, execution of vkCmdCopyQueryPoolResults may happen-before
+      the results of vkCmdEndQuery are available.
+
+    * - Chapter 18. Queries
+    */
+   size_flags |= VK_QUERY_RESULT_WAIT_BIT;
    if (!is_time_query(query) && !is_bool_query(query)) {
       if (num_queries == 1 && query->type != PIPE_QUERY_PRIMITIVES_GENERATED &&
                               query->type != PIPE_QUERY_PRIMITIVES_EMITTED &&



More information about the mesa-commit mailing list