From b22bacc6cfd17d785d12bb3f75094a7b8a0e3221 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Sun, 8 Oct 2017 22:00:06 +0200 Subject: etnaviv: push query active handling into generic layer We want the same active handling for every query type. So lets handle it in the generic layer. Signed-off-by: Christian Gmeiner Reviewed-By: Wladimir J. van der Laan --- src/gallium/drivers/etnaviv/etnaviv_query.c | 17 ++++++++++++++++- src/gallium/drivers/etnaviv/etnaviv_query_sw.c | 5 ----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_query.c b/src/gallium/drivers/etnaviv/etnaviv_query.c index 16adb8c21fc..089a26e6fda 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_query.c +++ b/src/gallium/drivers/etnaviv/etnaviv_query.c @@ -55,8 +55,15 @@ static boolean etna_begin_query(struct pipe_context *pctx, struct pipe_query *pq) { struct etna_query *q = etna_query(pq); + boolean ret; - return q->funcs->begin_query(etna_context(pctx), q); + if (q->active) + return false; + + ret = q->funcs->begin_query(etna_context(pctx), q); + q->active = ret; + + return ret; } static bool @@ -64,7 +71,12 @@ etna_end_query(struct pipe_context *pctx, struct pipe_query *pq) { struct etna_query *q = etna_query(pq); + if (!q->active) + return false; + q->funcs->end_query(etna_context(pctx), q); + q->active = false; + return true; } @@ -74,6 +86,9 @@ etna_get_query_result(struct pipe_context *pctx, struct pipe_query *pq, { struct etna_query *q = etna_query(pq); + if (q->active) + return false; + return q->funcs->get_query_result(etna_context(pctx), q, wait, result); } diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c index 90f4a658261..7b93339377a 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_query_sw.c +++ b/src/gallium/drivers/etnaviv/etnaviv_query_sw.c @@ -62,7 +62,6 @@ etna_sw_begin_query(struct etna_context *ctx, struct etna_query *q) { struct etna_sw_query *sq = etna_sw_query(q); - q->active = true; sq->begin_value = read_counter(ctx, q->type); return true; @@ -73,7 +72,6 @@ etna_sw_end_query(struct etna_context *ctx, struct etna_query *q) { struct etna_sw_query *sq = etna_sw_query(q); - q->active = false; sq->end_value = read_counter(ctx, q->type); } @@ -83,9 +81,6 @@ etna_sw_get_query_result(struct etna_context *ctx, struct etna_query *q, { struct etna_sw_query *sq = etna_sw_query(q); - if (q->active) - return false; - util_query_clear_result(result, q->type); result->u64 = sq->end_value - sq->begin_value; -- cgit v1.2.3