drmIoctl(screen->fd, DRM_IOCTL_LIMA_CTX_FREE, &req);
}
+static void
+lima_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
+{
+ struct lima_context *ctx = lima_context(pctx);
+
+ if (ctx->framebuffer.base.zsbuf && (ctx->framebuffer.base.zsbuf->texture == prsc))
+ ctx->resolve &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL);
+
+ if (ctx->framebuffer.base.nr_cbufs &&
+ (ctx->framebuffer.base.cbufs[0]->texture == prsc))
+ ctx->resolve &= ~PIPE_CLEAR_COLOR0;
+}
+
static void
lima_context_destroy(struct pipe_context *pctx)
{
ctx->base.screen = pscreen;
ctx->base.destroy = lima_context_destroy;
ctx->base.set_debug_callback = lima_set_debug_callback;
+ ctx->base.invalidate_resource = lima_invalidate_resource;
lima_resource_context_init(ctx);
lima_fence_context_init(ctx);
return lima_submit_has_bo(ctx->gp_submit, bo, write) ||
lima_submit_has_bo(ctx->pp_submit, bo, write);
}
-
-bool
-lima_is_scanout(struct lima_context *ctx)
-{
- /* If there is no color buffer, it's an FBO */
- if (!ctx->framebuffer.base.nr_cbufs)
- return false;
-
- return ctx->framebuffer.base.cbufs[0]->texture->bind & PIPE_BIND_DISPLAY_TARGET ||
- ctx->framebuffer.base.cbufs[0]->texture->bind & PIPE_BIND_SCANOUT ||
- ctx->framebuffer.base.cbufs[0]->texture->bind & PIPE_BIND_SHARED;
-}
LIMA_CONTEXT_DIRTY_TEXTURES = (1 << 14),
} dirty;
+ unsigned resolve;
+
struct u_upload_mgr *uploader;
struct blitter_context *blitter;
lima_flush(ctx);
+ ctx->resolve |= buffers;
+
/* no need to reload if cleared */
if (ctx->framebuffer.base.nr_cbufs && (buffers & PIPE_CLEAR_COLOR0)) {
struct lima_surface *surf = lima_surface(ctx->framebuffer.base.cbufs[0]);
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;
}
frame->blocking = (fb->shift_min << 28) | (fb->shift_h << 16) | fb->shift_w;
frame->foureight = 0x8888;
- if (fb->base.nr_cbufs)
+ if (fb->base.nr_cbufs && (ctx->resolve & PIPE_CLEAR_COLOR0))
lima_pack_wb_cbuf_reg(ctx, wb_reg, wb_idx++);
- /* Mali4x0 can use on-tile buffer for depth/stencil, so to save some
- * memory bandwidth don't write depth/stencil back to memory if we're
- * rendering to scanout
- */
- if (!lima_is_scanout(ctx) && fb->base.zsbuf)
+ if (fb->base.zsbuf &&
+ (ctx->resolve & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)))
lima_pack_wb_zsbuf_reg(ctx, wb_reg, wb_idx++);
}
ctx->damage_rect.minx = ctx->damage_rect.miny = 0xffff;
ctx->damage_rect.maxx = ctx->damage_rect.maxy = 0;
+ ctx->resolve = 0;
+
lima_dump_file_next();
}