Skip to content

Commit 9c4f9df

Browse files
Yihan Zhuopsiff
authored andcommitted
drm/amd/display: handle max_downscale_src_width fail check
[ Upstream commit 02a940d ] [WHY] If max_downscale_src_width check fails, we exit early from TAP calculation and left a NULL value to the scaling data structure to cause the zero divide in the DML validation. [HOW] Call set default TAP calculation before early exit in get_optimal_number_of_taps due to max downscale limit exceed. Reviewed-by: Samson Tam <samson.tam@amd.com> Signed-off-by: Yihan Zhu <Yihan.Zhu@amd.com> Signed-off-by: Zaeem Mohamed <zaeem.mohamed@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> (cherry picked from commit ec6f764ab7009857f36c9082f087c8938186121c)
1 parent 8baa98c commit 9c4f9df

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,6 @@ bool dpp3_get_optimal_number_of_taps(
392392
int min_taps_y, min_taps_c;
393393
enum lb_memory_config lb_config;
394394

395-
if (scl_data->viewport.width > scl_data->h_active &&
396-
dpp->ctx->dc->debug.max_downscale_src_width != 0 &&
397-
scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width)
398-
return false;
399-
400395
/*
401396
* Set default taps if none are provided
402397
* From programming guide: taps = min{ ceil(2*H_RATIO,1), 8} for downscaling
@@ -434,6 +429,12 @@ bool dpp3_get_optimal_number_of_taps(
434429
else
435430
scl_data->taps.h_taps_c = in_taps->h_taps_c;
436431

432+
// Avoid null data in the scl data with this early return, proceed non-adaptive calcualtion first
433+
if (scl_data->viewport.width > scl_data->h_active &&
434+
dpp->ctx->dc->debug.max_downscale_src_width != 0 &&
435+
scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width)
436+
return false;
437+
437438
/*Ensure we can support the requested number of vtaps*/
438439
min_taps_y = dc_fixpt_ceil(scl_data->ratios.vert);
439440
min_taps_c = dc_fixpt_ceil(scl_data->ratios.vert_c);

0 commit comments

Comments
 (0)