Commit 665f2850 authored by Aric Cyr's avatar Aric Cyr Committed by Alex Deucher

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: default avatarAric Cyr <aric.cyr@amd.com>
Reviewed-by: default avatarKrunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: default avatarStylon Wang <stylon.wang@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e4e36782
...@@ -799,6 +799,11 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx) ...@@ -799,6 +799,11 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx)
if (split_idx == split_count) { if (split_idx == split_count) {
/* rightmost pipe is the remainder recout */ /* rightmost pipe is the remainder recout */
data->recout.width -= data->h_active * split_count - data->recout.x; 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; data->recout.x = 0;
} else } else
data->recout.width = data->h_active - data->recout.x; data->recout.width = data->h_active - data->recout.x;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment