From: Qiang Yu Date: Fri, 7 Feb 2020 11:43:10 +0000 (+0800) Subject: lima: optinal flush submit in lima_clear X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=131c50569066152a8e90b948b0873b990d748e98;p=mesa.git 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 Signed-off-by: Qiang Yu Part-of: --- diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 0b1e1f763c8..3b53bdac1d3 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -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; diff --git a/src/gallium/drivers/lima/lima_submit.c b/src/gallium/drivers/lima/lima_submit.c index d4432037d72..85c28d33776 100644 --- a/src/gallium/drivers/lima/lima_submit.c +++ b/src/gallium/drivers/lima/lima_submit.c @@ -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 diff --git a/src/gallium/drivers/lima/lima_submit.h b/src/gallium/drivers/lima/lima_submit.h index 538ccfd9aff..87b5aeccf6a 100644 --- a/src/gallium/drivers/lima/lima_submit.h +++ b/src/gallium/drivers/lima/lima_submit.h @@ -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);