From ed7a1a5e5a93b3d5f0853552b63c02e97365688a Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 27 May 2023 09:27:58 -0700 Subject: [PATCH] freedreno/a6xx: Stop using fd_wfi() This was originally intended for earlier gens where certain draw-time state needed a WFI (because it wasn't banked, etc). This isn't the case on a6xx. So just directly emit WFIs where they are needed. Signed-off-by: Rob Clark Part-of: --- .../drivers/freedreno/a6xx/fd6_blitter.cc | 2 +- src/gallium/drivers/freedreno/a6xx/fd6_draw.cc | 1 - src/gallium/drivers/freedreno/a6xx/fd6_emit.cc | 2 +- src/gallium/drivers/freedreno/a6xx/fd6_emit.h | 2 -- src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc | 8 ++------ src/gallium/drivers/freedreno/a6xx/fd6_query.cc | 17 +++++++---------- 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.cc b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.cc index 14d0b343ae2..796e2ed16b5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.cc @@ -1084,7 +1084,7 @@ fd6_resolve_tile(struct fd_batch *batch, struct fd_ringbuffer *ring, fd6_cache_inv(batch, ring); /* Wait for CACHE_INVALIDATE to land */ - fd_wfi(batch, ring); + OUT_WFI5(ring); OUT_PKT7(ring, CP_BLIT, 1); OUT_RING(ring, CP_BLIT_0_OP(BLIT_OP_SCALE)); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc b/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc index c452f6b4a4b..69b95c5273e 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.cc @@ -527,7 +527,6 @@ draw_vbos(struct fd_context *ctx, const struct pipe_draw_info *info, } emit_marker6(ring, 7); - fd_reset_wfi(ctx->batch); flush_streamout(ctx, &emit); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc b/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc index 7147b7efb37..c91e4137e73 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc @@ -441,7 +441,7 @@ fd6_emit_streamout(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt * themselves. */ if (ctx->dirty & FD_DIRTY_STREAMOUT) - fd_wfi(ctx->batch, ring); + OUT_WFI5(ring); ctx->last.streamout_mask = streamout_mask; emit->streamout_mask = streamout_mask; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h index d97af8c364f..e807008ebb0 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h @@ -221,8 +221,6 @@ fd6_event_write(struct fd_batch *batch, struct fd_ringbuffer *ring, { unsigned seqno = 0; - fd_reset_wfi(batch); - OUT_PKT7(ring, CP_EVENT_WRITE, timestamp ? 4 : 1); OUT_RING(ring, CP_EVENT_WRITE_0_EVENT(evt)); if (timestamp) { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc index 9c60739112f..7855492c030 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc @@ -325,8 +325,6 @@ emit_lrz_clears(struct fd_batch *batch) fd6_emit_flushes(batch->ctx, ring, FD6_FLUSH_CCU_COLOR | FD6_INVALIDATE_CACHE); - - fd_wfi(batch, ring); } } @@ -882,8 +880,6 @@ emit_binning_pass(struct fd_batch *batch) assert_dt } trace_end_binning_ib(&batch->trace, ring); - fd_reset_wfi(batch); - OUT_PKT7(ring, CP_SET_DRAW_STATE, 3); OUT_RING(ring, CP_SET_DRAW_STATE__0_COUNT(0) | CP_SET_DRAW_STATE__0_DISABLE_ALL_GROUPS | @@ -987,7 +983,7 @@ fd6_emit_tile_init(struct fd_batch *batch) assert_dt OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_LOCAL, 1); OUT_RING(ring, 0x1); - fd_wfi(batch, ring); + OUT_WFI5(ring); fd6_emit_ccu_cntl(ring, screen, true); emit_zs(ring, pfb->zsbuf, batch->gmem_state); @@ -1838,7 +1834,7 @@ fd6_emit_sysmem(struct fd_batch *batch) emit_sysmem_clears(batch, subpass); } - fd_wfi(batch, ring); + OUT_WFI5(ring); fd6_emit_ccu_cntl(ring, screen, false); struct pipe_framebuffer_state *pfb = &batch->framebuffer; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_query.cc b/src/gallium/drivers/freedreno/a6xx/fd6_query.cc index 277e09077ab..7a48e9b9af4 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_query.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_query.cc @@ -220,8 +220,6 @@ timestamp_resume(struct fd_acc_query *aq, struct fd_batch *batch) CP_EVENT_WRITE_0_EVENT(RB_DONE_TS) | CP_EVENT_WRITE_0_TIMESTAMP); OUT_RELOC(ring, query_sample(aq, start)); OUT_RING(ring, 0x00000000); - - fd_reset_wfi(batch); } static void @@ -235,8 +233,7 @@ time_elapsed_pause(struct fd_acc_query *aq, struct fd_batch *batch) assert_dt OUT_RELOC(ring, query_sample(aq, stop)); OUT_RING(ring, 0x00000000); - fd_reset_wfi(batch); - fd_wfi(batch, ring); + OUT_WFI5(ring); /* result += stop - start: */ OUT_PKT7(ring, CP_MEM_TO_MEM, 9); @@ -426,7 +423,7 @@ primitives_generated_resume(struct fd_acc_query *aq, { struct fd_ringbuffer *ring = batch->draw; - fd_wfi(batch, ring); + OUT_WFI5(ring); OUT_PKT7(ring, CP_REG_TO_MEM, 3); OUT_RING(ring, CP_REG_TO_MEM_0_64B | CP_REG_TO_MEM_0_CNT(counter_count * 2) | @@ -442,7 +439,7 @@ primitives_generated_pause(struct fd_acc_query *aq, { struct fd_ringbuffer *ring = batch->draw; - fd_wfi(batch, ring); + OUT_WFI5(ring); /* snapshot the end values: */ OUT_PKT7(ring, CP_REG_TO_MEM, 3); @@ -501,7 +498,7 @@ primitives_emitted_resume(struct fd_acc_query *aq, { struct fd_ringbuffer *ring = batch->draw; - fd_wfi(batch, ring); + OUT_WFI5(ring); ASSERT_ALIGNED(struct fd6_primitives_sample, start[0], 32); @@ -517,7 +514,7 @@ primitives_emitted_pause(struct fd_acc_query *aq, { struct fd_ringbuffer *ring = batch->draw; - fd_wfi(batch, ring); + OUT_WFI5(ring); ASSERT_ALIGNED(struct fd6_primitives_sample, stop[0], 32); @@ -599,7 +596,7 @@ perfcntr_resume(struct fd_acc_query *aq, struct fd_batch *batch) assert_dt unsigned counters_per_group[screen->num_perfcntr_groups]; memset(counters_per_group, 0, sizeof(counters_per_group)); - fd_wfi(batch, ring); + OUT_WFI5(ring); /* configure performance counters for the requested queries: */ for (unsigned i = 0; i < data->num_query_entries; i++) { @@ -639,7 +636,7 @@ perfcntr_pause(struct fd_acc_query *aq, struct fd_batch *batch) assert_dt unsigned counters_per_group[screen->num_perfcntr_groups]; memset(counters_per_group, 0, sizeof(counters_per_group)); - fd_wfi(batch, ring); + OUT_WFI5(ring); /* TODO do we need to bother to turn anything off? */