Mesa (master): zink: remove explicit fencing for query results

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Mar 29 02:59:37 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Mar 12 09:00:16 2021 -0500

zink: remove explicit fencing for query results

now that the results are automatically being copied to internal buffers,
mapping the buffers will handle any fencing that's required

the only caveat is that the query still needs to be flushed for a result
to be returned

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

---

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

diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index dd9e6a28179..26b60ec3e5f 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -479,13 +479,10 @@ force_cpu_read(struct zink_context *ctx, struct pipe_query *pquery, enum pipe_qu
    unsigned result_size = result_type <= PIPE_QUERY_TYPE_U32 ? sizeof(uint32_t) : sizeof(uint64_t);
    struct zink_query *query = (struct zink_query*)pquery;
    union pipe_query_result result;
-   uint32_t batch_id = p_atomic_read(&query->batch_id.usage);
 
    if (query->needs_update)
       update_qbo(ctx, query);
 
-   zink_wait_on_batch(ctx, batch_id);
-
    bool success = get_query_result(pctx, pquery, true, &result);
    if (!success) {
       debug_printf("zink: getting query result failed\n");
@@ -752,13 +749,12 @@ zink_get_query_result(struct pipe_context *pctx,
 {
    struct zink_query *query = (void*)q;
    struct zink_context *ctx = zink_context(pctx);
-   uint32_t batch_id = p_atomic_read(&query->batch_id.usage);
 
    if (query->needs_update)
       update_qbo(ctx, query);
 
-   if (wait)
-      zink_wait_on_batch(ctx, batch_id);
+   if (query->batch_id.usage == ctx->curr_batch)
+      pctx->flush(pctx, NULL, 0);
 
    return get_query_result(pctx, q, wait, result);
 }



More information about the mesa-commit mailing list