Skip to content

Commit 07bc2dc

Browse files
Ilya Bakoulinalexdeucher
authored andcommitted
drm/amd/display: Fix BT2020 YCbCr limited/full range input
[Why] BT2020 YCbCr input is not handled properly when full range quantization is used and limited range is not supported at all. [How] - Add enums for BT2020 YCbCr limited/full range - Add limited range CSC matrix Reviewed-by: Krunoslav Kovac <[email protected]> Signed-off-by: Ilya Bakoulin <[email protected]> Signed-off-by: Roman Li <[email protected]> Tested-by: Robert Mader <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 9856893 commit 07bc2dc

File tree

12 files changed

+29
-17
lines changed

12 files changed

+29
-17
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5624,9 +5624,9 @@ fill_plane_color_attributes(const struct drm_plane_state *plane_state,
56245624

56255625
case DRM_COLOR_YCBCR_BT2020:
56265626
if (full_range)
5627-
*color_space = COLOR_SPACE_2020_YCBCR;
5627+
*color_space = COLOR_SPACE_2020_YCBCR_FULL;
56285628
else
5629-
return -EINVAL;
5629+
*color_space = COLOR_SPACE_2020_YCBCR_LIMITED;
56305630
break;
56315631

56325632
default:
@@ -6122,7 +6122,7 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing,
61226122
if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB)
61236123
color_space = COLOR_SPACE_2020_RGB_FULLRANGE;
61246124
else
6125-
color_space = COLOR_SPACE_2020_YCBCR;
6125+
color_space = COLOR_SPACE_2020_YCBCR_LIMITED;
61266126
break;
61276127
case DRM_MODE_COLORIMETRY_DEFAULT: // ITU601
61286128
default:

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ static int amdgpu_current_colorspace_show(struct seq_file *m, void *data)
11691169
case COLOR_SPACE_2020_RGB_FULLRANGE:
11701170
seq_puts(m, "BT2020_RGB");
11711171
break;
1172-
case COLOR_SPACE_2020_YCBCR:
1172+
case COLOR_SPACE_2020_YCBCR_LIMITED:
11731173
seq_puts(m, "BT2020_YCC");
11741174
break;
11751175
default:

drivers/gpu/drm/amd/display/dc/basics/dc_common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ bool is_rgb_cspace(enum dc_color_space output_color_space)
4040
case COLOR_SPACE_YCBCR709:
4141
case COLOR_SPACE_YCBCR601_LIMITED:
4242
case COLOR_SPACE_YCBCR709_LIMITED:
43-
case COLOR_SPACE_2020_YCBCR:
43+
case COLOR_SPACE_2020_YCBCR_LIMITED:
44+
case COLOR_SPACE_2020_YCBCR_FULL:
4445
return false;
4546
default:
4647
/* Add a case to switch */

drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static bool is_ycbcr2020_type(
176176
{
177177
bool ret = false;
178178

179-
if (color_space == COLOR_SPACE_2020_YCBCR)
179+
if (color_space == COLOR_SPACE_2020_YCBCR_LIMITED || color_space == COLOR_SPACE_2020_YCBCR_FULL)
180180
ret = true;
181181
return ret;
182182
}
@@ -247,7 +247,8 @@ void color_space_to_black_color(
247247
case COLOR_SPACE_YCBCR709_BLACK:
248248
case COLOR_SPACE_YCBCR601_LIMITED:
249249
case COLOR_SPACE_YCBCR709_LIMITED:
250-
case COLOR_SPACE_2020_YCBCR:
250+
case COLOR_SPACE_2020_YCBCR_LIMITED:
251+
case COLOR_SPACE_2020_YCBCR_FULL:
251252
*black_color = black_color_format[BLACK_COLOR_FORMAT_YUV_CV];
252253
break;
253254

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,7 +4488,7 @@ static void set_avi_info_frame(
44884488
break;
44894489
case COLOR_SPACE_2020_RGB_FULLRANGE:
44904490
case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
4491-
case COLOR_SPACE_2020_YCBCR:
4491+
case COLOR_SPACE_2020_YCBCR_LIMITED:
44924492
hdmi_info.bits.EC0_EC2 = COLORIMETRYEX_BT2020RGBYCBCR;
44934493
hdmi_info.bits.C0_C1 = COLORIMETRY_EXTENDED;
44944494
break;
@@ -4502,7 +4502,7 @@ static void set_avi_info_frame(
45024502
break;
45034503
}
45044504

4505-
if (pixel_encoding && color_space == COLOR_SPACE_2020_YCBCR &&
4505+
if (pixel_encoding && color_space == COLOR_SPACE_2020_YCBCR_LIMITED &&
45064506
stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) {
45074507
hdmi_info.bits.EC0_EC2 = 0;
45084508
hdmi_info.bits.C0_C1 = COLORIMETRY_ITU709;

drivers/gpu/drm/amd/display/dc/dc_hw_types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,16 @@ enum dc_color_space {
653653
COLOR_SPACE_YCBCR709_LIMITED,
654654
COLOR_SPACE_2020_RGB_FULLRANGE,
655655
COLOR_SPACE_2020_RGB_LIMITEDRANGE,
656-
COLOR_SPACE_2020_YCBCR,
656+
COLOR_SPACE_2020_YCBCR_LIMITED,
657+
COLOR_SPACE_2020_YCBCR_FULL,
657658
COLOR_SPACE_ADOBERGB,
658659
COLOR_SPACE_DCIP3,
659660
COLOR_SPACE_DISPLAYNATIVE,
660661
COLOR_SPACE_DOLBYVISION,
661662
COLOR_SPACE_APPCTRL,
662663
COLOR_SPACE_CUSTOMPOINTS,
663664
COLOR_SPACE_YCBCR709_BLACK,
665+
COLOR_SPACE_2020_YCBCR = COLOR_SPACE_2020_YCBCR_LIMITED,
664666
};
665667

666668
enum dc_dither_option {

drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static void dce110_stream_encoder_dp_set_stream_attribute(
418418
dynamic_range_rgb = 1; /*limited range*/
419419
break;
420420
case COLOR_SPACE_2020_RGB_FULLRANGE:
421-
case COLOR_SPACE_2020_YCBCR:
421+
case COLOR_SPACE_2020_YCBCR_LIMITED:
422422
case COLOR_SPACE_XR_RGB:
423423
case COLOR_SPACE_MSREF_SCRGB:
424424
case COLOR_SPACE_ADOBERGB:
@@ -430,6 +430,7 @@ static void dce110_stream_encoder_dp_set_stream_attribute(
430430
case COLOR_SPACE_APPCTRL:
431431
case COLOR_SPACE_CUSTOMPOINTS:
432432
case COLOR_SPACE_UNKNOWN:
433+
default:
433434
/* do nothing */
434435
break;
435436
}

drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_stream_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ void enc1_stream_encoder_dp_set_stream_attribute(
391391
break;
392392
case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
393393
case COLOR_SPACE_2020_RGB_FULLRANGE:
394-
case COLOR_SPACE_2020_YCBCR:
394+
case COLOR_SPACE_2020_YCBCR_LIMITED:
395395
case COLOR_SPACE_XR_RGB:
396396
case COLOR_SPACE_MSREF_SCRGB:
397397
case COLOR_SPACE_ADOBERGB:
@@ -404,6 +404,7 @@ void enc1_stream_encoder_dp_set_stream_attribute(
404404
case COLOR_SPACE_CUSTOMPOINTS:
405405
case COLOR_SPACE_UNKNOWN:
406406
case COLOR_SPACE_YCBCR709_BLACK:
407+
default:
407408
/* do nothing */
408409
break;
409410
}

drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ void enc401_stream_encoder_dp_set_stream_attribute(
632632
break;
633633
case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
634634
case COLOR_SPACE_2020_RGB_FULLRANGE:
635-
case COLOR_SPACE_2020_YCBCR:
635+
case COLOR_SPACE_2020_YCBCR_LIMITED:
636636
case COLOR_SPACE_XR_RGB:
637637
case COLOR_SPACE_MSREF_SCRGB:
638638
case COLOR_SPACE_ADOBERGB:
@@ -645,6 +645,7 @@ void enc401_stream_encoder_dp_set_stream_attribute(
645645
case COLOR_SPACE_CUSTOMPOINTS:
646646
case COLOR_SPACE_UNKNOWN:
647647
case COLOR_SPACE_YCBCR709_BLACK:
648+
default:
648649
/* do nothing */
649650
break;
650651
}

drivers/gpu/drm/amd/display/dc/hpo/dcn31/dcn31_hpo_dp_stream_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static void dcn31_hpo_dp_stream_enc_set_stream_attribute(
323323
break;
324324
case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
325325
case COLOR_SPACE_2020_RGB_FULLRANGE:
326-
case COLOR_SPACE_2020_YCBCR:
326+
case COLOR_SPACE_2020_YCBCR_LIMITED:
327327
case COLOR_SPACE_XR_RGB:
328328
case COLOR_SPACE_MSREF_SCRGB:
329329
case COLOR_SPACE_ADOBERGB:
@@ -336,6 +336,7 @@ static void dcn31_hpo_dp_stream_enc_set_stream_attribute(
336336
case COLOR_SPACE_CUSTOMPOINTS:
337337
case COLOR_SPACE_UNKNOWN:
338338
case COLOR_SPACE_YCBCR709_BLACK:
339+
default:
339340
/* do nothing */
340341
break;
341342
}

0 commit comments

Comments
 (0)