Skip to content

Commit 2e65682

Browse files
Harry Wentlandalexdeucher
authored andcommitted
drm/amd/display: Send correct DP colorspace infopacket
Look at connector->colorimetry to determine output colorspace. We don't want to impact current SDR behavior, so DRM_MODE_COLORIMETRY_DEFAULT preserves current behavior. Also add support to explicitly set BT601 and BT709. v4: - Roll support for BT709 and BT601 into this patch - Add default case to avoid warnings for unhandled enum values Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Joshua Ashton <joshua@froggi.es> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton <joshua@froggi.es> Cc: Simon Ser <contact@emersion.fr> Cc: Melissa Wen <mwen@igalia.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent a0b433c commit 2e65682

1 file changed

Lines changed: 31 additions & 17 deletions

File tree

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

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5339,21 +5339,44 @@ get_aspect_ratio(const struct drm_display_mode *mode_in)
53395339
}
53405340

53415341
static enum dc_color_space
5342-
get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing)
5342+
get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing,
5343+
const struct drm_connector_state *connector_state)
53435344
{
53445345
enum dc_color_space color_space = COLOR_SPACE_SRGB;
53455346

5346-
switch (dc_crtc_timing->pixel_encoding) {
5347-
case PIXEL_ENCODING_YCBCR422:
5348-
case PIXEL_ENCODING_YCBCR444:
5349-
case PIXEL_ENCODING_YCBCR420:
5350-
{
5347+
switch (connector_state->colorspace) {
5348+
case DRM_MODE_COLORIMETRY_BT601_YCC:
5349+
if (dc_crtc_timing->flags.Y_ONLY)
5350+
color_space = COLOR_SPACE_YCBCR601_LIMITED;
5351+
else
5352+
color_space = COLOR_SPACE_YCBCR601;
5353+
break;
5354+
case DRM_MODE_COLORIMETRY_BT709_YCC:
5355+
if (dc_crtc_timing->flags.Y_ONLY)
5356+
color_space = COLOR_SPACE_YCBCR709_LIMITED;
5357+
else
5358+
color_space = COLOR_SPACE_YCBCR709;
5359+
break;
5360+
case DRM_MODE_COLORIMETRY_OPRGB:
5361+
color_space = COLOR_SPACE_ADOBERGB;
5362+
break;
5363+
case DRM_MODE_COLORIMETRY_BT2020_RGB:
5364+
case DRM_MODE_COLORIMETRY_BT2020_YCC:
5365+
if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB)
5366+
color_space = COLOR_SPACE_2020_RGB_FULLRANGE;
5367+
else
5368+
color_space = COLOR_SPACE_2020_YCBCR;
5369+
break;
5370+
case DRM_MODE_COLORIMETRY_DEFAULT: // ITU601
5371+
default:
5372+
if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) {
5373+
color_space = COLOR_SPACE_SRGB;
53515374
/*
53525375
* 27030khz is the separation point between HDTV and SDTV
53535376
* according to HDMI spec, we use YCbCr709 and YCbCr601
53545377
* respectively
53555378
*/
5356-
if (dc_crtc_timing->pix_clk_100hz > 270300) {
5379+
} else if (dc_crtc_timing->pix_clk_100hz > 270300) {
53575380
if (dc_crtc_timing->flags.Y_ONLY)
53585381
color_space =
53595382
COLOR_SPACE_YCBCR709_LIMITED;
@@ -5366,15 +5389,6 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing)
53665389
else
53675390
color_space = COLOR_SPACE_YCBCR601;
53685391
}
5369-
5370-
}
5371-
break;
5372-
case PIXEL_ENCODING_RGB:
5373-
color_space = COLOR_SPACE_SRGB;
5374-
break;
5375-
5376-
default:
5377-
WARN_ON(1);
53785392
break;
53795393
}
53805394

@@ -5513,7 +5527,7 @@ static void fill_stream_properties_from_drm_display_mode(
55135527
}
55145528
}
55155529

5516-
stream->output_color_space = get_output_color_space(timing_out);
5530+
stream->output_color_space = get_output_color_space(timing_out, connector_state);
55175531
}
55185532

55195533
static void fill_audio_info(struct audio_info *audio_info,

0 commit comments

Comments
 (0)