Skip to content

Commit

Permalink
drm/amd/display: Fix crash during MPO + ODM combine mode recalculation
Browse files Browse the repository at this point in the history
[ Upstream commit 665f285 ]

[Why]
When calculating recout width for an MPO plane on a mode that's using
ODM combine, driver can calculate a negative value, resulting in a
crash.

[How]
For negative widths, use zero such that validation will prune the
configuration correctly and disallow MPO.

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
AMD-aric authored and gregkh committed Jul 19, 2021
1 parent caef3b9 commit 3df8a15
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/amd/display/dc/core/dc_resource.c
Expand Up @@ -776,6 +776,11 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx)
if (split_idx == split_count) {
/* rightmost pipe is the remainder recout */
data->recout.width -= data->h_active * split_count - data->recout.x;

/* ODM combine cases with MPO we can get negative widths */
if (data->recout.width < 0)
data->recout.width = 0;

data->recout.x = 0;
} else
data->recout.width = data->h_active - data->recout.x;
Expand Down

0 comments on commit 3df8a15

Please sign in to comment.