mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
lima: move damage_rect into lima_submit
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>
This commit is contained in:
parent
a4b048c046
commit
4b93792274
5 changed files with 33 additions and 27 deletions
|
|
@ -227,9 +227,6 @@ lima_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ struct lima_context {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -87,12 +87,14 @@ lima_update_submit_wb(struct lima_context *ctx, unsigned buffers)
|
|||
}
|
||||
|
||||
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
|
||||
|
|
@ -111,6 +113,7 @@ lima_clear(struct pipe_context *pctx, unsigned buffers,
|
|||
surf->reload = false;
|
||||
}
|
||||
|
||||
struct lima_submit *submit = lima_submit_get(ctx);
|
||||
struct lima_context_clear *clear = &ctx->clear;
|
||||
clear->buffers = buffers;
|
||||
|
||||
|
|
@ -136,8 +139,9 @@ lima_clear(struct pipe_context *pctx, unsigned 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 {
|
||||
|
|
@ -316,7 +320,7 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
|
|||
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();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ lima_submit_create(struct lima_context *ctx)
|
|||
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);
|
||||
|
|
@ -544,18 +547,19 @@ lima_update_damage_pp_stream(struct lima_submit *submit)
|
|||
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 */
|
||||
|
|
@ -617,11 +621,12 @@ static bool
|
|||
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
|
||||
|
|
@ -922,9 +927,6 @@ lima_do_submit(struct lima_submit *submit)
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <util/u_dynarray.h>
|
||||
|
||||
#include <pipe/p_state.h>
|
||||
|
||||
struct lima_context;
|
||||
struct lima_bo;
|
||||
struct pipe_surface;
|
||||
|
|
@ -54,6 +56,8 @@ struct lima_submit {
|
|||
unsigned resolve;
|
||||
|
||||
int pp_max_stack_size;
|
||||
|
||||
struct pipe_scissor_state damage_rect;
|
||||
};
|
||||
|
||||
struct lima_submit *lima_submit_get(struct lima_context *ctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue