summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_batch.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-07-11 17:36:45 -0400
committerRob Clark <[email protected]>2016-07-30 09:23:42 -0400
commit7f8fd02dc7cad1ddcfb610db10ffbb41e3e34e7d (patch)
tree755aec6bfa8e4d9cb4614dd5a8b58e4b21a6b73d /src/gallium/drivers/freedreno/freedreno_batch.c
parent10baf05b2caaa0900c71ac64c91301e953176516 (diff)
freedreno: re-order support for hw queries
Push query state down to batch, and use the resource tracking to figure out which batch(es) need to be flushed to get the query result. This means we actually need to allocate the prsc up front, before we know the size. So we have to add a special way to allocate an un- backed resource, and then later allocate the backing storage. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_batch.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_batch.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c
index 2dd7eda72ad..5008f5dbe56 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch.c
@@ -32,6 +32,7 @@
#include "freedreno_batch.h"
#include "freedreno_context.h"
#include "freedreno_resource.h"
+#include "freedreno_query_hw.h"
static void
batch_init(struct fd_batch *batch)
@@ -61,6 +62,7 @@ batch_init(struct fd_batch *batch)
batch->needs_flush = false;
batch->gmem_reason = 0;
batch->num_draws = 0;
+ batch->stage = FD_STAGE_NULL;
/* reset maximal bounds: */
batch->max_scissor.minx = batch->max_scissor.miny = ~0;
@@ -72,6 +74,8 @@ batch_init(struct fd_batch *batch)
util_dynarray_init(&batch->rbrc_patches);
assert(batch->resources->entries == 0);
+
+ util_dynarray_init(&batch->samples);
}
struct fd_batch *
@@ -98,6 +102,8 @@ fd_batch_create(struct fd_context *ctx)
static void
batch_fini(struct fd_batch *batch)
{
+ pipe_resource_reference(&batch->query_buf, NULL);
+
fd_ringbuffer_del(batch->draw);
fd_ringbuffer_del(batch->binning);
fd_ringbuffer_del(batch->gmem);
@@ -106,6 +112,13 @@ batch_fini(struct fd_batch *batch)
if (is_a3xx(batch->ctx->screen))
util_dynarray_fini(&batch->rbrc_patches);
+
+ while (batch->samples.size > 0) {
+ struct fd_hw_sample *samp =
+ util_dynarray_pop(&batch->samples, struct fd_hw_sample *);
+ fd_hw_sample_reference(batch->ctx, &samp, NULL);
+ }
+ util_dynarray_fini(&batch->samples);
}
static void