Lines Matching full:query
22 is_occlusion(struct agx_query *query) in is_occlusion() argument
24 switch (query->type) { in is_occlusion()
35 is_timer(struct agx_query *query) in is_timer() argument
37 switch (query->type) { in is_timer()
51 /* Bitset of query indices that are in use */
71 AGX_BO_WRITEBACK, "Occlusion query heap"); in agx_alloc_oq_heap()
147 struct agx_query *query = calloc(1, sizeof(struct agx_query)); in agx_create_query() local
149 query->type = query_type; in agx_create_query()
150 query->index = index; in agx_create_query()
155 for (unsigned i = 0; i < ARRAY_SIZE(query->writer_generation); ++i) { in agx_create_query()
156 query->writer_generation[i] = UINT64_MAX; in agx_create_query()
159 if (is_occlusion(query)) { in agx_create_query()
160 query->ptr = agx_alloc_oq(agx_context(ctx)); in agx_create_query()
162 /* TODO: a BO for the query is wasteful, but we benefit from BO list in agx_create_query()
165 query->bo = agx_bo_create(agx_device(ctx->screen), sizeof(uint64_t) * 2, in agx_create_query()
166 0, AGX_BO_WRITEBACK, "Query"); in agx_create_query()
167 query->ptr = (struct agx_ptr){ in agx_create_query()
168 .gpu = query->bo->va->addr, in agx_create_query()
169 .cpu = agx_bo_map(query->bo), in agx_create_query()
173 if (!query->ptr.gpu) { in agx_create_query()
174 free(query); in agx_create_query()
178 return (struct pipe_query *)query; in agx_create_query()
182 flush_query_writers(struct agx_context *ctx, struct agx_query *query, in flush_query_writers() argument
187 STATIC_ASSERT(ARRAY_SIZE(query->writer_generation) == AGX_MAX_BATCHES); in flush_query_writers()
190 if (query->writer_generation[i] == ctx->batches.generation[i]) in flush_query_writers()
196 sync_query_writers(struct agx_context *ctx, struct agx_query *query, in sync_query_writers() argument
200 if (query->writer_generation[i] == ctx->batches.generation[i]) in sync_query_writers()
206 is_query_busy(struct agx_context *ctx, struct agx_query *query) in is_query_busy() argument
209 if (query->writer_generation[i] == ctx->batches.generation[i]) in is_query_busy()
220 struct agx_query *query = (struct agx_query *)pquery; in agx_destroy_query() local
223 /* We don't reference count the occlusion query allocations, so we need to in agx_destroy_query()
225 * it's destroyed, since the driver will assume an available query is idle. in agx_destroy_query()
230 if (is_occlusion(query)) { in agx_destroy_query()
231 sync_query_writers(ctx, query, "Occlusion query destroy"); in agx_destroy_query()
232 agx_free_oq(ctx, query); in agx_destroy_query()
234 agx_bo_unreference(dev, query->bo); in agx_destroy_query()
244 struct agx_query *query = (struct agx_query *)pquery; in agx_begin_query() local
248 switch (query->type) { in agx_begin_query()
252 ctx->occlusion_query = query; in agx_begin_query()
256 ctx->prims_generated[query->index] = query; in agx_begin_query()
260 ctx->tf_prims_generated[query->index] = query; in agx_begin_query()
264 ctx->tf_overflow[query->index] = query; in agx_begin_query()
268 ctx->tf_any_overflow = query; in agx_begin_query()
272 ctx->time_elapsed = query; in agx_begin_query()
280 assert(query->index < ARRAY_SIZE(ctx->pipeline_statistics)); in agx_begin_query()
281 ctx->pipeline_statistics[query->index] = query; in agx_begin_query()
289 sync_query_writers(ctx, query, "Query overwritten"); in agx_begin_query()
291 uint64_t *ptr = query->ptr.cpu; in agx_begin_query()
294 if (query->type == PIPE_QUERY_TIME_ELAPSED) { in agx_begin_query()
307 struct agx_query *query = (struct agx_query *)pquery; in agx_end_query() local
311 switch (query->type) { in agx_end_query()
318 ctx->prims_generated[query->index] = NULL; in agx_end_query()
321 ctx->tf_prims_generated[query->index] = NULL; in agx_end_query()
324 ctx->tf_overflow[query->index] = NULL; in agx_end_query()
333 assert(query->index < ARRAY_SIZE(ctx->pipeline_statistics)); in agx_end_query()
334 ctx->pipeline_statistics[query->index] = NULL; in agx_end_query()
340 agx_add_timestamp_end_query(ctx, query); in agx_end_query()
342 uint64_t *value = query->ptr.cpu; in agx_end_query()
387 struct agx_query *query = (struct agx_query *)pquery; in agx_get_query_result() local
392 sync_query_writers(ctx, query, "Reading query results"); in agx_get_query_result()
394 uint64_t *ptr = query->ptr.cpu; in agx_get_query_result()
397 switch (classify_query_type(query->type)) { in agx_get_query_result()
432 struct agx_query *query, in agx_get_query_result_resource_cpu() argument
441 result.u64 = !is_query_busy(ctx, query); in agx_get_query_result_resource_cpu()
444 agx_get_query_result(&ctx->base, (void *)query, true, &result); in agx_get_query_result_resource_cpu()
448 switch (classify_query_type(query->type)) { in agx_get_query_result_resource_cpu()
473 struct agx_query *query, in agx_get_query_result_resource_gpu() argument
484 if (query->type == PIPE_QUERY_TIMESTAMP || in agx_get_query_result_resource_gpu()
485 query->type == PIPE_QUERY_TIME_ELAPSED) in agx_get_query_result_resource_gpu()
488 flush_query_writers(ctx, query, util_str_query_type(query->type, true)); in agx_get_query_result_resource_gpu()
491 enum query_copy_type copy_type = classify_query_type(query->type); in agx_get_query_result_resource_gpu()
504 libagx_copy_query_gl(batch, agx_1d(1), AGX_BARRIER_ALL, query->ptr.gpu, in agx_get_query_result_resource_gpu()
515 struct agx_query *query = (struct agx_query *)q; in agx_get_query_result_resource() local
519 if (!agx_get_query_result_resource_gpu(ctx, query, flags, result_type, index, in agx_get_query_result_resource()
523 agx_get_query_result_resource_cpu(ctx, query, flags, result_type, index, in agx_get_query_result_resource()
538 agx_add_query_to_batch(struct agx_batch *batch, struct agx_query *query) in agx_add_query_to_batch() argument
541 struct agx_bo *bo = is_occlusion(query) ? batch->ctx->oq->bo : query->bo; in agx_add_query_to_batch()
544 query->writer_generation[idx] = batch->ctx->batches.generation[idx]; in agx_add_query_to_batch()
557 agx_get_oq_index(struct agx_batch *batch, struct agx_query *query) in agx_get_oq_index() argument
559 agx_add_query_to_batch(batch, query); in agx_get_oq_index()
560 return agx_oq_index(batch->ctx, query); in agx_get_oq_index()
564 agx_get_query_address(struct agx_batch *batch, struct agx_query *query) in agx_get_query_address() argument
566 if (query) { in agx_get_query_address()
567 agx_add_query_to_batch(batch, query); in agx_get_query_address()
568 return query->ptr.gpu; in agx_get_query_address()
593 agx_query_increment_cpu(struct agx_context *ctx, struct agx_query *query, in agx_query_increment_cpu() argument
596 if (!query) in agx_query_increment_cpu()
599 sync_query_writers(ctx, query, "CPU query increment"); in agx_query_increment_cpu()
601 uint64_t *value = query->ptr.cpu; in agx_query_increment_cpu()
606 agx_render_condition(struct pipe_context *pipe, struct pipe_query *query, in agx_render_condition() argument
611 ctx->cond_query = query; in agx_render_condition()