damage_rect is preserved across draws.
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
ctx->base.stream_uploader = ctx->uploader;
ctx->base.const_uploader = ctx->uploader;
- ctx->damage_rect.minx = ctx->damage_rect.miny = 0xffff;
- ctx->damage_rect.maxx = ctx->damage_rect.maxy = 0;
-
ctx->plb_size = screen->plb_max_blk * LIMA_CTX_PLB_BLK_SIZE;
ctx->plb_gp_size = screen->plb_max_blk * 4;
struct lima_context_framebuffer framebuffer;
struct lima_context_viewport_state viewport;
struct pipe_scissor_state scissor;
- struct pipe_scissor_state damage_rect;
struct lima_context_clear clear;
struct lima_vs_shader_state *vs;
struct lima_fs_shader_state *fs;
}
static void
-lima_damage_rect_union(struct lima_context *ctx, unsigned minx, unsigned maxx, unsigned miny, unsigned maxy)
+lima_damage_rect_union(struct pipe_scissor_state *rect,
+ unsigned minx, unsigned maxx,
+ unsigned miny, unsigned maxy)
{
- ctx->damage_rect.minx = MIN2(ctx->damage_rect.minx, minx);
- ctx->damage_rect.miny = MIN2(ctx->damage_rect.miny, miny);
- ctx->damage_rect.maxx = MAX2(ctx->damage_rect.maxx, maxx);
- ctx->damage_rect.maxy = MAX2(ctx->damage_rect.maxy, maxy);
+ rect->minx = MIN2(rect->minx, minx);
+ rect->miny = MIN2(rect->miny, miny);
+ rect->maxx = MAX2(rect->maxx, maxx);
+ rect->maxy = MAX2(rect->maxy, maxy);
}
static void
surf->reload = false;
}
+ struct lima_submit *submit = lima_submit_get(ctx);
struct lima_context_clear *clear = &ctx->clear;
clear->buffers = buffers;
ctx->dirty |= LIMA_CONTEXT_DIRTY_CLEAR;
- lima_damage_rect_union(ctx, 0, ctx->framebuffer.base.width,
- 0, ctx->framebuffer.base.height);
+ lima_damage_rect_union(&submit->damage_rect,
+ 0, ctx->framebuffer.base.width,
+ 0, ctx->framebuffer.base.height);
}
enum lima_attrib_type {
maxy = MIN2(maxy, ctx->viewport.top);
PLBU_CMD_SCISSORS(minx, maxx, miny, maxy);
- lima_damage_rect_union(ctx, minx, maxx, miny, maxy);
+ lima_damage_rect_union(&submit->damage_rect, minx, maxx, miny, maxy);
PLBU_CMD_UNKNOWN1();
s->fd = lima_screen(ctx->base.screen)->fd;
s->ctx = ctx;
+ s->damage_rect.minx = s->damage_rect.miny = 0xffff;
+ s->damage_rect.maxx = s->damage_rect.maxy = 0;
+
for (int i = 0; i < 2; i++) {
util_dynarray_init(s->gem_bos + i, s);
util_dynarray_init(s->bos + i, s);
struct lima_damage_region *ds = lima_submit_get_damage(submit);
struct lima_context_framebuffer *fb = &ctx->framebuffer;
struct pipe_scissor_state bound;
+ struct pipe_scissor_state *dr = &submit->damage_rect;
if (ds && ds->region) {
struct pipe_scissor_state *dbound = &ds->bound;
- bound.minx = MAX2(dbound->minx, ctx->damage_rect.minx >> 4);
- bound.miny = MAX2(dbound->miny, ctx->damage_rect.miny >> 4);
- bound.maxx = MIN2(dbound->maxx, (ctx->damage_rect.maxx + 0xf) >> 4);
- bound.maxy = MIN2(dbound->maxy, (ctx->damage_rect.maxy + 0xf) >> 4);
+ bound.minx = MAX2(dbound->minx, dr->minx >> 4);
+ bound.miny = MAX2(dbound->miny, dr->miny >> 4);
+ bound.maxx = MIN2(dbound->maxx, (dr->maxx + 0xf) >> 4);
+ bound.maxy = MIN2(dbound->maxy, (dr->maxy + 0xf) >> 4);
} else {
- bound.minx = ctx->damage_rect.minx >> 4;
- bound.miny = ctx->damage_rect.miny >> 4;
- bound.maxx = (ctx->damage_rect.maxx + 0xf) >> 4;
- bound.maxy = (ctx->damage_rect.maxy + 0xf) >> 4;
+ bound.minx = dr->minx >> 4;
+ bound.miny = dr->miny >> 4;
+ bound.maxx = (dr->maxx + 0xf) >> 4;
+ bound.maxy = (dr->maxy + 0xf) >> 4;
}
/* Clamp to FB size */
lima_damage_fullscreen(struct lima_submit *submit)
{
struct lima_context *ctx = submit->ctx;
+ struct pipe_scissor_state *dr = &submit->damage_rect;
- return ctx->damage_rect.minx == 0 &&
- ctx->damage_rect.miny == 0 &&
- ctx->damage_rect.maxx == ctx->framebuffer.base.width &&
- ctx->damage_rect.maxy == ctx->framebuffer.base.height;
+ return dr->minx == 0 &&
+ dr->miny == 0 &&
+ dr->maxx == ctx->framebuffer.base.width &&
+ dr->maxy == ctx->framebuffer.base.height;
}
static void
surf->reload = true;
}
- ctx->damage_rect.minx = ctx->damage_rect.miny = 0xffff;
- ctx->damage_rect.maxx = ctx->damage_rect.maxy = 0;
-
lima_dump_file_next();
if (ctx->submit == submit)
#include <util/u_dynarray.h>
+#include <pipe/p_state.h>
+
struct lima_context;
struct lima_bo;
struct pipe_surface;
unsigned resolve;
int pp_max_stack_size;
+
+ struct pipe_scissor_state damage_rect;
};
struct lima_submit *lima_submit_get(struct lima_context *ctx);