freedreno/a4xx: move where we deal w/ binning FS
[mesa.git] / src / gallium / drivers / freedreno / freedreno_query_hw.c
index 7e99c35d132900f3b1daf33f1342ac5d34352aa3..2ac03f22b4148379942a6c57ccf5388dd927ebf2 100644 (file)
@@ -47,6 +47,8 @@ static int pidx(unsigned query_type)
                return 0;
        case PIPE_QUERY_OCCLUSION_PREDICATE:
                return 1;
+       case PIPE_QUERY_TIME_ELAPSED:
+               return 2;
        default:
                return -1;
        }
@@ -160,6 +162,12 @@ static void
 fd_hw_end_query(struct fd_context *ctx, struct fd_query *q)
 {
        struct fd_hw_query *hq = fd_hw_query(q);
+       /* there are a couple special cases, which don't have
+        * a matching ->begin_query():
+        */
+       if (skip_begin_query(q->type) && !q->active) {
+               fd_hw_begin_query(ctx, q);
+       }
        if (!q->active)
                return;
        if (is_active(hq, ctx->stage))
@@ -295,6 +303,8 @@ fd_hw_sample_init(struct fd_context *ctx, uint32_t size)
        struct fd_hw_sample *samp = util_slab_alloc(&ctx->sample_pool);
        pipe_reference_init(&samp->reference, 1);
        samp->size = size;
+       debug_assert(util_is_power_of_two(size));
+       ctx->next_sample_offset = align(ctx->next_sample_offset, size);
        samp->offset = ctx->next_sample_offset;
        /* NOTE: util_slab_alloc() does not zero out the buffer: */
        samp->bo = NULL;
@@ -322,7 +332,7 @@ prepare_sample(struct fd_hw_sample *samp, struct fd_bo *bo,
                assert(samp->tile_stride == tile_stride);
                return;
        }
-       samp->bo = bo;
+       samp->bo = fd_bo_ref(bo);
        samp->num_tiles = num_tiles;
        samp->tile_stride = tile_stride;
 }