Skip to content

Commit 665f285

Browse files
AMD-aricalexdeucher
authored andcommitted
drm/amd/display: Fix crash during MPO + ODM combine mode recalculation
[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>
1 parent e4e3678 commit 665f285

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,11 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx)
799799
if (split_idx == split_count) {
800800
/* rightmost pipe is the remainder recout */
801801
data->recout.width -= data->h_active * split_count - data->recout.x;
802+
803+
/* ODM combine cases with MPO we can get negative widths */
804+
if (data->recout.width < 0)
805+
data->recout.width = 0;
806+
802807
data->recout.x = 0;
803808
} else
804809
data->recout.width = data->h_active - data->recout.x;

0 commit comments

Comments
 (0)