[PATCH 1/2] etnaviv: push query active handling into generic layer
Christian Gmeiner
christian.gmeiner at gmail.com
Sun Oct 8 20:00:06 UTC 2017
We want the same active handling for every query type. So lets
handle it in the generic layer.
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
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 16adb8c21f..089a26e6fd 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 90f4a65826..7b93339377 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;
--
2.13.6
More information about the etnaviv
mailing list