lima: optinal flush submit in lima_clear

flush current submit only when there is any draw pending instead of
flush all submits.

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-07 19:43:10 +08:00 committed by Marge Bot
parent d6ad8e590f
commit 131c505690
3 changed files with 16 additions and 3 deletions

View file

@ -102,8 +102,14 @@ lima_clear(struct pipe_context *pctx, unsigned buffers,
const union pipe_color_union *color, double depth, unsigned stencil)
{
struct lima_context *ctx = lima_context(pctx);
struct lima_submit *submit = lima_submit_get(ctx);
lima_flush(ctx);
/* flush if this submit already contains any draw, otherwise multi clear can be
* combined into a single submit */
if (lima_submit_has_draw_pending(submit)) {
lima_do_submit(submit);
submit = lima_submit_get(ctx);
}
lima_update_submit_wb(ctx, buffers);
@ -113,7 +119,6 @@ lima_clear(struct pipe_context *pctx, unsigned buffers,
surf->reload = false;
}
struct lima_submit *submit = lima_submit_get(ctx);
struct lima_submit_clear *clear = &submit->clear;
clear->buffers = buffers;

View file

@ -815,7 +815,7 @@ lima_pack_pp_frame_reg(struct lima_submit *submit, uint32_t *frame_reg,
lima_pack_wb_zsbuf_reg(submit, wb_reg, wb_idx++);
}
static void
void
lima_do_submit(struct lima_submit *submit)
{
#define pp_stack_pp_size 0x400

View file

@ -84,6 +84,12 @@ struct lima_submit {
struct lima_dump *dump;
};
static inline bool
lima_submit_has_draw_pending(struct lima_submit *submit)
{
return !!submit->plbu_cmd_array.size;
}
struct lima_submit *lima_submit_get(struct lima_context *ctx);
bool lima_submit_add_bo(struct lima_submit *submit, int pipe,
@ -91,6 +97,8 @@ bool lima_submit_add_bo(struct lima_submit *submit, int pipe,
void *lima_submit_create_stream_bo(struct lima_submit *submit, int pipe,
unsigned size, uint32_t *va);
void lima_do_submit(struct lima_submit *submit);
bool lima_submit_init(struct lima_context *ctx);
void lima_submit_fini(struct lima_context *ctx);