summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/freedreno/freedreno_query_acc.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2018-06-28 08:16:12 -0400
committerRob Clark <robdclark@gmail.com>2018-07-18 10:19:03 -0400
commit9e30e7490da0a89a1760fc23d150e21310066d0c (patch)
tree1ced42dc710600f6a153445fa0883ccb7f7e8c56 /src/gallium/drivers/freedreno/freedreno_query_acc.c
parent37b724ff723e96ebd3397e9d3bc464428afc5f08 (diff)
freedreno: batch query prep-work
For batch queries we have N different query_type's for one query, so mapping a single query_type to a sample_provider doesn't really work out. Instead add a new constructor to construct a query directly from a sample_provider. Also, the sample buffer size needs to be determined at runtime, as it depends on the number of query_types. Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_query_acc.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query_acc.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_query_acc.c b/src/gallium/drivers/freedreno/freedreno_query_acc.c
index a8e28026a84..a7420d695f0 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_acc.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_acc.c
@@ -49,6 +49,7 @@ fd_acc_destroy_query(struct fd_context *ctx, struct fd_query *q)
pipe_resource_reference(&aq->prsc, NULL);
list_del(&aq->node);
+ free(aq->query_data);
free(aq);
}
@@ -69,7 +70,7 @@ realloc_query_bo(struct fd_context *ctx, struct fd_acc_query *aq)
fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_WRITE);
map = fd_bo_map(rsc->bo);
- memset(map, 0, aq->provider->size);
+ memset(map, 0, aq->size);
fd_bo_cpu_fini(rsc->bo);
}
@@ -171,14 +172,11 @@ static const struct fd_query_funcs acc_query_funcs = {
};
struct fd_query *
-fd_acc_create_query(struct fd_context *ctx, unsigned query_type)
+fd_acc_create_query2(struct fd_context *ctx, unsigned query_type,
+ const struct fd_acc_sample_provider *provider)
{
struct fd_acc_query *aq;
struct fd_query *q;
- int idx = pidx(query_type);
-
- if ((idx < 0) || !ctx->acc_sample_providers[idx])
- return NULL;
aq = CALLOC_STRUCT(fd_acc_query);
if (!aq)
@@ -186,7 +184,8 @@ fd_acc_create_query(struct fd_context *ctx, unsigned query_type)
DBG("%p: query_type=%u", aq, query_type);
- aq->provider = ctx->acc_sample_providers[idx];
+ aq->provider = provider;
+ aq->size = provider->size;
list_inithead(&aq->node);
@@ -197,6 +196,18 @@ fd_acc_create_query(struct fd_context *ctx, unsigned query_type)
return q;
}
+struct fd_query *
+fd_acc_create_query(struct fd_context *ctx, unsigned query_type)
+{
+ int idx = pidx(query_type);
+
+ if ((idx < 0) || !ctx->acc_sample_providers[idx])
+ return NULL;
+
+ return fd_acc_create_query2(ctx, query_type,
+ ctx->acc_sample_providers[idx]);
+}
+
void
fd_acc_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
{