diff options
author | Rob Clark <[email protected]> | 2016-05-20 20:05:26 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-07-30 09:23:42 -0400 |
commit | 9e4561d3c47c2dabce43ce160915fd9bcea05a81 (patch) | |
tree | 6e9157a18a356672f2568831e4139d42fb01f1da /src/gallium/drivers/freedreno/freedreno_batch.c | |
parent | 9bbd239a4039522d7c1023ecb21764679447bb2d (diff) |
freedreno: push resource tracking down into batch
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 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index c202ff0e942..51a61d96e02 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -24,10 +24,12 @@ * Rob Clark <[email protected]> */ +#include "util/list.h" #include "util/u_string.h" #include "freedreno_batch.h" #include "freedreno_context.h" +#include "freedreno_resource.h" struct fd_batch * fd_batch_create(struct fd_context *ctx) @@ -54,6 +56,8 @@ fd_batch_create(struct fd_context *ctx) fd_ringbuffer_set_parent(batch->draw, batch->gmem); fd_ringbuffer_set_parent(batch->binning, batch->gmem); + list_inithead(&batch->used_resources); + return batch; } @@ -76,7 +80,38 @@ __fd_batch_describe(char* buf, const struct fd_batch *batch) void fd_batch_flush(struct fd_batch *batch) { + struct fd_resource *rsc, *rsc_tmp; + fd_gmem_render_tiles(batch->ctx); + + /* go through all the used resources and clear their reading flag */ + LIST_FOR_EACH_ENTRY_SAFE(rsc, rsc_tmp, &batch->used_resources, list) { + debug_assert(rsc->pending_batch == batch); + debug_assert(rsc->status != 0); + rsc->status = 0; + fd_batch_reference(&rsc->pending_batch, NULL); + list_delinit(&rsc->list); + } + + assert(LIST_IS_EMPTY(&batch->used_resources)); +} + +void +fd_batch_resource_used(struct fd_batch *batch, struct fd_resource *rsc, + enum fd_resource_status status) +{ + rsc->status |= status; + + if (rsc->stencil) + rsc->stencil->status |= status; + + /* TODO resources can actually be shared across contexts, + * so I'm not sure a single list-head will do the trick? + */ + debug_assert((rsc->pending_batch == batch) || !rsc->pending_batch); + list_delinit(&rsc->list); + list_addtail(&rsc->list, &batch->used_resources); + fd_batch_reference(&rsc->pending_batch, batch); } void |