From 63e889516d6db0b8eb8099245ac5094bdaa85825 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 7 Jan 2023 11:28:20 -0800 Subject: [PATCH] freedreno: Don't re-install a flushed batch The compute path does this save/restore dance with the current batch, so various things called to emit state can assume ctx->batch is the current thing. But during resource tracking, which could have flushed what was previously the current batch. Fixes a problem that surfaces in the next patch when we stop just flushing batches for all the barriers. Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/freedreno_draw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index a524b476987..c68ba23e771 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -564,6 +564,12 @@ fd_launch_grid(struct pipe_context *pctx, if (info->indirect) resource_read(batch, info->indirect); + /* If the saved batch has been flushed during the resource tracking, + * don't re-install it: + */ + if (save_batch && save_batch->flushed) + fd_batch_reference_locked(&save_batch, NULL); + fd_screen_unlock(ctx->screen); DBG("%p: work_dim=%u, block=%ux%ux%u, grid=%ux%ux%u",