util: remove LIST_IS_EMPTY macro
[mesa.git] / src / gallium / drivers / freedreno / freedreno_query_hw.c
index 8b25e9cbccad26129e5019b1dae315afd96a6ced..f1d22328df8e9f4aed42539779960dabf708c5a8 100644 (file)
@@ -1,5 +1,3 @@
-/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
-
 /*
  * Copyright (C) 2014 Rob Clark <robclark@freedesktop.org>
  *
@@ -134,10 +132,10 @@ fd_hw_destroy_query(struct fd_context *ctx, struct fd_query *q)
        free(hq);
 }
 
-static boolean
+static bool
 fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q)
 {
-       struct fd_batch *batch = ctx->batch;
+       struct fd_batch *batch = fd_context_batch(ctx);
        struct fd_hw_query *hq = fd_hw_query(q);
 
        DBG("%p: active=%d", q, q->active);
@@ -149,7 +147,7 @@ fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q)
                resume_query(batch, hq, batch->draw);
 
        /* add to active list: */
-       assert(list_empty(&hq->list));
+       assert(list_is_empty(&hq->list));
        list_addtail(&hq->list, &ctx->hw_active_queries);
 
        return true;
@@ -158,7 +156,7 @@ fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q)
 static void
 fd_hw_end_query(struct fd_context *ctx, struct fd_query *q)
 {
-       struct fd_batch *batch = ctx->batch;
+       struct fd_batch *batch = fd_context_batch(ctx);
        struct fd_hw_query *hq = fd_hw_query(q);
 
        DBG("%p: active=%d", q, q->active);
@@ -176,9 +174,9 @@ static void * sampptr(struct fd_hw_sample *samp, uint32_t n, void *ptr)
        return ((char *)ptr) + (samp->tile_stride * n) + samp->offset;
 }
 
-static boolean
+static bool
 fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q,
-               boolean wait, union pipe_query_result *result)
+               bool wait, union pipe_query_result *result)
 {
        struct fd_hw_query *hq = fd_hw_query(q);
        const struct fd_hw_sample_provider *p = hq->provider;
@@ -186,10 +184,10 @@ fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q,
 
        DBG("%p: wait=%d, active=%d", q, wait, q->active);
 
-       if (LIST_IS_EMPTY(&hq->periods))
+       if (list_is_empty(&hq->periods))
                return true;
 
-       assert(LIST_IS_EMPTY(&hq->list));
+       assert(list_is_empty(&hq->list));
        assert(!hq->period);
 
        /* if !wait, then check the last sample (the one most likely to
@@ -211,7 +209,7 @@ fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q,
                         * spin forever:
                         */
                        if (hq->no_wait_cnt++ > 5)
-                               fd_batch_flush(rsc->write_batch, false, false);
+                               fd_batch_flush(rsc->write_batch, false);
                        return false;
                }
 
@@ -239,7 +237,7 @@ fd_hw_get_query_result(struct fd_context *ctx, struct fd_query *q,
                struct fd_resource *rsc = fd_resource(start->prsc);
 
                if (rsc->write_batch)
-                       fd_batch_flush(rsc->write_batch, true, false);
+                       fd_batch_flush(rsc->write_batch, true);
 
                /* some piglit tests at least do query with no draws, I guess: */
                if (!rsc->bo)
@@ -268,7 +266,7 @@ static const struct fd_query_funcs hw_query_funcs = {
 };
 
 struct fd_query *
-fd_hw_create_query(struct fd_context *ctx, unsigned query_type)
+fd_hw_create_query(struct fd_context *ctx, unsigned query_type, unsigned index)
 {
        struct fd_hw_query *hq;
        struct fd_query *q;
@@ -291,6 +289,7 @@ fd_hw_create_query(struct fd_context *ctx, unsigned query_type)
        q = &hq->base;
        q->funcs = &hw_query_funcs;
        q->type = query_type;
+       q->index = index;
 
        return q;
 }
@@ -301,7 +300,7 @@ fd_hw_sample_init(struct fd_batch *batch, uint32_t size)
        struct fd_hw_sample *samp = slab_alloc_st(&batch->ctx->sample_pool);
        pipe_reference_init(&samp->reference, 1);
        samp->size = size;
-       debug_assert(util_is_power_of_two(size));
+       debug_assert(util_is_power_of_two_or_zero(size));
        batch->next_sample_offset = align(batch->next_sample_offset, size);
        samp->offset = batch->next_sample_offset;
        /* NOTE: slab_alloc_st() does not zero out the buffer: */