From a4b048c046cc4861d9ce7da94eeaeca341b7e2f5 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Tue, 4 Feb 2020 21:35:33 +0800 Subject: [PATCH] lima: move pp_max_stack_size to lima_submit pp_max_stack_size is preserved across draws. Reviewed-by: Vasily Khoruzhick Signed-off-by: Qiang Yu Part-of: --- src/gallium/drivers/lima/lima_context.h | 2 -- src/gallium/drivers/lima/lima_program.c | 4 +++- src/gallium/drivers/lima/lima_submit.c | 16 +++++++--------- src/gallium/drivers/lima/lima_submit.h | 2 ++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h index 35717d22d0f..320f6f2a60c 100644 --- a/src/gallium/drivers/lima/lima_context.h +++ b/src/gallium/drivers/lima/lima_context.h @@ -248,8 +248,6 @@ struct lima_context { struct pipe_debug_callback debug; - int pp_max_stack_size; - unsigned index_offset; struct lima_resource *index_res; }; diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c index 9b9796d588b..5a743130c51 100644 --- a/src/gallium/drivers/lima/lima_program.c +++ b/src/gallium/drivers/lima/lima_program.c @@ -34,6 +34,7 @@ #include "lima_screen.h" #include "lima_context.h" +#include "lima_submit.h" #include "lima_program.h" #include "lima_bo.h" #include "ir/lima_ir.h" @@ -349,7 +350,8 @@ lima_update_fs_state(struct lima_context *ctx) fs->shader = NULL; } - ctx->pp_max_stack_size = MAX2(ctx->pp_max_stack_size, ctx->fs->stack_size); + struct lima_submit *submit = lima_submit_get(ctx); + submit->pp_max_stack_size = MAX2(submit->pp_max_stack_size, ctx->fs->stack_size); return true; } diff --git a/src/gallium/drivers/lima/lima_submit.c b/src/gallium/drivers/lima/lima_submit.c index 15f4e01bc9e..719f0627a30 100644 --- a/src/gallium/drivers/lima/lima_submit.c +++ b/src/gallium/drivers/lima/lima_submit.c @@ -751,7 +751,7 @@ lima_pack_pp_frame_reg(struct lima_submit *submit, uint32_t *frame_reg, /* These are "stack size" and "stack offset" shifted, * here they are assumed to be always the same. */ - frame->fragment_stack_size = ctx->pp_max_stack_size << 16 | ctx->pp_max_stack_size; + frame->fragment_stack_size = submit->pp_max_stack_size << 16 | submit->pp_max_stack_size; /* related with MSAA and different value when r4p0/r7p0 */ frame->supersampled_height = fb->base.height * 2 - 1; @@ -847,10 +847,10 @@ lima_do_submit(struct lima_submit *submit) } uint32_t pp_stack_va = 0; - if (ctx->pp_max_stack_size) { + if (submit->pp_max_stack_size) { lima_submit_create_stream_bo( submit, LIMA_PIPE_PP, - screen->num_pp * ctx->pp_max_stack_size * pp_stack_pp_size, + screen->num_pp * submit->pp_max_stack_size * pp_stack_pp_size, &pp_stack_va); } @@ -864,9 +864,9 @@ lima_do_submit(struct lima_submit *submit) for (int i = 0; i < screen->num_pp; i++) { pp_frame.plbu_array_address[i] = ps->va + ps->offset[i]; - if (ctx->pp_max_stack_size) + if (submit->pp_max_stack_size) pp_frame.fragment_stack_address[i] = pp_stack_va + - ctx->pp_max_stack_size * pp_stack_pp_size * i; + submit->pp_max_stack_size * pp_stack_pp_size * i; } lima_dump_command_stream_print( @@ -880,10 +880,10 @@ lima_do_submit(struct lima_submit *submit) lima_pack_pp_frame_reg(submit, pp_frame.frame, pp_frame.wb); pp_frame.num_pp = screen->num_pp; - if (ctx->pp_max_stack_size) + if (submit->pp_max_stack_size) for (int i = 0; i < screen->num_pp; i++) pp_frame.fragment_stack_address[i] = pp_stack_va + - ctx->pp_max_stack_size * pp_stack_pp_size * i; + submit->pp_max_stack_size * pp_stack_pp_size * i; if (ps->map) { for (int i = 0; i < screen->num_pp; i++) @@ -922,8 +922,6 @@ lima_do_submit(struct lima_submit *submit) surf->reload = true; } - ctx->pp_max_stack_size = 0; - ctx->damage_rect.minx = ctx->damage_rect.miny = 0xffff; ctx->damage_rect.maxx = ctx->damage_rect.maxy = 0; diff --git a/src/gallium/drivers/lima/lima_submit.h b/src/gallium/drivers/lima/lima_submit.h index 5aafff8bf9a..a541296fa21 100644 --- a/src/gallium/drivers/lima/lima_submit.h +++ b/src/gallium/drivers/lima/lima_submit.h @@ -52,6 +52,8 @@ struct lima_submit { struct util_dynarray plbu_cmd_head; unsigned resolve; + + int pp_max_stack_size; }; struct lima_submit *lima_submit_get(struct lima_context *ctx); -- 2.30.2