freedreno/a3xx-a6xx+ir3: move emit_const* to screen
authorRob Clark <robdclark@chromium.org>
Thu, 1 Aug 2019 01:20:52 +0000 (18:20 -0700)
committerRob Clark <robdclark@chromium.org>
Tue, 13 Aug 2019 15:11:26 +0000 (08:11 -0700)
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 <robdclark@chromium.org>
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a4xx/fd4_emit.c
src/gallium/drivers/freedreno/a5xx/fd5_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_emit.c
src/gallium/drivers/freedreno/freedreno_context.h
src/gallium/drivers/freedreno/freedreno_screen.h
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 7ee4487..1535e06 100644 (file)
@@ -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;
 }
index f670d4f..bcd385d 100644 (file)
@@ -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;
 }
index ab375c4..4710c69 100644 (file)
@@ -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;
 }
index fd2ceaa..f70890f 100644 (file)
@@ -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;
index 43c73ef..2f92b05 100644 (file)
@@ -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);
 
index b65495d..afd6fd8 100644 (file)
@@ -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;
index babc49b..1d0e727 100644 (file)
@@ -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);
        }
 }