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: 797454edfc ("etnaviv: rs: fix blits with insufficient alignment for dual pipe operation")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28598>
(cherry picked from commit 2964812aac)
This commit is contained in:
Lucas Stach 2024-04-05 13:14:39 +02:00 committed by Eric Engestrom
parent a6aa5d30d7
commit 5eb9128a52
2 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -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 */