]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: handle max_downscale_src_width fail check
authorYihan Zhu <Yihan.Zhu@amd.com>
Wed, 12 Feb 2025 20:17:56 +0000 (15:17 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Feb 2025 16:45:11 +0000 (11:45 -0500)
[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>
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c

index 40acebd13e46dc1fa8b7ed691171bd3ebf2403ef..abf439e743f233f038e3ce7db9dbb306c0e3ddd8 100644 (file)
@@ -425,11 +425,6 @@ bool dpp3_get_optimal_number_of_taps(
        int min_taps_y, min_taps_c;
        enum lb_memory_config lb_config;
 
-       if (scl_data->viewport.width > scl_data->h_active &&
-               dpp->ctx->dc->debug.max_downscale_src_width != 0 &&
-               scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width)
-               return false;
-
        /*
         * Set default taps if none are provided
         * From programming guide: taps = min{ ceil(2*H_RATIO,1), 8} for downscaling
@@ -467,6 +462,12 @@ bool dpp3_get_optimal_number_of_taps(
        else
                scl_data->taps.h_taps_c = in_taps->h_taps_c;
 
+       // Avoid null data in the scl data with this early return, proceed non-adaptive calcualtion first
+       if (scl_data->viewport.width > scl_data->h_active &&
+               dpp->ctx->dc->debug.max_downscale_src_width != 0 &&
+               scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width)
+               return false;
+
        /*Ensure we can support the requested number of vtaps*/
        min_taps_y = dc_fixpt_ceil(scl_data->ratios.vert);
        min_taps_c = dc_fixpt_ceil(scl_data->ratios.vert_c);