summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorQiang Yu <[email protected]>2020-02-04 22:52:59 +0800
committerMarge Bot <[email protected]>2020-02-17 02:54:15 +0000
commit4b93792274f363983949502315ca693a83fdfb56 (patch)
treec1c00ec9adf4a1de0ff07b611e24d1b00d3d7360 /src/gallium/drivers
parenta4b048c046cc4861d9ce7da94eeaeca341b7e2f5 (diff)
lima: move damage_rect into lima_submit
damage_rect is preserved across draws. Reviewed-by: Vasily Khoruzhick <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/lima/lima_context.c3
-rw-r--r--src/gallium/drivers/lima/lima_context.h1
-rw-r--r--src/gallium/drivers/lima/lima_draw.c20
-rw-r--r--src/gallium/drivers/lima/lima_submit.c32
-rw-r--r--src/gallium/drivers/lima/lima_submit.h4
5 files changed, 33 insertions, 27 deletions
diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c
index 3093c9b6f0a..f1b1bf64b2b 100644
--- a/src/gallium/drivers/lima/lima_context.c
+++ b/src/gallium/drivers/lima/lima_context.c
@@ -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;
diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h
index 320f6f2a60c..fa10b041df2 100644
--- a/src/gallium/drivers/lima/lima_context.h
+++ b/src/gallium/drivers/lima/lima_context.h
@@ -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;
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index ae0220bf9ff..6e6d539e867 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -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();
diff --git a/src/gallium/drivers/lima/lima_submit.c b/src/gallium/drivers/lima/lima_submit.c
index 719f0627a30..e1c96437006 100644
--- a/src/gallium/drivers/lima/lima_submit.c
+++ b/src/gallium/drivers/lima/lima_submit.c
@@ -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)
diff --git a/src/gallium/drivers/lima/lima_submit.h b/src/gallium/drivers/lima/lima_submit.h
index a541296fa21..32b9637b3de 100644
--- a/src/gallium/drivers/lima/lima_submit.h
+++ b/src/gallium/drivers/lima/lima_submit.h
@@ -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);