Commit 12036586 authored by Eric Bernstein's avatar Eric Bernstein Committed by Alex Deucher

drm/amd/display: Allow DP register double buffer

Remove setting DP_DB_DISABLE to avoid issues when changing
bit depth after vbios take over.
Refactor code to perform single register update for both
pixel encoding and component depth fields.
Signed-off-by: default avatarEric Bernstein <eric.bernstein@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ce3f6e82
...@@ -289,11 +289,6 @@ static void dce110_stream_encoder_dp_set_stream_attribute( ...@@ -289,11 +289,6 @@ static void dce110_stream_encoder_dp_set_stream_attribute(
struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
if (REG(DP_DB_CNTL))
REG_UPDATE(DP_DB_CNTL, DP_DB_DISABLE, 1);
#endif
/* set pixel encoding */ /* set pixel encoding */
switch (crtc_timing->pixel_encoding) { switch (crtc_timing->pixel_encoding) {
case PIXEL_ENCODING_YCBCR422: case PIXEL_ENCODING_YCBCR422:
......
...@@ -257,20 +257,18 @@ void enc1_stream_encoder_dp_set_stream_attribute( ...@@ -257,20 +257,18 @@ void enc1_stream_encoder_dp_set_stream_attribute(
uint8_t colorimetry_bpc; uint8_t colorimetry_bpc;
uint8_t dynamic_range_rgb = 0; /*full range*/ uint8_t dynamic_range_rgb = 0; /*full range*/
uint8_t dynamic_range_ycbcr = 1; /*bt709*/ uint8_t dynamic_range_ycbcr = 1; /*bt709*/
uint8_t dp_pixel_encoding = 0;
uint8_t dp_component_depth = 0;
struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc); struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
REG_UPDATE(DP_DB_CNTL, DP_DB_DISABLE, 1);
/* set pixel encoding */ /* set pixel encoding */
switch (crtc_timing->pixel_encoding) { switch (crtc_timing->pixel_encoding) {
case PIXEL_ENCODING_YCBCR422: case PIXEL_ENCODING_YCBCR422:
REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, dp_pixel_encoding = DP_PIXEL_ENCODING_TYPE_YCBCR422;
DP_PIXEL_ENCODING_TYPE_YCBCR422);
break; break;
case PIXEL_ENCODING_YCBCR444: case PIXEL_ENCODING_YCBCR444:
REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, dp_pixel_encoding = DP_PIXEL_ENCODING_TYPE_YCBCR444;
DP_PIXEL_ENCODING_TYPE_YCBCR444);
if (crtc_timing->flags.Y_ONLY) if (crtc_timing->flags.Y_ONLY)
if (crtc_timing->display_color_depth != COLOR_DEPTH_666) if (crtc_timing->display_color_depth != COLOR_DEPTH_666)
...@@ -278,8 +276,8 @@ void enc1_stream_encoder_dp_set_stream_attribute( ...@@ -278,8 +276,8 @@ void enc1_stream_encoder_dp_set_stream_attribute(
* Color depth of Y-only could be * Color depth of Y-only could be
* 8, 10, 12, 16 bits * 8, 10, 12, 16 bits
*/ */
REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, dp_pixel_encoding = DP_PIXEL_ENCODING_TYPE_Y_ONLY;
DP_PIXEL_ENCODING_TYPE_Y_ONLY);
/* Note: DP_MSA_MISC1 bit 7 is the indicator /* Note: DP_MSA_MISC1 bit 7 is the indicator
* of Y-only mode. * of Y-only mode.
* This bit is set in HW if register * This bit is set in HW if register
...@@ -287,13 +285,11 @@ void enc1_stream_encoder_dp_set_stream_attribute( ...@@ -287,13 +285,11 @@ void enc1_stream_encoder_dp_set_stream_attribute(
*/ */
break; break;
case PIXEL_ENCODING_YCBCR420: case PIXEL_ENCODING_YCBCR420:
REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, dp_pixel_encoding = DP_PIXEL_ENCODING_TYPE_YCBCR420;
DP_PIXEL_ENCODING_TYPE_YCBCR420);
REG_UPDATE(DP_VID_TIMING, DP_VID_N_MUL, 1); REG_UPDATE(DP_VID_TIMING, DP_VID_N_MUL, 1);
break; break;
default: default:
REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, dp_pixel_encoding = DP_PIXEL_ENCODING_TYPE_RGB444;
DP_PIXEL_ENCODING_TYPE_RGB444);
break; break;
} }
...@@ -314,32 +310,30 @@ void enc1_stream_encoder_dp_set_stream_attribute( ...@@ -314,32 +310,30 @@ void enc1_stream_encoder_dp_set_stream_attribute(
/* set color depth */ /* set color depth */
switch (crtc_timing->display_color_depth) { switch (crtc_timing->display_color_depth) {
case COLOR_DEPTH_666: case COLOR_DEPTH_666:
REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, dp_component_depth = DP_COMPONENT_PIXEL_DEPTH_6BPC;
0);
break; break;
case COLOR_DEPTH_888: case COLOR_DEPTH_888:
REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, dp_component_depth = DP_COMPONENT_PIXEL_DEPTH_8BPC;
DP_COMPONENT_PIXEL_DEPTH_8BPC);
break; break;
case COLOR_DEPTH_101010: case COLOR_DEPTH_101010:
REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, dp_component_depth = DP_COMPONENT_PIXEL_DEPTH_10BPC;
DP_COMPONENT_PIXEL_DEPTH_10BPC);
break; break;
case COLOR_DEPTH_121212: case COLOR_DEPTH_121212:
REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, dp_component_depth = DP_COMPONENT_PIXEL_DEPTH_12BPC;
DP_COMPONENT_PIXEL_DEPTH_12BPC);
break; break;
case COLOR_DEPTH_161616: case COLOR_DEPTH_161616:
REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, dp_component_depth = DP_COMPONENT_PIXEL_DEPTH_16BPC;
DP_COMPONENT_PIXEL_DEPTH_16BPC);
break; break;
default: default:
REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, dp_component_depth = DP_COMPONENT_PIXEL_DEPTH_6BPC;
DP_COMPONENT_PIXEL_DEPTH_6BPC);
break; break;
} }
/* Set DP pixel encoding and component depth */
REG_UPDATE_2(DP_PIXEL_FORMAT,
DP_PIXEL_ENCODING, dp_pixel_encoding,
DP_COMPONENT_DEPTH, dp_component_depth);
/* set dynamic range and YCbCr range */ /* set dynamic range and YCbCr range */
switch (crtc_timing->display_color_depth) { switch (crtc_timing->display_color_depth) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment