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
{
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;
}
{
struct etna_query *q = etna_query(pq);
+ if (q->active)
+ return false;
+
return q->funcs->get_query_result(etna_context(pctx), q, wait, result);
}
{
struct etna_sw_query *sq = etna_sw_query(q);
- q->active = true;
sq->begin_value = read_counter(ctx, q->type);
return true;
{
struct etna_sw_query *sq = etna_sw_query(q);
- q->active = false;
sq->end_value = read_counter(ctx, q->type);
}
{
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;