etnaviv: query: move sample counter manipulation into query providers

Different query providers have different behavior on when they produce
samples: the perfmon provider provides a sample at the start and at the
end of the query, while the occlusion query provider only adds another
sample when the query is complete.

Move the sample count manipulation to the providers to be able to take
those differences into account. Removes a useless always-zero sample
for each OQ resume/suspend pair.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23557>
This commit is contained in:
Lucas Stach 2023-06-09 18:45:43 +02:00 committed by Marge Bot
parent 4452216a28
commit 22d5d1bc40
3 changed files with 3 additions and 2 deletions

View file

@ -88,7 +88,6 @@ etna_acc_begin_query(struct etna_context *ctx, struct etna_query *q)
realloc_query_bo(ctx, aq);
p->resume(aq, ctx);
aq->samples++;
/* add to active list */
assert(list_is_empty(&aq->node));
@ -102,7 +101,6 @@ etna_acc_end_query(struct etna_context *ctx, struct etna_query *q)
const struct etna_acc_sample_provider *p = aq->provider;
p->suspend(aq, ctx);
aq->samples++;
/* remove from active list */
list_delinit(&aq->node);

View file

@ -90,6 +90,7 @@ occlusion_suspend(struct etna_acc_query *aq, struct etna_context *ctx)
/* 0x1DF5E76 is the value used by blob - but any random value will work */
etna_set_state(ctx->stream, VIVS_GL_OCCLUSION_QUERY_CONTROL, 0x1DF5E76);
resource_written(ctx, aq->prsc);
aq->samples++;
}
static bool

View file

@ -126,12 +126,14 @@ static void
perfmon_resume(struct etna_acc_query *aq, struct etna_context *ctx)
{
pm_query(ctx, aq, ETNA_PM_PROCESS_PRE);
aq->samples++;
}
static void
perfmon_suspend(struct etna_acc_query *aq, struct etna_context *ctx)
{
pm_query(ctx, aq, ETNA_PM_PROCESS_POST);
aq->samples++;
}
static bool