freedreno/all: move more emit helpers to screen
authorRob Clark <robdclark@chromium.org>
Thu, 1 Aug 2019 01:26:57 +0000 (18:26 -0700)
committerRob Clark <robdclark@chromium.org>
Tue, 13 Aug 2019 15:11:26 +0000 (08:11 -0700)
framebuffer_barrier() still depends on the ctx, but the rest can move to
screen.

Signed-off-by: Rob Clark <robdclark@chromium.org>
src/gallium/drivers/freedreno/a2xx/fd2_emit.c
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_gmem.c
src/gallium/drivers/freedreno/freedreno_screen.h
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 3ed7bb6e141624955a5edc9c44f909961780e484..38286ec939b41a9c1d2243e74da85c034efc028f 100644 (file)
@@ -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;
 }
index 1535e069427a260d3d3cb84e71d8569d7444e110..a966934fe9938d21d28f18664bc3c07057ab59c5 100644 (file)
@@ -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;
 }
index bcd385d2bf367e67351bc11458216fccde74055a..76f15771abbeed5c83113d42d580a9a1e4981107 100644 (file)
@@ -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;
 }
index 4710c69000720a2a7bef7d4e9218feec3607b8d8..ce0bba60b476b0a1096a929a256fa35e79b61fe3 100644 (file)
@@ -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;
 }
index f70890f3b1e6c72521ef5c2f3c44ffe140412ea2..956e6dfb4058c7e9936ed3e629091f0069079a6a 100644 (file)
@@ -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;
 }
index 2f92b0575c24d5dc15b75e269877390ee5018a9f..470e625500f0c10b9d526e6bcf89605262956766 100644 (file)
@@ -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);
 
index b1489f2e9136ca97edd68ab7d1bb9be1c0d17674..14f7c5840a9613525cc9fbb74c6aa8d9a2abcd92 100644 (file)
@@ -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)
index afd6fd83a86e2f7881ee51ea2323803f5df35210..e0c05f2b6a7f581c4e66cefafd3d129446d76392 100644 (file)
@@ -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;
index 1d0e727d7751a73e317a4b40d453aacf54dfcbe4..1186bc4b062e1cc714a1dd0991c178c38f865949 100644 (file)
@@ -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);