lima: move pp_max_stack_size to lima_submit

pp_max_stack_size 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:
Qiang Yu
2020-02-04 21:35:33 +08:00
committed by Marge Bot
parent 6a5b1c62db
commit a4b048c046
4 changed files with 12 additions and 12 deletions

View File

@@ -248,8 +248,6 @@ struct lima_context {
struct pipe_debug_callback debug; struct pipe_debug_callback debug;
int pp_max_stack_size;
unsigned index_offset; unsigned index_offset;
struct lima_resource *index_res; struct lima_resource *index_res;
}; };

View File

@@ -34,6 +34,7 @@
#include "lima_screen.h" #include "lima_screen.h"
#include "lima_context.h" #include "lima_context.h"
#include "lima_submit.h"
#include "lima_program.h" #include "lima_program.h"
#include "lima_bo.h" #include "lima_bo.h"
#include "ir/lima_ir.h" #include "ir/lima_ir.h"
@@ -349,7 +350,8 @@ lima_update_fs_state(struct lima_context *ctx)
fs->shader = NULL; 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; return true;
} }

View File

@@ -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, /* These are "stack size" and "stack offset" shifted,
* here they are assumed to be always the same. */ * 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 */ /* related with MSAA and different value when r4p0/r7p0 */
frame->supersampled_height = fb->base.height * 2 - 1; 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; uint32_t pp_stack_va = 0;
if (ctx->pp_max_stack_size) { if (submit->pp_max_stack_size) {
lima_submit_create_stream_bo( lima_submit_create_stream_bo(
submit, LIMA_PIPE_PP, 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); &pp_stack_va);
} }
@@ -864,9 +864,9 @@ lima_do_submit(struct lima_submit *submit)
for (int i = 0; i < screen->num_pp; i++) { for (int i = 0; i < screen->num_pp; i++) {
pp_frame.plbu_array_address[i] = ps->va + ps->offset[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 + 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( 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); lima_pack_pp_frame_reg(submit, pp_frame.frame, pp_frame.wb);
pp_frame.num_pp = screen->num_pp; 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++) for (int i = 0; i < screen->num_pp; i++)
pp_frame.fragment_stack_address[i] = pp_stack_va + 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) { if (ps->map) {
for (int i = 0; i < screen->num_pp; i++) for (int i = 0; i < screen->num_pp; i++)
@@ -922,8 +922,6 @@ lima_do_submit(struct lima_submit *submit)
surf->reload = true; surf->reload = true;
} }
ctx->pp_max_stack_size = 0;
ctx->damage_rect.minx = ctx->damage_rect.miny = 0xffff; ctx->damage_rect.minx = ctx->damage_rect.miny = 0xffff;
ctx->damage_rect.maxx = ctx->damage_rect.maxy = 0; ctx->damage_rect.maxx = ctx->damage_rect.maxy = 0;

View File

@@ -52,6 +52,8 @@ struct lima_submit {
struct util_dynarray plbu_cmd_head; struct util_dynarray plbu_cmd_head;
unsigned resolve; unsigned resolve;
int pp_max_stack_size;
}; };
struct lima_submit *lima_submit_get(struct lima_context *ctx); struct lima_submit *lima_submit_get(struct lima_context *ctx);