From a99ff933748a7ad00f9fcb5cb0dde536c3bef149 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 27 Mar 2020 16:48:05 -0700 Subject: [PATCH] freedreno: Remove the "active" member of queries. 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: --- src/gallium/drivers/freedreno/freedreno_query.c | 13 +------------ src/gallium/drivers/freedreno/freedreno_query.h | 1 - src/gallium/drivers/freedreno/freedreno_query_acc.c | 8 ++++---- src/gallium/drivers/freedreno/freedreno_query_hw.c | 8 ++++---- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c index 6f99abd85ab..1ac7e1cdd4b 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.c +++ b/src/gallium/drivers/freedreno/freedreno_query.c @@ -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); diff --git a/src/gallium/drivers/freedreno/freedreno_query.h b/src/gallium/drivers/freedreno/freedreno_query.h index 907106e6ea1..18c0d173bb8 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.h +++ b/src/gallium/drivers/freedreno/freedreno_query.h @@ -44,7 +44,6 @@ struct fd_query_funcs { struct fd_query { const struct fd_query_funcs *funcs; - bool active; int type; unsigned index; }; diff --git a/src/gallium/drivers/freedreno/freedreno_query_acc.c b/src/gallium/drivers/freedreno/freedreno_query_acc.c index ed7b6070b20..fd7d61cf371 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_acc.c +++ b/src/gallium/drivers/freedreno/freedreno_query_acc.c @@ -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)); diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c index 3bf38ac868b..8d44fd4a795 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_hw.c +++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c @@ -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; -- 2.30.2