summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiang Yu <[email protected]>2020-02-07 17:07:51 +0800
committerMarge Bot <[email protected]>2020-02-17 02:54:15 +0000
commit47200f5c8dda1e03ae62b8cc658574bf0b2f0fe5 (patch)
treeafea42090fa6389bd19245fa1b59bd8661dc4b6e
parent32f17339723d76b920e7b16d171feb66d5b807eb (diff)
lima: add render target to submit by dirty buffer flags
No need to add un-touched buffer to submit. Reviewed-by: Vasily Khoruzhick <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
-rw-r--r--src/gallium/drivers/lima/lima_draw.c49
1 files changed, 27 insertions, 22 deletions
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;
}