diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc b/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc index a172fc308bb..7a83b14e1cc 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.cc @@ -944,6 +944,5 @@ void fd6_emit_init_screen(struct pipe_screen *pscreen) { struct fd_screen *screen = fd_screen(pscreen); - screen->emit_ib = fd6_emit_ib; screen->mem_to_mem = fd6_mem_to_mem; } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc index c10f09b6641..f00494204a8 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.cc @@ -1630,7 +1630,6 @@ static void fd6_emit_sysmem_prep(struct fd_batch *batch) assert_dt { struct fd_ringbuffer *ring = batch->gmem; - struct fd_screen *screen = batch->ctx->screen; fd6_emit_restore(batch, ring); fd6_emit_lrz_flush(ring); @@ -1663,8 +1662,6 @@ fd6_emit_sysmem_prep(struct fd_batch *batch) assert_dt .buffers_location = BUFFERS_IN_SYSMEM, }); - emit_sysmem_clears(batch, ring); - emit_marker6(ring, 7); OUT_PKT7(ring, CP_SET_MARKER, 1); OUT_RING(ring, A6XX_CP_SET_MARKER_0_MODE(RM6_BYPASS)); @@ -1677,12 +1674,6 @@ fd6_emit_sysmem_prep(struct fd_batch *batch) assert_dt OUT_PKT7(ring, CP_SKIP_IB2_ENABLE_LOCAL, 1); OUT_RING(ring, 0x1); - fd6_event_write(batch, ring, PC_CCU_INVALIDATE_COLOR, false); - fd6_cache_inv(batch, ring); - - fd_wfi(batch, ring); - fd6_emit_ccu_cntl(ring, screen, false); - /* enable stream-out, with sysmem there is only one pass: */ OUT_REG(ring, A6XX_VPC_SO_DISABLE(false)); @@ -1694,9 +1685,29 @@ fd6_emit_sysmem_prep(struct fd_batch *batch) assert_dt emit_msaa(ring, pfb->samples); patch_fb_read_sysmem(batch); + emit_common_init(batch); +} + +template +static void +fd6_emit_sysmem(struct fd_batch *batch) + assert_dt +{ + struct fd_ringbuffer *ring = batch->gmem; + struct fd_screen *screen = batch->ctx->screen; + + emit_sysmem_clears(batch, ring); + + fd6_event_write(batch, ring, PC_CCU_INVALIDATE_COLOR, false); + fd6_cache_inv(batch, ring); + + fd_wfi(batch, ring); + fd6_emit_ccu_cntl(ring, screen, false); + + struct pipe_framebuffer_state *pfb = &batch->framebuffer; update_render_cntl(batch, pfb, false); - emit_common_init(batch); + fd6_emit_ib(ring, batch->draw); } static void @@ -1737,6 +1748,7 @@ fd6_gmem_init(struct pipe_context *pctx) ctx->emit_tile_gmem2mem = fd6_emit_tile_gmem2mem; ctx->emit_tile_fini = fd6_emit_tile_fini; ctx->emit_sysmem_prep = fd6_emit_sysmem_prep; + ctx->emit_sysmem = fd6_emit_sysmem; ctx->emit_sysmem_fini = fd6_emit_sysmem_fini; } diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 8b0aff5fe1c..346b78c5e91 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -559,6 +559,7 @@ struct fd_context { /* optional, for GMEM bypass: */ void (*emit_sysmem_prep)(struct fd_batch *batch) dt; + void (*emit_sysmem)(struct fd_batch *batch) dt; void (*emit_sysmem_fini)(struct fd_batch *batch) dt; /* draw: */ diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 7b579649bd6..e5d6f4043e1 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -672,7 +672,11 @@ render_sysmem(struct fd_batch *batch) assert_dt trace_start_draw_ib(&batch->trace, batch->gmem); } /* emit IB to drawcmds: */ - ctx->screen->emit_ib(batch->gmem, batch->draw); + if (ctx->emit_sysmem) { + ctx->emit_sysmem(batch); + } else { + ctx->screen->emit_ib(batch->gmem, batch->draw); + } if (!batch->nondraw) { trace_end_draw_ib(&batch->trace, batch->gmem);