Needs to allocate batches from the cache so that it could
get a valid index and make resource dependancy tracking right.

And it doesn't need to flush the batch in each launch_grid from
this approach. Also it could make it avoid potential memory leak
of the batches.

In addition this fixes assertion on debug build since the commit
1a40faa8 landed.
---
 src/gallium/drivers/freedreno/freedreno_draw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c 
b/src/gallium/drivers/freedreno/freedreno_draw.c
index e130895aac..bd902ef5a9 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -459,7 +459,7 @@ fd_launch_grid(struct pipe_context *pctx, const struct 
pipe_grid_info *info)
        struct fd_batch *batch, *save_batch = NULL;
        unsigned i;
 
-       batch = fd_batch_create(ctx, true);
+       batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx);
        fd_batch_reference(&save_batch, ctx->batch);
        fd_batch_reference(&ctx->batch, batch);
 
@@ -502,10 +502,9 @@ fd_launch_grid(struct pipe_context *pctx, const struct 
pipe_grid_info *info)
        batch->needs_flush = true;
        ctx->launch_grid(ctx, info);
 
-       fd_batch_flush(batch, false, false);
-
        fd_batch_reference(&ctx->batch, save_batch);
        fd_batch_reference(&save_batch, NULL);
+       fd_batch_reference(&batch, NULL);
 }
 
 void
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to