freedreno: Remove the "active" member of queries.
authorEric Anholt <eric@anholt.net>
Fri, 27 Mar 2020 23:48:05 +0000 (16:48 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 30 Mar 2020 21:35:21 +0000 (21:35 +0000)
The state tracker only gets to begin/query/destroy when !active and end
when active, so we have no need to try to track this ourselves.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4356>

src/gallium/drivers/freedreno/freedreno_query.c
src/gallium/drivers/freedreno/freedreno_query.h
src/gallium/drivers/freedreno/freedreno_query_acc.c
src/gallium/drivers/freedreno/freedreno_query_hw.c

index 6f99abd85abf321e3df3f6e61cee932c139d8054..1ac7e1cdd4b12ebcd287b20b4faf33d4469dc40a 100644 (file)
@@ -63,11 +63,7 @@ fd_begin_query(struct pipe_context *pctx, struct pipe_query *pq)
 {
        struct fd_query *q = fd_query(pq);
 
-       if (q->active)
-               return false;
-
        q->funcs->begin_query(fd_context(pctx), q);
-       q->active = true;
 
        return true;
 }
@@ -80,14 +76,10 @@ fd_end_query(struct pipe_context *pctx, struct pipe_query *pq)
        /* there are a couple special cases, which don't have
         * a matching ->begin_query():
         */
-       if (skip_begin_query(q->type) && !q->active)
+       if (skip_begin_query(q->type))
                fd_begin_query(pctx, pq);
 
-       if (!q->active)
-               return false;
-
        q->funcs->end_query(fd_context(pctx), q);
-       q->active = false;
 
        return true;
 }
@@ -98,9 +90,6 @@ fd_get_query_result(struct pipe_context *pctx, struct pipe_query *pq,
 {
        struct fd_query *q = fd_query(pq);
 
-       if (q->active)
-               return false;
-
        util_query_clear_result(result, q->type);
 
        return q->funcs->get_query_result(fd_context(pctx), q, wait, result);
index 907106e6ea1e6e2c941574ec67db5ff474a90dcc..18c0d173bb89beb9bf68e1d6c8908cb197eff4a7 100644 (file)
@@ -44,7 +44,6 @@ struct fd_query_funcs {
 
 struct fd_query {
        const struct fd_query_funcs *funcs;
-       bool active;
        int type;
        unsigned index;
 };
index ed7b6070b20fc4b9be3058b3bc05561889c587e8..fd7d61cf3715d33b1755d5d304ee1882a98e5713 100644 (file)
@@ -44,7 +44,7 @@ fd_acc_destroy_query(struct fd_context *ctx, struct fd_query *q)
 {
        struct fd_acc_query *aq = fd_acc_query(q);
 
-       DBG("%p: active=%d", q, q->active);
+       DBG("%p", q);
 
        pipe_resource_reference(&aq->prsc, NULL);
        list_del(&aq->node);
@@ -81,7 +81,7 @@ fd_acc_begin_query(struct fd_context *ctx, struct fd_query *q)
        struct fd_acc_query *aq = fd_acc_query(q);
        const struct fd_acc_sample_provider *p = aq->provider;
 
-       DBG("%p: active=%d", q, q->active);
+       DBG("%p", q);
 
        /* ->begin_query() discards previous results, so realloc bo: */
        realloc_query_bo(ctx, aq);
@@ -102,7 +102,7 @@ fd_acc_end_query(struct fd_context *ctx, struct fd_query *q)
        struct fd_acc_query *aq = fd_acc_query(q);
        const struct fd_acc_sample_provider *p = aq->provider;
 
-       DBG("%p: active=%d", q, q->active);
+       DBG("%p", q);
 
        if (batch && is_active(aq, batch->stage))
                p->pause(aq, batch);
@@ -119,7 +119,7 @@ fd_acc_get_query_result(struct fd_context *ctx, struct fd_query *q,
        const struct fd_acc_sample_provider *p = aq->provider;
        struct fd_resource *rsc = fd_resource(aq->prsc);
 
-       DBG("%p: wait=%d, active=%d", q, wait, q->active);
+       DBG("%p: wait=%d", q, wait);
 
        assert(list_is_empty(&aq->node));
 
index 3bf38ac868bb1a3249114e6ca28cb66bf2be9d59..8d44fd4a79595f65cc1d7af48d150b71222f59f6 100644 (file)
@@ -124,7 +124,7 @@ fd_hw_destroy_query(struct fd_context *ctx, struct fd_query *q)
 {
        struct fd_hw_query *hq = fd_hw_query(q);
 
-       DBG("%p: active=%d", q, q->active);
+       DBG("%p", q);
 
        destroy_periods(ctx, hq);
        list_del(&hq->list);
@@ -138,7 +138,7 @@ fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q)
        struct fd_batch *batch = fd_context_batch(ctx);
        struct fd_hw_query *hq = fd_hw_query(q);
 
-       DBG("%p: active=%d", q, q->active);
+       DBG("%p", q);
 
        /* begin_query() should clear previous results: */
        destroy_periods(ctx, hq);
@@ -157,7 +157,7 @@ fd_hw_end_query(struct fd_context *ctx, struct fd_query *q)
        struct fd_batch *batch = fd_context_batch(ctx);
        struct fd_hw_query *hq = fd_hw_query(q);
 
-       DBG("%p: active=%d", q, q->active);
+       DBG("%p", q);
 
        if (batch && is_active(hq, batch->stage))
                pause_query(batch, hq, batch->draw);
@@ -180,7 +180,7 @@ fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q,
        const struct fd_hw_sample_provider *p = hq->provider;
        struct fd_hw_sample_period *period;
 
-       DBG("%p: wait=%d, active=%d", q, wait, q->active);
+       DBG("%p: wait=%d", q, wait);
 
        if (list_is_empty(&hq->periods))
                return true;