From 5eb9128a52cfd8f84cdf7aa74c2d26fb7e4dc303 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Fri, 5 Apr 2024 13:14:39 +0200 Subject: [PATCH] etnaviv: rs: take src dimensions into account when increasing height alignment When trying to increase the height alignment to unlock multi-pipe resolve for better performance we need to be careful to not overstep the source dimensions as this would cause the blit to be rejected. Do so and also rearrange the code a bit to make it more obvious what is being done. Fixes: 797454edfcc4 ("etnaviv: rs: fix blits with insufficient alignment for dual pipe operation") Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: (cherry picked from commit 2964812aacb5e88713572753d911068be0b5d3de) --- .pick_status.json | 2 +- src/gallium/drivers/etnaviv/etnaviv_rs.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index b4aff88967f..7320d711721 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -924,7 +924,7 @@ "description": "etnaviv: rs: take src dimensions into account when increasing height alignment", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "797454edfcc4d2a6d0c21db451e9a0ea6e0a8023", "notes": null diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c b/src/gallium/drivers/etnaviv/etnaviv_rs.c index 0d07b845172..5e11bd95ee0 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_rs.c +++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c @@ -711,12 +711,17 @@ etna_try_rs_blit(struct pipe_context *pctx, width = align(width, w_align); if (height & (h_align - 1) && height >= src_lev->height * src_yscale && height >= dst_lev->height) { - if (!ctx->screen->specs.single_buffer && - align(height, h_align * ctx->screen->specs.pixel_pipes) <= - dst_lev->padded_height * src_yscale) - height = align(height, h_align * ctx->screen->specs.pixel_pipes); - else - height = align(height, h_align); + height = align(height, h_align); + + /* Try to increase alignment to multi-pipe requirements to unlock + * multi-pipe resolve for increased performance. */ + if (!ctx->screen->specs.single_buffer) { + unsigned int pipe_align = align(height, h_align * ctx->screen->specs.pixel_pipes); + + if (pipe_align <= src_lev->padded_height && + pipe_align <= dst_lev->padded_height * src_yscale) + height = pipe_align; + } } /* The padded dimensions are in samples */