summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
37b724f)
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>
pipe_resource_reference(&aq->prsc, NULL);
list_del(&aq->node);
pipe_resource_reference(&aq->prsc, NULL);
list_del(&aq->node);
fd_bo_cpu_prep(rsc->bo, ctx->pipe, DRM_FREEDRENO_PREP_WRITE);
map = fd_bo_map(rsc->bo);
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);
}
fd_bo_cpu_fini(rsc->bo);
}
-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;
{
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)
aq = CALLOC_STRUCT(fd_acc_query);
if (!aq)
DBG("%p: query_type=%u", aq, 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);
list_inithead(&aq->node);
+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)
{
void
fd_acc_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
{
const struct fd_acc_sample_provider *provider;
struct pipe_resource *prsc;
const struct fd_acc_sample_provider *provider;
struct pipe_resource *prsc;
+
+ /* usually the same as provider->size but for batch queries we
+ * need to calculate the size dynamically when the query is
+ * allocated:
+ */
+ unsigned size;
struct list_head node; /* list-node in ctx->active_acc_queries */
int no_wait_cnt; /* see fd_acc_get_query_result() */
struct list_head node; /* list-node in ctx->active_acc_queries */
int no_wait_cnt; /* see fd_acc_get_query_result() */
+
+ void *query_data; /* query specific data */
};
static inline struct fd_acc_query *
};
static inline struct fd_acc_query *
}
struct fd_query * fd_acc_create_query(struct fd_context *ctx, unsigned query_type);
}
struct fd_query * fd_acc_create_query(struct fd_context *ctx, unsigned query_type);
+struct fd_query * fd_acc_create_query2(struct fd_context *ctx, unsigned query_type,
+ const struct fd_acc_sample_provider *provider);
void fd_acc_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage);
void fd_acc_query_register_provider(struct pipe_context *pctx,
const struct fd_acc_sample_provider *provider);
void fd_acc_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage);
void fd_acc_query_register_provider(struct pipe_context *pctx,
const struct fd_acc_sample_provider *provider);