From c6fab232c85d04e8de80ce4e8753fb1516d69fcd Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 31 Jul 2019 18:26:57 -0700 Subject: freedreno/all: move more emit helpers to screen framebuffer_barrier() still depends on the ctx, but the rest can move to screen. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a2xx/fd2_emit.c | 4 ++-- src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 3 +-- src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 5 ++--- src/gallium/drivers/freedreno/a5xx/fd5_emit.c | 5 ++--- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 4 ++-- src/gallium/drivers/freedreno/freedreno_context.h | 8 -------- src/gallium/drivers/freedreno/freedreno_gmem.c | 4 ++-- src/gallium/drivers/freedreno/freedreno_screen.h | 8 ++++++++ src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 4 ++-- 9 files changed, 21 insertions(+), 24 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c index 3ed7bb6e141..38286ec939b 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c @@ -566,11 +566,11 @@ fd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring) void fd2_emit_init_screen(struct pipe_screen *pscreen) { + struct fd_screen *screen = fd_screen(pscreen); + screen->emit_ib = fd2_emit_ib; } void fd2_emit_init(struct pipe_context *pctx) { - struct fd_context *ctx = fd_context(pctx); - ctx->emit_ib = fd2_emit_ib; } diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 1535e069427..a966934fe99 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -951,11 +951,10 @@ fd3_emit_init_screen(struct pipe_screen *pscreen) struct fd_screen *screen = fd_screen(pscreen); screen->emit_const = fd3_emit_const; screen->emit_const_bo = fd3_emit_const_bo; + screen->emit_ib = fd3_emit_ib; } void fd3_emit_init(struct pipe_context *pctx) { - struct fd_context *ctx = fd_context(pctx); - ctx->emit_ib = fd3_emit_ib; } diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index bcd385d2bf3..76f15771abb 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -939,12 +939,11 @@ fd4_emit_init_screen(struct pipe_screen *pscreen) screen->emit_const = fd4_emit_const; screen->emit_const_bo = fd4_emit_const_bo; + screen->emit_ib = fd4_emit_ib; + screen->mem_to_mem = fd4_mem_to_mem; } void fd4_emit_init(struct pipe_context *pctx) { - struct fd_context *ctx = fd_context(pctx); - ctx->emit_ib = fd4_emit_ib; - ctx->mem_to_mem = fd4_mem_to_mem; } diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c index 4710c690007..ce0bba60b47 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c @@ -1125,12 +1125,11 @@ fd5_emit_init_screen(struct pipe_screen *pscreen) struct fd_screen *screen = fd_screen(pscreen); screen->emit_const = fd5_emit_const; screen->emit_const_bo = fd5_emit_const_bo; + screen->emit_ib = fd5_emit_ib; + screen->mem_to_mem = fd5_mem_to_mem; } void fd5_emit_init(struct pipe_context *pctx) { - struct fd_context *ctx = fd_context(pctx); - ctx->emit_ib = fd5_emit_ib; - ctx->mem_to_mem = fd5_mem_to_mem; } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index f70890f3b1e..956e6dfb405 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -1336,13 +1336,13 @@ fd6_emit_init_screen(struct pipe_screen *pscreen) struct fd_screen *screen = fd_screen(pscreen); screen->emit_const = fd6_emit_const; screen->emit_const_bo = fd6_emit_const_bo; + screen->emit_ib = fd6_emit_ib; + screen->mem_to_mem = fd6_mem_to_mem; } void fd6_emit_init(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); - ctx->emit_ib = fd6_emit_ib; - ctx->mem_to_mem = fd6_mem_to_mem; ctx->framebuffer_barrier = fd6_framebuffer_barrier; } diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 2f92b0575c2..470e625500f 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -327,9 +327,6 @@ struct fd_context { /* compute: */ void (*launch_grid)(struct fd_context *ctx, const struct pipe_grid_info *info); - /* indirect-branch emit: */ - void (*emit_ib)(struct fd_ringbuffer *ring, struct fd_ringbuffer *target); - /* query: */ struct fd_query * (*create_query)(struct fd_context *ctx, unsigned query_type); void (*query_prepare)(struct fd_batch *batch, uint32_t num_tiles); @@ -340,11 +337,6 @@ struct fd_context { /* blitter: */ bool (*blit)(struct fd_context *ctx, const struct pipe_blit_info *info); - /* simple gpu "memcpy": */ - void (*mem_to_mem)(struct fd_ringbuffer *ring, struct pipe_resource *dst, - unsigned dst_off, struct pipe_resource *src, unsigned src_off, - unsigned sizedwords); - /* handling for barriers: */ void (*framebuffer_barrier)(struct fd_context *ctx); diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index b1489f2e913..14f7c5840a9 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -379,7 +379,7 @@ render_tiles(struct fd_batch *batch) if (ctx->emit_tile) { ctx->emit_tile(batch, tile); } else { - ctx->emit_ib(batch->gmem, batch->draw); + ctx->screen->emit_ib(batch->gmem, batch->draw); } fd_reset_wfi(batch); @@ -402,7 +402,7 @@ render_sysmem(struct fd_batch *batch) ctx->query_prepare_tile(batch, 0, batch->gmem); /* emit IB to drawcmds: */ - ctx->emit_ib(batch->gmem, batch->draw); + ctx->screen->emit_ib(batch->gmem, batch->draw); fd_reset_wfi(batch); if (ctx->emit_sysmem_fini) diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index afd6fd83a86..e0c05f2b6a7 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -102,6 +102,14 @@ struct fd_screen { void (*emit_const_bo)(struct fd_ringbuffer *ring, gl_shader_stage type, boolean write, uint32_t regid, uint32_t num, struct pipe_resource **prscs, uint32_t *offsets); + /* indirect-branch emit: */ + void (*emit_ib)(struct fd_ringbuffer *ring, struct fd_ringbuffer *target); + + /* simple gpu "memcpy": */ + void (*mem_to_mem)(struct fd_ringbuffer *ring, struct pipe_resource *dst, + unsigned dst_off, struct pipe_resource *src, unsigned src_off, + unsigned sizedwords); + int64_t cpu_gpu_time_delta; struct fd_batch_cache batch_cache; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 1d0e727d775..1186bc4b062 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -564,7 +564,7 @@ ir3_emit_vs_driver_params(const struct ir3_shader_variant *v, } /* copy index_bias or start from draw params: */ - ctx->mem_to_mem(ring, vertex_params_rsc, 0, + ctx->screen->mem_to_mem(ring, vertex_params_rsc, 0, indirect->buffer, src_off, 1); emit_const(ctx, ring, v, offset * 4, 0, @@ -638,7 +638,7 @@ ir3_emit_cs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *rin 0x1000); indirect_offset = 0; - ctx->mem_to_mem(ring, indirect, 0, info->indirect, + ctx->screen->mem_to_mem(ring, indirect, 0, info->indirect, info->indirect_offset, 3); } else { pipe_resource_reference(&indirect, info->indirect); -- cgit v1.2.3