summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_draw.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-05-20 15:36:10 -0400
committerRob Clark <[email protected]>2016-07-30 09:23:42 -0400
commit9bbd239a4039522d7c1023ecb21764679447bb2d (patch)
treede6633fb1936d05c929e34a88987c69884ed45f9 /src/gallium/drivers/freedreno/freedreno_draw.c
parent12aec78993edface7f530eede9e018b5fa1897b7 (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/freedreno_draw.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 34b1ff6010c..26164f2109e 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -192,7 +192,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
util_format_short_name(pipe_surface_format(pfb->cbufs[0])),
util_format_short_name(pipe_surface_format(pfb->zsbuf)));
- fd_hw_query_set_stage(ctx, ctx->ring, FD_STAGE_DRAW);
+ fd_hw_query_set_stage(ctx, ctx->batch->draw, FD_STAGE_DRAW);
if (ctx->draw_vbo(ctx, info))
ctx->needs_flush = true;
@@ -202,18 +202,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
if (fd_mesa_debug & FD_DBG_DDRAW)
ctx->dirty = 0xffffffff;
- /* if an app (or, well, piglit test) does many thousands of draws
- * without flush (or anything which implicitly flushes, like
- * changing render targets), we can exceed the ringbuffer size.
- * Since we don't currently have a sane way to wrapparound, and
- * we use the same buffer for both draw and tiling commands, for
- * now we need to do this hack and trigger flush if we are running
- * low on remaining space for cmds:
- */
- if (((ctx->ring->cur - ctx->ring->start) >
- (ctx->ring->size/4 - FD_TILING_COMMANDS_DWORDS)) ||
- (fd_mesa_debug & FD_DBG_FLUSH))
- fd_context_render(pctx);
+ fd_batch_check_size(ctx->batch);
}
/* TODO figure out how to make better use of existing state mechanism
@@ -274,7 +263,7 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
util_format_short_name(pipe_surface_format(pfb->cbufs[0])),
util_format_short_name(pipe_surface_format(pfb->zsbuf)));
- fd_hw_query_set_stage(ctx, ctx->ring, FD_STAGE_CLEAR);
+ fd_hw_query_set_stage(ctx, ctx->batch->draw, FD_STAGE_CLEAR);
ctx->clear(ctx, buffers, color, depth, stencil);