if (ctx->occlusion_query) {
ctx->payloads[PIPE_SHADER_FRAGMENT].gl_enables |= MALI_OCCLUSION_QUERY | MALI_OCCLUSION_PRECISE;
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.occlusion_counter = ctx->occlusion_query->transfer.gpu;
+ ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.occlusion_counter = ctx->occlusion_query->bo->gpu;
}
panfrost_patch_shader_state_compute(ctx, PIPE_SHADER_VERTEX, true);
static void
panfrost_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
{
+ struct panfrost_query *query = (struct panfrost_query *) q;
+
+ if (query->bo) {
+ panfrost_bo_unreference(query->bo);
+ query->bo = NULL;
+ }
+
ralloc_free(q);
}
{
struct panfrost_context *ctx = pan_context(pipe);
struct panfrost_query *query = (struct panfrost_query *) q;
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
switch (query->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
case PIPE_QUERY_OCCLUSION_PREDICATE:
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
- /* Allocate a word for the query results to be stored */
- query->transfer = panfrost_allocate_transient(batch, sizeof(unsigned));
+ /* Allocate a bo for the query results to be stored */
+ if (!query->bo) {
+ query->bo = panfrost_bo_create(
+ pan_screen(ctx->base.screen),
+ sizeof(unsigned), 0);
+ }
+
+ unsigned *result = (unsigned *)query->bo->cpu;
+ *result = 0; /* Default to 0 if nothing at all drawn. */
ctx->occlusion_query = query;
break;
panfrost_flush_all_batches(ctx, true);
/* Read back the query results */
- unsigned *result = (unsigned *) query->transfer.cpu;
+ unsigned *result = (unsigned *) query->bo->cpu;
unsigned passed = *result;
if (query->type == PIPE_QUERY_OCCLUSION_COUNTER) {
unsigned type;
unsigned index;
- union {
- /* For computed queries. 64-bit to prevent overflow */
- struct {
- uint64_t start;
- uint64_t end;
- };
-
- /* Memory for the GPU to writeback the value of the query */
- struct panfrost_transfer transfer;
+ /* For computed queries. 64-bit to prevent overflow */
+ struct {
+ uint64_t start;
+ uint64_t end;
};
+
+ /* Memory for the GPU to writeback the value of the query */
+ struct panfrost_bo *bo;
};
struct panfrost_fence {