diff options
author | Qiang Yu <[email protected]> | 2020-02-07 19:43:10 +0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-17 02:54:15 +0000 |
commit | 131c50569066152a8e90b948b0873b990d748e98 (patch) | |
tree | b1d3b735d2173d972e3faea7141b319eef797ddb /src/gallium/drivers | |
parent | d6ad8e590f27ce0413389f6274fa05106d45dba1 (diff) |
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 <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/lima/lima_draw.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_submit.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_submit.h | 8 |
3 files changed, 16 insertions, 3 deletions
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); |