aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2017-10-08 22:00:06 +0200
committerChristian Gmeiner <[email protected]>2017-10-09 22:19:31 +0200
commitb22bacc6cfd17d785d12bb3f75094a7b8a0e3221 (patch)
tree2d7421ad88681e45612662a60bf528d53cb253eb /src/gallium
parentbee61d16c8c48b0339d1db9bf4e6bf1ddc6685ff (diff)
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 <[email protected]> Reviewed-By: Wladimir J. van der Laan <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_query.c17
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_query_sw.c5
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;