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

drm/amd/display: allow chroma 1:1 scaling when sharpness is off

[Why]
SPL code forces taps to 1 when ratio is 1:1 and sharpness is off
But for chroma 1:1, need taps > 1 to handle cositing

[How]
Do not force chroma taps to 1 when ratio is 1:1 for YUV420
Remove 420_CHROMA_BYPASS mode for scaler

Reviewed-by: Navid Assadian <navid.assadian@amd.com>
Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@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
1df1d452 c3ea03c2

+20 -14
+20 -14
drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
··· 739 739 return SCL_MODE_SCALING_444_RGB_ENABLE; 740 740 } 741 741 742 - /* Bypass YUV if at 1:1 with no ISHARP or if doing 2:1 YUV 743 - * downscale without EASF 742 + /* 743 + * Bypass YUV if Y is 1:1 with no ISHARP 744 + * Do not bypass UV at 1:1 for cositing to be applied 744 745 */ 745 - if ((!enable_isharp) && (!enable_easf)) { 746 + if (!enable_isharp) { 746 747 if (data->ratios.horz.value == one && data->ratios.vert.value == one) 747 748 return SCL_MODE_SCALING_420_LUMA_BYPASS; 748 - if (data->ratios.horz_c.value == one && data->ratios.vert_c.value == one) 749 - return SCL_MODE_SCALING_420_CHROMA_BYPASS; 750 749 } 751 750 752 751 return SCL_MODE_SCALING_420_YCBCR_ENABLE; ··· 932 933 int min_taps_y, min_taps_c; 933 934 enum lb_memory_config lb_config; 934 935 bool skip_easf = false; 936 + bool is_ycbcr = spl_dscl_is_video_format(spl_in->basic_in.format); 935 937 936 938 if (spl_scratch->scl_data.viewport.width > spl_scratch->scl_data.h_active && 937 939 max_downscale_src_width != 0 && ··· 1074 1074 1075 1075 /* Sharpener requires scaler to be enabled, including for 1:1 1076 1076 * Check if ISHARP can be enabled 1077 - * If ISHARP is not enabled, for 1:1, set taps to 1 and disable 1078 - * EASF 1079 - * For case of 2:1 YUV where chroma is 1:1, set taps to 1 if 1080 - * EASF is not enabled 1077 + * If ISHARP is not enabled, set taps to 1 if ratio is 1:1 1078 + * except for chroma taps. Keep previous taps so it can 1079 + * handle cositing 1081 1080 */ 1082 1081 1083 1082 *enable_isharp = spl_get_isharp_en(spl_in, spl_scratch); ··· 1086 1087 spl_scratch->scl_data.taps.h_taps = 1; 1087 1088 spl_scratch->scl_data.taps.v_taps = 1; 1088 1089 1089 - if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c)) 1090 + if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c) && !is_ycbcr) 1090 1091 spl_scratch->scl_data.taps.h_taps_c = 1; 1091 1092 1092 - if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c)) 1093 + if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c) && !is_ycbcr) 1093 1094 spl_scratch->scl_data.taps.v_taps_c = 1; 1094 1095 1095 1096 *enable_easf_v = false; 1096 1097 *enable_easf_h = false; 1097 1098 } else { 1098 1099 if ((!*enable_easf_h) && 1100 + (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz))) 1101 + spl_scratch->scl_data.taps.h_taps = 1; 1102 + 1103 + if ((!*enable_easf_v) && 1104 + (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert))) 1105 + spl_scratch->scl_data.taps.v_taps = 1; 1106 + 1107 + if ((!*enable_easf_h) && !is_ycbcr && 1099 1108 (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c))) 1100 1109 spl_scratch->scl_data.taps.h_taps_c = 1; 1101 1110 1102 - if ((!*enable_easf_v) && 1111 + if ((!*enable_easf_v) && !is_ycbcr && 1103 1112 (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c))) 1104 1113 spl_scratch->scl_data.taps.v_taps_c = 1; 1105 1114 } ··· 1118 1111 static void spl_set_black_color_data(enum spl_pixel_format format, 1119 1112 struct scl_black_color *scl_black_color) 1120 1113 { 1121 - bool ycbcr = format >= SPL_PIXEL_FORMAT_VIDEO_BEGIN 1122 - && format <= SPL_PIXEL_FORMAT_VIDEO_END; 1114 + bool ycbcr = spl_dscl_is_video_format(format); 1123 1115 if (ycbcr) { 1124 1116 scl_black_color->offset_rgb_y = BLACK_OFFSET_RGB_Y; 1125 1117 scl_black_color->offset_rgb_cbcr = BLACK_OFFSET_CBCR;