Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: fix handling of max_downscale_src_width fail check in SPL

[Why]
If max_downscale_src_width check fails, we exit early from
spl_calculate_scaler_params but dscl_prog_data is not fully
populated. If viewport is left at 0, it can cause crash in dml.

[How]
Call spl_set_dscl_prog_data before we exit early from
spl_calculate_scaler_params to populate dscl_prog_data
Populate taps in spl_get_optimal_number_of_taps

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Samson Tam and committed by
Alex Deucher
c56c0aca 4007f07a

+9 -4
+9 -4
drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
··· 882 882 883 883 if (spl_scratch->scl_data.viewport.width > spl_scratch->scl_data.h_active && 884 884 max_downscale_src_width != 0 && 885 - spl_scratch->scl_data.viewport.width > max_downscale_src_width) 885 + spl_scratch->scl_data.viewport.width > max_downscale_src_width) { 886 + memcpy(&spl_scratch->scl_data.taps, in_taps, sizeof(struct spl_taps)); 887 + *enable_easf_v = false; 888 + *enable_easf_h = false; 889 + *enable_isharp = false; 886 890 return false; 891 + } 887 892 888 893 /* Disable adaptive scaler and sharpener when integer scaling is enabled */ 889 894 if (spl_in->scaling_quality.integer_scaling) { ··· 1770 1765 // Clamp 1771 1766 spl_clamp_viewport(&spl_scratch.scl_data.viewport); 1772 1767 1773 - if (!res) 1774 - return res; 1775 - 1776 1768 // Save all calculated parameters in dscl_prog_data structure to program hw registers 1777 1769 spl_set_dscl_prog_data(spl_in, &spl_scratch, spl_out, enable_easf_v, enable_easf_h, enable_isharp); 1770 + 1771 + if (!res) 1772 + return res; 1778 1773 1779 1774 if (spl_in->lls_pref == LLS_PREF_YES) { 1780 1775 if (spl_in->is_hdr_on)