diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_barrier.c b/src/gallium/drivers/freedreno/a6xx/fd6_barrier.c index 176d3d537f5..bc13f7fdf27 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_barrier.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_barrier.c @@ -64,7 +64,7 @@ event_write(struct fd_context *ctx, struct fd_ringbuffer *ring, return 0; } -static void +void fd6_emit_flushes(struct fd_context *ctx, struct fd_ringbuffer *ring, unsigned flushes) { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_barrier.h b/src/gallium/drivers/freedreno/a6xx/fd6_barrier.h index 74217d851d3..7cdd17d835d 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_barrier.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_barrier.h @@ -41,6 +41,9 @@ enum fd6_flush { FD6_WAIT_FOR_ME = BIT(8), }; +void fd6_emit_flushes(struct fd_context *ctx, struct fd_ringbuffer *ring, + unsigned flushes); + void fd6_barrier_flush(struct fd_batch *batch) assert_dt; void fd6_barrier_init(struct pipe_context *pctx); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_compute.c b/src/gallium/drivers/freedreno/a6xx/fd6_compute.c index afb5754da8b..5d751cfe1b0 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_compute.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_compute.c @@ -118,6 +118,9 @@ fd6_launch_grid(struct fd_context *ctx, const struct pipe_grid_info *info) in_dt if (!v) return; + if (ctx->batch->barrier) + fd6_barrier_flush(ctx->batch); + if (ctx->dirty_shader[PIPE_SHADER_COMPUTE] & FD_DIRTY_SHADER_PROG) cs_program_emit(ctx, ring, v); @@ -204,9 +207,6 @@ fd6_launch_grid(struct fd_context *ctx, const struct pipe_grid_info *info) in_dt OUT_RING(ring, 1); /* HLSQ_CS_KERNEL_GROUP_Y */ OUT_RING(ring, 1); /* HLSQ_CS_KERNEL_GROUP_Z */ - if (ctx->batch->barrier) - fd6_barrier_flush(ctx->batch); - if (info->indirect) { struct fd_resource *rsc = fd_resource(info->indirect); @@ -227,10 +227,6 @@ fd6_launch_grid(struct fd_context *ctx, const struct pipe_grid_info *info) in_dt trace_end_compute(&ctx->batch->trace, ring); - OUT_WFI5(ring); - - fd6_cache_flush(ctx->batch, ring); - fd_context_all_clean(ctx); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c index 5542ff82f97..e6c0b36203a 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c @@ -40,6 +40,7 @@ #include "freedreno_state.h" #include "freedreno_tracepoints.h" +#include "fd6_barrier.h" #include "fd6_blitter.h" #include "fd6_context.h" #include "fd6_draw.h" @@ -609,6 +610,8 @@ emit_common_fini(struct fd_batch *batch) struct fd_autotune *at = &batch->ctx->autotune; struct fd_batch_result *result = batch->autotune_result; + fd6_emit_flushes(batch->ctx, ring, batch->barrier); + if (!result) return;