diff options
author | Rob Clark <[email protected]> | 2016-06-27 11:28:37 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-07-30 09:23:42 -0400 |
commit | f02a64dbdd2ec147167ad60357bd46d8d964290a (patch) | |
tree | d4d0a74b53481862a46df052af1653b59e4337b7 /src/gallium/drivers/freedreno/freedreno_batch.c | |
parent | eeafaf2d37cdc7f83f997e8babd8f770243ecf25 (diff) |
freedreno: move more batch related tracking to fd_batch
To flush batches out of order, the gmem code needs to not depend on
state from fd_context (since that may apply to a more recent batch).
So this all moves into batch.
The one exception is the gmem/pipe/tile state itself. But this is
only used from gmem code (and batches are flushed serially). The
alternative would be having to re-calculate GMEM layout on every
batch, even if the dimensions of the render targets are the same.
Note: This opens up the possibility of pushing gmem/submit into a
helper thread.
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.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index 6d17a422fc4..1fbce43f62c 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -64,16 +64,31 @@ fd_batch_create(struct fd_context *ctx) list_inithead(&batch->used_resources); + /* reset maximal bounds: */ + batch->max_scissor.minx = batch->max_scissor.miny = ~0; + batch->max_scissor.maxx = batch->max_scissor.maxy = 0; + + util_dynarray_init(&batch->draw_patches); + + if (is_a3xx(ctx->screen)) + util_dynarray_init(&batch->rbrc_patches); + return batch; } void __fd_batch_destroy(struct fd_batch *batch) { + util_copy_framebuffer_state(&batch->framebuffer, NULL); fd_ringbuffer_del(batch->draw); fd_ringbuffer_del(batch->binning); fd_ringbuffer_del(batch->gmem); + util_dynarray_fini(&batch->draw_patches); + + if (is_a3xx(batch->ctx->screen)) + util_dynarray_fini(&batch->rbrc_patches); + free(batch); } @@ -88,7 +103,12 @@ fd_batch_flush(struct fd_batch *batch) { struct fd_resource *rsc, *rsc_tmp; - fd_gmem_render_tiles(batch->ctx); + DBG("%p: needs_flush=%d", batch, batch->needs_flush); + + if (!batch->needs_flush) + return; + + fd_gmem_render_tiles(batch); /* go through all the used resources and clear their reading flag */ LIST_FOR_EACH_ENTRY_SAFE(rsc, rsc_tmp, &batch->used_resources, list) { |