From 83abdf8e4518a40dc0c74f7c85d7e9a6d76ce7a5 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Wed, 9 Oct 2019 19:20:02 -0700 Subject: [PATCH] lima: postpone PP stream generation This commit postpones PP stream generation till job is submitted. Doing that this late allows us to skip reloading and redrawing tiles that were not updated. Reviewed-by: Qiang Yu Signed-off-by: Vasily Khoruzhick --- src/gallium/drivers/lima/lima_draw.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 5fb846c7b7a..4fb2e12cd12 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -460,7 +460,7 @@ inside_damage_region(int x, int y, struct lima_damage_region *ds) } static void -lima_update_pp_stream(struct lima_context *ctx, int off_x, int off_y, +lima_generate_pp_stream(struct lima_context *ctx, int off_x, int off_y, int tiled_w, int tiled_h) { struct lima_pp_stream_state *ps = &ctx->pp_stream; @@ -539,7 +539,7 @@ lima_update_damage_pp_stream(struct lima_context *ctx) ctx->pp_stream.bo = res->bo; ctx->pp_stream.bo_offset = offset; - lima_update_pp_stream(ctx, bound->minx, bound->miny, tiled_w, tiled_h); + lima_generate_pp_stream(ctx, bound->minx, bound->miny, tiled_w, tiled_h); lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_READ); pipe_resource_reference(&pres, NULL); @@ -575,12 +575,24 @@ lima_update_full_pp_stream(struct lima_context *ctx) ctx->pp_stream.bo_offset = 0; memcpy(ctx->pp_stream.offset, s->offset, sizeof(s->offset)); - lima_update_pp_stream(ctx, 0, 0, fb->tiled_w, fb->tiled_h); + lima_generate_pp_stream(ctx, 0, 0, fb->tiled_w, fb->tiled_h); } lima_submit_add_bo(ctx->pp_submit, s->bo, LIMA_SUBMIT_BO_READ); } +static void +lima_update_pp_stream(struct lima_context *ctx) +{ + struct lima_damage_region *damage = lima_ctx_get_damage(ctx); + if (damage && damage->region) + lima_update_damage_pp_stream(ctx); + else if (ctx->plb_pp_stream) + lima_update_full_pp_stream(ctx); + else + ctx->pp_stream.bo = NULL; +} + static void lima_update_submit_bo(struct lima_context *ctx) { @@ -597,14 +609,6 @@ lima_update_submit_bo(struct lima_context *ctx) ctx->plb_gp_size, false, "gp plb stream at va %x\n", ctx->plb_gp_stream->va + ctx->plb_index * ctx->plb_gp_size); - struct lima_damage_region *damage = lima_ctx_get_damage(ctx); - if (damage && damage->region) - lima_update_damage_pp_stream(ctx); - else if (ctx->plb_pp_stream) - lima_update_full_pp_stream(ctx); - else - ctx->pp_stream.bo = NULL; - if (ctx->framebuffer.base.nr_cbufs) { struct lima_resource *res = lima_resource(ctx->framebuffer.base.cbufs[0]->texture); lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_WRITE); @@ -1644,6 +1648,8 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame) LIMA_CTX_BUFF_SUBMIT_PP); } + lima_update_pp_stream(ctx); + struct lima_pp_stream_state *ps = &ctx->pp_stream; if (screen->gpu_type == DRM_LIMA_PARAM_GPU_ID_MALI400) { struct drm_lima_m400_pp_frame pp_frame = {0}; -- 2.30.2