From 684f4b584304ac32cf025067072e5d819b571d73 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 31 Jul 2019 18:20:52 -0700 Subject: [PATCH] freedreno/a3xx-a6xx+ir3: move emit_const* to screen These don't need to be in context, and we'll need them in screen in a later patch. Plus it's a good cleanup. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 5 +++-- src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 6 ++++-- src/gallium/drivers/freedreno/a5xx/fd5_emit.c | 5 +++-- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 5 +++-- src/gallium/drivers/freedreno/freedreno_context.h | 8 -------- src/gallium/drivers/freedreno/freedreno_screen.h | 8 ++++++++ src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 6 +++--- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 7ee4487..1535e06 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -948,13 +948,14 @@ fd3_emit_restore(struct fd_batch *batch, struct fd_ringbuffer *ring) void 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; } void fd3_emit_init(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); - ctx->emit_const = fd3_emit_const; - ctx->emit_const_bo = fd3_emit_const_bo; 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 f670d4f..bcd385d 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -935,14 +935,16 @@ fd4_mem_to_mem(struct fd_ringbuffer *ring, struct pipe_resource *dst, void fd4_emit_init_screen(struct pipe_screen *pscreen) { + struct fd_screen *screen = fd_screen(pscreen); + + screen->emit_const = fd4_emit_const; + screen->emit_const_bo = fd4_emit_const_bo; } void fd4_emit_init(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); - ctx->emit_const = fd4_emit_const; - ctx->emit_const_bo = fd4_emit_const_bo; 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 ab375c4..4710c69 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c @@ -1122,14 +1122,15 @@ fd5_mem_to_mem(struct fd_ringbuffer *ring, struct pipe_resource *dst, void 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; } void fd5_emit_init(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); - ctx->emit_const = fd5_emit_const; - ctx->emit_const_bo = fd5_emit_const_bo; 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 fd2ceaa..f70890f 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -1333,14 +1333,15 @@ fd6_framebuffer_barrier(struct fd_context *ctx) void 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; } void fd6_emit_init(struct pipe_context *pctx) { struct fd_context *ctx = fd_context(pctx); - ctx->emit_const = fd6_emit_const; - ctx->emit_const_bo = fd6_emit_const_bo; 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 43c73ef..2f92b05 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -327,14 +327,6 @@ struct fd_context { /* compute: */ void (*launch_grid)(struct fd_context *ctx, const struct pipe_grid_info *info); - /* constant emit: (note currently not used/needed for a2xx) */ - void (*emit_const)(struct fd_ringbuffer *ring, gl_shader_stage type, - uint32_t regid, uint32_t offset, uint32_t sizedwords, - const uint32_t *dwords, struct pipe_resource *prsc); - /* emit bo addresses as constant: */ - 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); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index b65495d..afd6fd8 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -94,6 +94,14 @@ struct fd_screen { uint32_t (*setup_slices)(struct fd_resource *rsc); unsigned (*tile_mode)(const struct pipe_resource *prsc); + /* constant emit: (note currently not used/needed for a2xx) */ + void (*emit_const)(struct fd_ringbuffer *ring, gl_shader_stage type, + uint32_t regid, uint32_t offset, uint32_t sizedwords, + const uint32_t *dwords, struct pipe_resource *prsc); + /* emit bo addresses as constant: */ + 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); + 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 babc49b..1d0e727 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -207,7 +207,7 @@ emit_const(struct fd_context *ctx, struct fd_ringbuffer *ring, { assert(dst_offset + size <= v->constlen * 4); - ctx->emit_const(ring, v->type, dst_offset, + ctx->screen->emit_const(ring, v->type, dst_offset, offset, size, user_buffer, buffer); } @@ -274,7 +274,7 @@ emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v, assert(offset * 4 + params < v->constlen * 4); ring_wfi(ctx->batch, ring); - ctx->emit_const_bo(ring, v->type, false, offset * 4, params, prscs, offsets); + ctx->screen->emit_const_bo(ring, v->type, false, offset * 4, params, prscs, offsets); } } @@ -408,7 +408,7 @@ emit_tfbos(struct fd_context *ctx, const struct ir3_shader_variant *v, assert(offset * 4 + params < v->constlen * 4); ring_wfi(ctx->batch, ring); - ctx->emit_const_bo(ring, v->type, true, offset * 4, params, prscs, offsets); + ctx->screen->emit_const_bo(ring, v->type, true, offset * 4, params, prscs, offsets); } } -- 2.7.4