diff options
author | Rob Clark <[email protected]> | 2020-06-24 09:31:03 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-25 00:55:24 +0000 |
commit | 16b4da3ba3117e69d9bd7519f57ae5f970fc48f7 (patch) | |
tree | 7c61a63b2dab18c0db64771a29df71d0d1cb42b0 /src | |
parent | ad136945e6da8f81c454c60c6702995066b9dfdb (diff) |
freedreno: split out batch clear tracking helper
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5634>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_draw.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 70e351a60eb..da79a81d521 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -322,23 +322,11 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) } static void -fd_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state, - const union pipe_color_union *color, double depth, unsigned stencil) +batch_clear_tracking(struct fd_batch *batch, unsigned buffers) { - struct fd_context *ctx = fd_context(pctx); - struct fd_batch *batch = fd_context_batch(ctx); + struct fd_context *ctx = batch->ctx; struct pipe_framebuffer_state *pfb = &batch->framebuffer; unsigned cleared_buffers; - int i; - - /* TODO: push down the region versions into the tiles */ - if (!fd_render_condition_check(pctx)) - return; - - if (ctx->in_discard_blit) { - fd_batch_reset(batch); - fd_context_all_dirty(ctx); - } /* pctx->clear() is only for full-surface clears, so scissor is * equivalent to having GL_SCISSOR_TEST disabled: @@ -365,7 +353,7 @@ fd_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_ fd_screen_lock(ctx->screen); if (buffers & PIPE_CLEAR_COLOR) - for (i = 0; i < pfb->nr_cbufs; i++) + for (unsigned i = 0; i < pfb->nr_cbufs; i++) if (buffers & (PIPE_CLEAR_COLOR0 << i)) resource_written(batch, pfb->cbufs[i]->texture); @@ -380,6 +368,28 @@ fd_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_ resource_written(batch, aq->prsc); fd_screen_unlock(ctx->screen); +} + +static void +fd_clear(struct pipe_context *pctx, unsigned buffers, + const struct pipe_scissor_state *scissor_state, + const union pipe_color_union *color, double depth, + unsigned stencil) +{ + struct fd_context *ctx = fd_context(pctx); + struct fd_batch *batch = fd_context_batch(ctx); + struct pipe_framebuffer_state *pfb = &batch->framebuffer; + + /* TODO: push down the region versions into the tiles */ + if (!fd_render_condition_check(pctx)) + return; + + if (ctx->in_discard_blit) { + fd_batch_reset(batch); + fd_context_all_dirty(ctx); + } + + batch_clear_tracking(batch, buffers); /* Clearing last_fence must come after the batch dependency tracking * (resource_read()/resource_written()), as that can trigger a flush, |