diff options
author | Rob Clark <[email protected]> | 2016-07-14 10:32:02 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-07-30 09:23:42 -0400 |
commit | c44163876a2858aea219a08bd2e048b76953cff9 (patch) | |
tree | 02e83e5140db04c4aa25c290deb808dae94f420a /src/gallium/drivers/freedreno/freedreno_state.c | |
parent | 7f8fd02dc7cad1ddcfb610db10ffbb41e3e34e7d (diff) |
freedreno: track batch/blit types
Add a bit of extra book-keeping about blits and back-blits (from
resource shadowing). If the app uploads all mipmap levels, as opposed
to uploading the first level and then glGenerateMipmap(), we can discard
the back-blit (as opposed to being naive and shadowing the resource for
each mipmap level). Also, after a normal blit, we might as well flush
the batch immediately, since there is not likely to be further rendering
to the surface.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_state.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_state.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index 849ea08037d..f83fd219f0a 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -119,13 +119,28 @@ fd_set_framebuffer_state(struct pipe_context *pctx, struct pipe_framebuffer_state *cso; if (ctx->screen->reorder) { - struct fd_batch *batch; - if (likely(ctx->batch)) - fd_hw_query_set_stage(ctx->batch, ctx->batch->draw, FD_STAGE_NULL); + struct fd_batch *batch, *old_batch = NULL; + + fd_batch_reference(&old_batch, ctx->batch); + + if (likely(old_batch)) + fd_hw_query_set_stage(old_batch, old_batch->draw, FD_STAGE_NULL); + batch = fd_batch_from_fb(&ctx->screen->batch_cache, ctx, framebuffer); fd_batch_reference(&ctx->batch, NULL); ctx->batch = batch; ctx->dirty = ~0; + + if (old_batch && old_batch->blit && !old_batch->back_blit) { + /* for blits, there is not really much point in hanging on + * to the uncommitted batch (ie. you probably don't blit + * multiple times to the same surface), so we might as + * well go ahead and flush this one: + */ + fd_batch_flush(old_batch); + } + + fd_batch_reference(&old_batch, NULL); } else { DBG("%d: cbufs[0]=%p, zsbuf=%p", ctx->batch->needs_flush, framebuffer->cbufs[0], framebuffer->zsbuf); |