Mesa (main): zink: immediately return false when getting query result if it's not gonna happen

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 14 03:25:20 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu May 13 18:16:47 2021 -0400

zink: immediately return false when getting query result if it's not gonna happen

this is a small optimization for the no-wait case when unflushed usage
exists since it's impossible for a qbo update to happen instantly

no functionality will be fixed by this, it's just a very minor optimization

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

---

 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 e14a58edbbd..f6cda574724 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -780,8 +780,12 @@ zink_get_query_result(struct pipe_context *pctx,
    if (query->needs_update)
       update_qbo(ctx, query);
 
-   if (!threaded_query(q)->flushed && query->batch_id.usage == ctx->curr_batch)
-      pctx->flush(pctx, NULL, 0);
+   if (query->batch_id.usage == ctx->curr_batch) {
+      if (!threaded_query(q)->flushed)
+         pctx->flush(pctx, NULL, 0);
+      if (!wait)
+         return false;
+   }
 
    return get_query_result(pctx, q, wait, result);
 }



More information about the mesa-commit mailing list