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 <robdclark@chromium.org>
This commit is contained in:
Rob Clark 2019-07-31 18:26:57 -07:00
parent 684f4b5843
commit c6fab232c8
9 changed files with 21 additions and 24 deletions

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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);

View 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)

View 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;

View 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);