*/
static void
-occlusion_start(struct etna_acc_query *aq, struct etna_context *ctx)
+occlusion_resume(struct etna_acc_query *aq, struct etna_context *ctx)
{
struct etna_resource *rsc = etna_resource(aq->prsc);
struct etna_reloc r = {
}
static void
-occlusion_stop(struct etna_acc_query *aq, struct etna_context *ctx)
+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);
}
-static void
-occlusion_suspend(struct etna_acc_query *aq, struct etna_context *ctx)
-{
- occlusion_stop(aq, ctx);
-}
-
-static void
-occlusion_resume(struct etna_acc_query *aq, struct etna_context *ctx)
-{
- aq->samples++;
- occlusion_start(aq, ctx);
-}
-
static void
occlusion_result(struct etna_acc_query *aq, void *buf,
union pipe_query_result *result)
uint64_t sum = 0;
uint64_t *ptr = (uint64_t *)buf;
- for (unsigned i = 0; i <= aq->samples; i++)
+ for (unsigned i = 0; i < aq->samples; i++)
sum += *(ptr + i);
if (aq->base.type == PIPE_QUERY_OCCLUSION_COUNTER)
}
static const struct etna_acc_sample_provider occlusion_provider = {
- .start = occlusion_start,
- .stop = occlusion_stop,
.suspend = occlusion_suspend,
.resume = occlusion_resume,
.result = occlusion_result,
/* ->begin_query() discards previous results, so realloc bo */
realloc_query_bo(ctx, aq);
- p->start(aq, ctx);
+ p->resume(aq, ctx);
+ aq->samples++;
/* add to active list */
assert(list_is_empty(&aq->node));
struct etna_acc_query *aq = etna_acc_query(q);
const struct etna_acc_sample_provider *p = aq->provider;
- p->stop(aq, ctx);
+ p->suspend(aq, ctx);
+ aq->samples++;
/* remove from active list */
list_delinit(&aq->node);
void *ptr = etna_bo_map(rsc->bo);
p->result(aq, ptr, result);
+ aq->samples = 0;
etna_bo_cpu_fini(rsc->bo);
struct etna_acc_query;
struct etna_acc_sample_provider {
- void (*start)(struct etna_acc_query *aq, struct etna_context *ctx);
- void (*stop)(struct etna_acc_query *aq, struct etna_context *ctx);
- void (*suspend)(struct etna_acc_query *aq, struct etna_context *ctx);
void (*resume)(struct etna_acc_query *aq, struct etna_context *ctx);
+ void (*suspend)(struct etna_acc_query *aq, struct etna_context *ctx);
void (*result)(struct etna_acc_query *aq, void *buf,
union pipe_query_result *result);
return;
p->suspend(aq, ctx);
+ aq->samples++;
}
static inline void
return;
p->resume(aq, ctx);
+ aq->samples++;
}
#endif