diff options
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_query.c | 17 | ||||
-rw-r--r-- | 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; |