Prepare for multi submit in which case only know the plb_index when
final flush. Another need for this is proper reload detection: only
when flush stage can we know if need to do reload, because user may
first clear depth, then color individually, so we don't know if need
to pack repload plbu cmd when first clear depth.
v2:
move lima_update_submit_wb before ctx->resolve change for lima_ctx_dirty
to work in lima_submit_wb.
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>
util_dynarray_init(&ctx->vs_cmd_array, ctx);
util_dynarray_init(&ctx->plbu_cmd_array, ctx);
util_dynarray_init(&ctx->vs_cmd_array, ctx);
util_dynarray_init(&ctx->plbu_cmd_array, ctx);
+ util_dynarray_init(&ctx->plbu_cmd_head, ctx);
ctx->plb_size = screen->plb_max_blk * LIMA_CTX_PLB_BLK_SIZE;
ctx->plb_gp_size = screen->plb_max_blk * 4;
ctx->plb_size = screen->plb_max_blk * LIMA_CTX_PLB_BLK_SIZE;
ctx->plb_gp_size = screen->plb_max_blk * 4;
struct util_dynarray vs_cmd_array;
struct util_dynarray plbu_cmd_array;
struct util_dynarray vs_cmd_array;
struct util_dynarray plbu_cmd_array;
+ struct util_dynarray plbu_cmd_head;
struct lima_submit *gp_submit;
struct lima_submit *pp_submit;
struct lima_submit *gp_submit;
struct lima_submit *pp_submit;
static inline bool
lima_ctx_dirty(struct lima_context *ctx)
{
static inline bool
lima_ctx_dirty(struct lima_context *ctx)
{
- return ctx->plbu_cmd_array.size;
}
static inline struct lima_damage_region *
}
static inline struct lima_damage_region *
lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_READ);
pipe_resource_reference(&pres, NULL);
lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_READ);
pipe_resource_reference(&pres, NULL);
- PLBU_CMD_BEGIN(&ctx->plbu_cmd_array, 20);
+ PLBU_CMD_BEGIN(&ctx->plbu_cmd_head, 20);
PLBU_CMD_VIEWPORT_LEFT(0);
PLBU_CMD_VIEWPORT_RIGHT(fui(fb->base.width));
PLBU_CMD_VIEWPORT_LEFT(0);
PLBU_CMD_VIEWPORT_RIGHT(fui(fb->base.width));
static void
lima_pack_head_plbu_cmd(struct lima_context *ctx)
{
static void
lima_pack_head_plbu_cmd(struct lima_context *ctx)
{
- /* first draw need create a PLBU command header */
- if (lima_ctx_dirty(ctx))
- return;
-
struct lima_context_framebuffer *fb = &ctx->framebuffer;
struct lima_context_framebuffer *fb = &ctx->framebuffer;
- PLBU_CMD_BEGIN(&ctx->plbu_cmd_array, 10);
+ PLBU_CMD_BEGIN(&ctx->plbu_cmd_head, 10);
PLBU_CMD_UNKNOWN2();
PLBU_CMD_BLOCK_STEP(fb->shift_min, fb->shift_h, fb->shift_w);
PLBU_CMD_UNKNOWN2();
PLBU_CMD_BLOCK_STEP(fb->shift_min, fb->shift_h, fb->shift_w);
+ lima_update_submit_wb(ctx);
+
ctx->resolve |= buffers;
/* no need to reload if cleared */
ctx->resolve |= buffers;
/* no need to reload if cleared */
if (buffers & PIPE_CLEAR_STENCIL)
clear->stencil = stencil;
if (buffers & PIPE_CLEAR_STENCIL)
clear->stencil = stencil;
- lima_update_submit_wb(ctx);
-
- lima_pack_head_plbu_cmd(ctx);
-
ctx->dirty |= LIMA_CONTEXT_DIRTY_CLEAR;
lima_damage_rect_union(ctx, 0, ctx->framebuffer.base.width,
ctx->dirty |= LIMA_CONTEXT_DIRTY_CLEAR;
lima_damage_rect_union(ctx, 0, ctx->framebuffer.base.width,
struct lima_vs_shader_state *vs = ctx->vs;
unsigned minx, maxx, miny, maxy;
struct lima_vs_shader_state *vs = ctx->vs;
unsigned minx, maxx, miny, maxy;
- lima_pack_head_plbu_cmd(ctx);
-
/* If it's zero scissor, we skip adding all other commands */
if (lima_is_scissor_zero(ctx))
return;
/* If it's zero scissor, we skip adding all other commands */
if (lima_is_scissor_zero(ctx))
return;
{
#define pp_stack_pp_size 0x400
{
#define pp_stack_pp_size 0x400
+ lima_pack_head_plbu_cmd(ctx);
lima_finish_plbu_cmd(ctx);
lima_update_submit_bo(ctx);
int vs_cmd_size = ctx->vs_cmd_array.size;
lima_finish_plbu_cmd(ctx);
lima_update_submit_bo(ctx);
int vs_cmd_size = ctx->vs_cmd_array.size;
- int plbu_cmd_size = ctx->plbu_cmd_array.size;
if (vs_cmd_size) {
void *vs_cmd =
if (vs_cmd_size) {
void *vs_cmd =
lima_dump_vs_command_stream_print(vs_cmd, vs_cmd_size, vs_cmd_va);
}
lima_dump_vs_command_stream_print(vs_cmd, vs_cmd_size, vs_cmd_va);
}
+ int plbu_cmd_size = ctx->plbu_cmd_array.size + ctx->plbu_cmd_head.size;
void *plbu_cmd =
lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_plbu_cmd, plbu_cmd_size);
void *plbu_cmd =
lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_plbu_cmd, plbu_cmd_size);
- memcpy(plbu_cmd, util_dynarray_begin(&ctx->plbu_cmd_array), plbu_cmd_size);
+ memcpy(plbu_cmd,
+ util_dynarray_begin(&ctx->plbu_cmd_head),
+ ctx->plbu_cmd_head.size);
+ memcpy(plbu_cmd + ctx->plbu_cmd_head.size,
+ util_dynarray_begin(&ctx->plbu_cmd_array),
+ ctx->plbu_cmd_array.size);
util_dynarray_clear(&ctx->plbu_cmd_array);
util_dynarray_clear(&ctx->plbu_cmd_array);
- plbu_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_plbu_cmd);
+ util_dynarray_clear(&ctx->plbu_cmd_head);
+ uint32_t plbu_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_plbu_cmd);
lima_dump_command_stream_print(
plbu_cmd, plbu_cmd_size, false, "flush plbu cmd at va %x\n", plbu_cmd_va);
lima_dump_command_stream_print(
plbu_cmd, plbu_cmd_size, false, "flush plbu cmd at va %x\n", plbu_cmd_va);