Skip to content

Commit 1df1d45

Browse files
Samson Tamalexdeucher
authored andcommitted
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 <[email protected]> Signed-off-by: Samson Tam <[email protected]> Signed-off-by: Hamza Mahfooz <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent c3ea03c commit 1df1d45

File tree

1 file changed

+20
-14
lines changed
  • drivers/gpu/drm/amd/display/dc/spl

1 file changed

+20
-14
lines changed

drivers/gpu/drm/amd/display/dc/spl/dc_spl.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -739,14 +739,13 @@ static enum scl_mode spl_get_dscl_mode(const struct spl_in *spl_in,
739739
return SCL_MODE_SCALING_444_RGB_ENABLE;
740740
}
741741

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
744745
*/
745-
if ((!enable_isharp) && (!enable_easf)) {
746+
if (!enable_isharp) {
746747
if (data->ratios.horz.value == one && data->ratios.vert.value == one)
747748
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;
750749
}
751750

752751
return SCL_MODE_SCALING_420_YCBCR_ENABLE;
@@ -933,6 +932,7 @@ static bool spl_get_optimal_number_of_taps(
933932
int min_taps_y, min_taps_c;
934933
enum lb_memory_config lb_config;
935934
bool skip_easf = false;
935+
bool is_ycbcr = spl_dscl_is_video_format(spl_in->basic_in.format);
936936

937937
if (spl_scratch->scl_data.viewport.width > spl_scratch->scl_data.h_active &&
938938
max_downscale_src_width != 0 &&
@@ -1074,10 +1074,9 @@ static bool spl_get_optimal_number_of_taps(
10741074

10751075
/* Sharpener requires scaler to be enabled, including for 1:1
10761076
* 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
10811080
*/
10821081

10831082
*enable_isharp = spl_get_isharp_en(spl_in, spl_scratch);
@@ -1087,20 +1086,28 @@ static bool spl_get_optimal_number_of_taps(
10871086
spl_scratch->scl_data.taps.h_taps = 1;
10881087
spl_scratch->scl_data.taps.v_taps = 1;
10891088

1090-
if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c))
1089+
if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c) && !is_ycbcr)
10911090
spl_scratch->scl_data.taps.h_taps_c = 1;
10921091

1093-
if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c))
1092+
if (IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c) && !is_ycbcr)
10941093
spl_scratch->scl_data.taps.v_taps_c = 1;
10951094

10961095
*enable_easf_v = false;
10971096
*enable_easf_h = false;
10981097
} else {
10991098
if ((!*enable_easf_h) &&
1099+
(IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz)))
1100+
spl_scratch->scl_data.taps.h_taps = 1;
1101+
1102+
if ((!*enable_easf_v) &&
1103+
(IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert)))
1104+
spl_scratch->scl_data.taps.v_taps = 1;
1105+
1106+
if ((!*enable_easf_h) && !is_ycbcr &&
11001107
(IDENTITY_RATIO(spl_scratch->scl_data.ratios.horz_c)))
11011108
spl_scratch->scl_data.taps.h_taps_c = 1;
11021109

1103-
if ((!*enable_easf_v) &&
1110+
if ((!*enable_easf_v) && !is_ycbcr &&
11041111
(IDENTITY_RATIO(spl_scratch->scl_data.ratios.vert_c)))
11051112
spl_scratch->scl_data.taps.v_taps_c = 1;
11061113
}
@@ -1111,8 +1118,7 @@ static bool spl_get_optimal_number_of_taps(
11111118
static void spl_set_black_color_data(enum spl_pixel_format format,
11121119
struct scl_black_color *scl_black_color)
11131120
{
1114-
bool ycbcr = format >= SPL_PIXEL_FORMAT_VIDEO_BEGIN
1115-
&& format <= SPL_PIXEL_FORMAT_VIDEO_END;
1121+
bool ycbcr = spl_dscl_is_video_format(format);
11161122
if (ycbcr) {
11171123
scl_black_color->offset_rgb_y = BLACK_OFFSET_RGB_Y;
11181124
scl_black_color->offset_rgb_cbcr = BLACK_OFFSET_CBCR;

0 commit comments

Comments
 (0)