diff options
author | Aric Cyr <[email protected]> | 2021-05-25 15:33:51 -0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2021-06-08 12:23:28 -0400 |
commit | 665f28507a2a3d8d72ed9afa9a2b9b17fd43add1 (patch) | |
tree | 612a7877042d9fc5423445a60629b50957ba33d8 | |
parent | e4e3678260e9734f6f41b4325aac0b171833a618 (diff) |
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 <[email protected]>
Reviewed-by: Krunoslav Kovac <[email protected]>
Acked-by: Stylon Wang <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 57afe711ee13..5fe4c5f80b54 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -799,6 +799,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; |