Module: Mesa
Branch: master
Commit: 28ad3c1735a07e9c13f78a877d4888dfd8cab508
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=28ad3c1735a07e9c13f78a877d4888dfd8cab508

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Aug 17 10:58:08 2020 -0400

zink: store batch id onto query object at time of start

this is useful for knowing immediately whether a query has results available

for time queries, this ends up being end_query() since that's when the timestamp
is written

Reviewed-by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7195>

---

 src/gallium/drivers/zink/zink_query.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_query.c 
b/src/gallium/drivers/zink/zink_query.c
index bef9c5d04ee..a1a4b805cde 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -37,6 +37,8 @@ struct zink_query {
    bool have_gs[4]; /* geometry shaders use GEOMETRY_SHADER_PRIMITIVES_BIT; 
sized by ctx->batches[] array size */
    bool have_xfb[4]; /* xfb was active during this query; sized by 
ctx->batches[] array size */
 
+   unsigned batch_id : 2; //batch that the query was started in
+
    union pipe_query_result accumulated_result;
 };
 
@@ -353,6 +355,7 @@ begin_query(struct zink_context *ctx, struct zink_batch 
*batch, struct zink_quer
    if (q->type == PIPE_QUERY_PRIMITIVES_GENERATED)
       list_addtail(&q->stats_list, &ctx->primitives_generated_queries);
    p_atomic_inc(&q->fences);
+   q->batch_id = batch->batch_id;
    _mesa_set_add(batch->active_queries, q);
 }
 
@@ -376,10 +379,11 @@ end_query(struct zink_context *ctx, struct zink_batch 
*batch, struct zink_query
 {
    struct zink_screen *screen = zink_screen(ctx->base.screen);
    q->active = q->type == PIPE_QUERY_TIMESTAMP;
-   if (is_time_query(q))
+   if (is_time_query(q)) {
       vkCmdWriteTimestamp(batch->cmdbuf, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
                           q->query_pool, q->curr_query);
-   else if (q->vkqtype == VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT || 
q->type == PIPE_QUERY_PRIMITIVES_GENERATED)
+      q->batch_id = batch->batch_id;
+   } else if (q->vkqtype == VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT || 
q->type == PIPE_QUERY_PRIMITIVES_GENERATED)
       screen->vk_CmdEndQueryIndexedEXT(batch->cmdbuf, q->xfb_query_pool ? 
q->xfb_query_pool : q->query_pool, q->curr_query, q->index);
    if (q->vkqtype != VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT && 
!is_time_query(q))
       vkCmdEndQuery(batch->cmdbuf, q->query_pool, q->curr_query);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to