}
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
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)) {
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);
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;
}