From: Qiang Yu Date: Fri, 7 Feb 2020 09:07:51 +0000 (+0800) Subject: lima: add render target to submit by dirty buffer flags X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47200f5c8dda1e03ae62b8cc658574bf0b2f0fe5;p=mesa.git lima: add render target to submit by dirty buffer flags No need to add un-touched buffer to submit. Reviewed-by: Vasily Khoruzhick Signed-off-by: Qiang Yu Part-of: --- diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index e351b4d268c..97e03bd5af3 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -633,20 +633,25 @@ lima_update_pp_stream(struct lima_context *ctx) } static void -lima_update_submit_wb(struct lima_context *ctx) +lima_update_submit_wb(struct lima_context *ctx, unsigned buffers) { - if (lima_ctx_dirty(ctx)) - return; + struct lima_context_framebuffer *fb = &ctx->framebuffer; - if (ctx->framebuffer.base.nr_cbufs) { - struct lima_resource *res = lima_resource(ctx->framebuffer.base.cbufs[0]->texture); + /* add to submit when the buffer is dirty and resolve is clear (not added before) */ + if (fb->base.nr_cbufs && (buffers & PIPE_CLEAR_COLOR0) && + !(ctx->resolve & PIPE_CLEAR_COLOR0)) { + struct lima_resource *res = lima_resource(fb->base.cbufs[0]->texture); lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_WRITE); } - if (ctx->framebuffer.base.zsbuf) { - struct lima_resource *res = lima_resource(ctx->framebuffer.base.zsbuf->texture); + /* add to submit when the buffer is dirty and resolve is clear (not added before) */ + if (fb->base.zsbuf && (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) && + !(ctx->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))) { + struct lima_resource *res = lima_resource(fb->base.zsbuf->texture); lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_WRITE); } + + ctx->resolve |= buffers; } static void @@ -685,9 +690,7 @@ lima_clear(struct pipe_context *pctx, unsigned buffers, lima_flush(ctx); - lima_update_submit_wb(ctx); - - ctx->resolve |= buffers; + lima_update_submit_wb(ctx, buffers); /* no need to reload if cleared */ if (ctx->framebuffer.base.nr_cbufs && (buffers & PIPE_CLEAR_COLOR0)) { @@ -1511,8 +1514,21 @@ lima_draw_vbo_update(struct pipe_context *pctx, const struct pipe_draw_info *info) { struct lima_context *ctx = lima_context(pctx); + struct lima_context_framebuffer *fb = &ctx->framebuffer; + unsigned buffers = 0; - lima_update_submit_wb(ctx); + if (fb->base.zsbuf) { + if (ctx->zsa->base.depth.enabled) + buffers |= PIPE_CLEAR_DEPTH; + if (ctx->zsa->base.stencil[0].enabled || + ctx->zsa->base.stencil[1].enabled) + buffers |= PIPE_CLEAR_STENCIL; + } + + if (fb->base.nr_cbufs) + buffers |= PIPE_CLEAR_COLOR0; + + lima_update_submit_wb(ctx, buffers); lima_update_gp_attribute_info(ctx, info); @@ -1546,17 +1562,6 @@ lima_draw_vbo_update(struct pipe_context *pctx, ctx->gp_output = NULL; } - if (ctx->framebuffer.base.zsbuf) { - if (ctx->zsa->base.depth.enabled) - ctx->resolve |= PIPE_CLEAR_DEPTH; - if (ctx->zsa->base.stencil[0].enabled || - ctx->zsa->base.stencil[1].enabled) - ctx->resolve |= PIPE_CLEAR_STENCIL; - } - - if (ctx->framebuffer.base.nr_cbufs) - ctx->resolve |= PIPE_CLEAR_COLOR0; - ctx->dirty = 0; }