aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSamson Tam <Samson.Tam@amd.com>2025-01-07 14:17:15 -0500
committerAlex Deucher <alexander.deucher@amd.com>2025-02-25 11:44:02 -0500
commit259eacbfcf66c52384bf4e194fd34939b6007265 (patch)
tree38d1a61554c25bdba3657bb595ad5c160ce64c3d /drivers/gpu
parentdrm/amd/display: fix check for identity ratio (diff)
downloadlinux-259eacbfcf66c52384bf4e194fd34939b6007265.tar.gz
linux-259eacbfcf66c52384bf4e194fd34939b6007265.zip
drm/amd/display: Fix unit test failure
[Why] Some of unit tests use large scaling ratio such that when we calculate optimal number of taps, max_taps is negative. Then in recent change, we changed max_taps to uint instead of int so now max_taps wraps and is positive. This change changed the behaviour from returning back false to return true and breaks unit test check [How] Add check to prevent max_taps from wrapping and set to 0 instead Signed-off-by: Samson Tam <Samson.Tam@amd.com> Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c
index 047f05ab0181..ad77cef57ac7 100644
--- a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c
+++ b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c
@@ -1026,12 +1026,18 @@ static bool spl_get_optimal_number_of_taps(
lb_config, &num_part_y, &num_part_c);
/* MAX_V_TAPS = MIN (NUM_LINES - MAX(CEILING(V_RATIO,1)-2, 0), 8) */
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert) > 2)
- max_taps_y = num_part_y - (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert) - 2);
+ if ((spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert) - 2) > num_part_y)
+ max_taps_y = 0;
+ else
+ max_taps_y = num_part_y - (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert) - 2);
else
max_taps_y = num_part_y;
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert_c) > 2)
- max_taps_c = num_part_c - (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert_c) - 2);
+ if ((spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert_c) - 2) > num_part_c)
+ max_taps_c = 0;
+ else
+ max_taps_c = num_part_c - (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert_c) - 2);
else
max_taps_c = num_part_c;