diff options
author | Rob Clark <[email protected]> | 2016-05-20 15:36:10 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-07-30 09:23:42 -0400 |
commit | 9bbd239a4039522d7c1023ecb21764679447bb2d (patch) | |
tree | de6633fb1936d05c929e34a88987c69884ed45f9 /src/gallium/drivers/freedreno/a4xx | |
parent | 12aec78993edface7f530eede9e018b5fa1897b7 (diff) |
freedreno: introduce fd_batch
Introduce the batch object, to track a batch/submit's worth of
ringbuffers and other bookkeeping. In this first step, just move
the ringbuffers into batch, since that is mostly uninteresting
churn.
For now there is just a single batch at a time. Note that one
outcome of this change is that rb's are allocated/freed on each
use. But the expectation is that the bo pool in libdrm_freedreno
will save us the GEM bo alloc/free which was the initial reason
to implement a rb pool in gallium.
The purpose of the batch is to eventually facilitate out-of-order
rendering, with batches associated to framebuffer state, and
tracking the dependencies on other batches.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_draw.c | 30 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_emit.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_gmem.c | 7 |
4 files changed, 24 insertions, 23 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c index b9bae8adc54..e0513860a71 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c @@ -164,22 +164,24 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) emit.key.binning_pass = false; emit.dirty = dirty; + struct fd_ringbuffer *ring = ctx->batch->draw; + if (ctx->rasterizer->rasterizer_discard) { - fd_wfi(ctx, ctx->ring); - OUT_PKT3(ctx->ring, CP_REG_RMW, 3); - OUT_RING(ctx->ring, REG_A4XX_RB_RENDER_CONTROL); - OUT_RING(ctx->ring, ~A4XX_RB_RENDER_CONTROL_DISABLE_COLOR_PIPE); - OUT_RING(ctx->ring, A4XX_RB_RENDER_CONTROL_DISABLE_COLOR_PIPE); + fd_wfi(ctx, ring); + OUT_PKT3(ring, CP_REG_RMW, 3); + OUT_RING(ring, REG_A4XX_RB_RENDER_CONTROL); + OUT_RING(ring, ~A4XX_RB_RENDER_CONTROL_DISABLE_COLOR_PIPE); + OUT_RING(ring, A4XX_RB_RENDER_CONTROL_DISABLE_COLOR_PIPE); } - draw_impl(ctx, ctx->ring, &emit); + draw_impl(ctx, ctx->batch->draw, &emit); if (ctx->rasterizer->rasterizer_discard) { - fd_wfi(ctx, ctx->ring); - OUT_PKT3(ctx->ring, CP_REG_RMW, 3); - OUT_RING(ctx->ring, REG_A4XX_RB_RENDER_CONTROL); - OUT_RING(ctx->ring, ~A4XX_RB_RENDER_CONTROL_DISABLE_COLOR_PIPE); - OUT_RING(ctx->ring, 0); + fd_wfi(ctx, ring); + OUT_PKT3(ring, CP_REG_RMW, 3); + OUT_RING(ring, REG_A4XX_RB_RENDER_CONTROL); + OUT_RING(ring, ~A4XX_RB_RENDER_CONTROL_DISABLE_COLOR_PIPE); + OUT_RING(ring, 0); } /* and now binning pass: */ @@ -187,7 +189,7 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) emit.dirty = dirty & ~(FD_DIRTY_BLEND); emit.vp = NULL; /* we changed key so need to refetch vp */ emit.fp = NULL; - draw_impl(ctx, ctx->binning_ring, &emit); + draw_impl(ctx, ctx->batch->binning, &emit); return true; } @@ -217,7 +219,7 @@ static void fd4_clear_binning(struct fd_context *ctx, unsigned dirty) { struct fd4_context *fd4_ctx = fd4_context(ctx); - struct fd_ringbuffer *ring = ctx->binning_ring; + struct fd_ringbuffer *ring = ctx->batch->binning; struct fd4_emit emit = { .debug = &ctx->debug, .vtx = &fd4_ctx->solid_vbuf_state, @@ -251,7 +253,7 @@ fd4_clear(struct fd_context *ctx, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { struct fd4_context *fd4_ctx = fd4_context(ctx); - struct fd_ringbuffer *ring = ctx->ring; + struct fd_ringbuffer *ring = ctx->batch->draw; struct pipe_framebuffer_state *pfb = &ctx->framebuffer; unsigned char mrt_comp[A4XX_MAX_RENDER_TARGETS] = {0}; unsigned dirty = ctx->dirty; diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index c8658f0fe9c..5bb712c755c 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -736,10 +736,9 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, * state, there could have been a context switch between ioctls): */ void -fd4_emit_restore(struct fd_context *ctx) +fd4_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring) { struct fd4_context *fd4_ctx = fd4_context(ctx); - struct fd_ringbuffer *ring = ctx->ring; OUT_PKT0(ring, REG_A4XX_RBBM_PERFCTR_CTL, 1); OUT_RING(ring, 0x00000001); @@ -892,10 +891,9 @@ fd4_emit_restore(struct fd_context *ctx) } static void -fd4_emit_ib(struct fd_ringbuffer *ring, struct fd_ringmarker *start, - struct fd_ringmarker *end) +fd4_emit_ib(struct fd_ringbuffer *ring, struct fd_ringbuffer *target) { - __OUT_IB(ring, true, start, end); + __OUT_IB(ring, true, target); } void diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.h b/src/gallium/drivers/freedreno/a4xx/fd4_emit.h index a39697dafb4..89dc51ad1ee 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.h +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.h @@ -102,7 +102,7 @@ void fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit); void fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, struct fd4_emit *emit); -void fd4_emit_restore(struct fd_context *ctx); +void fd4_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring); void fd4_emit_init(struct pipe_context *pctx); diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c b/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c index e2115454d86..524c35a18bd 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c @@ -525,7 +525,7 @@ fd4_emit_sysmem_prep(struct fd_context *ctx) struct pipe_framebuffer_state *pfb = &ctx->framebuffer; struct fd_ringbuffer *ring = ctx->ring; - fd4_emit_restore(ctx); + fd4_emit_restore(ctx, ring); OUT_PKT0(ring, REG_A4XX_RB_FRAME_BUFFER_DIMENSION, 1); OUT_RING(ring, A4XX_RB_FRAME_BUFFER_DIMENSION_WIDTH(pfb->width) | @@ -596,6 +596,7 @@ emit_binning_pass(struct fd_context *ctx) { struct fd_gmem_stateobj *gmem = &ctx->gmem; struct pipe_framebuffer_state *pfb = &ctx->framebuffer; + struct fd_batch *batch = ctx->batch; struct fd_ringbuffer *ring = ctx->ring; int i; @@ -635,7 +636,7 @@ emit_binning_pass(struct fd_context *ctx) } /* emit IB to binning drawcmds: */ - ctx->emit_ib(ring, ctx->binning_start, ctx->binning_end); + ctx->emit_ib(ring, batch->binning); fd_reset_wfi(ctx); fd_wfi(ctx, ring); @@ -662,7 +663,7 @@ fd4_emit_tile_init(struct fd_context *ctx) struct fd_ringbuffer *ring = ctx->ring; struct fd_gmem_stateobj *gmem = &ctx->gmem; - fd4_emit_restore(ctx); + fd4_emit_restore(ctx, ring); OUT_PKT0(ring, REG_A4XX_VSC_BIN_SIZE, 1); OUT_RING(ring, A4XX_VSC_BIN_SIZE_WIDTH(gmem->bin_w) | |