drm/i915: SDVO limited color range and pixel repeat fixes
Subsystems (2)
cover drm/i915: SDVO limited color range and pixel repeat fixes
From: Ville Syrjälä <[email protected]>
While looking at cleaning up the SDVO limited color range handling I noticed the new FIXMEs that we're not supposed to use the limited color range bit in the port registers. After a bit of work I managed to produce a few patches that should hopefully deal with this correctly. I also tossed in a patch that tries to deal with DBLCLK modes.
Sadly I have no HDMI SDVO devices, so couldn't test this. My DVI SDVO device apparently doesn't support the colormetry stuff at all.
Ville Syrjälä (4):
drm/i915: Clean up SDVO limited color range handling drm/i915: Fix SDVO colorimetry bit defines drm/i915: Implement limited color range for SDVO properly drm/i915: Make SDVO deal with HDMI pixel repeat
drivers/gpu/drm/i915/intel_sdvo.c | 87 +++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_sdvo_regs.h | 8 ++-- 2 files changed, 64 insertions(+), 31 deletions(-)
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/4 drm/i915: Clean up SDVO limited color range handling
From: Ville Syrjälä <[email protected]>
Clean up the limited color range handling for SDVO as was done for HDMI/DP previously.
--- drivers/gpu/drm/i915/intel_sdvo.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +12 -15
@@ -103,7 +103,7 @@ struct intel_sdvo {* This is used to select the color range of RBG outputs in HDMI mode. * It is only valid when using TMDS encoding and 8 bit per color mode. */ -uint32_t color_range; +bool limited_color_range;bool color_range_auto;/**
@@ -1166,15 +1166,12 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,if (intel_sdvo->color_range_auto) {/* See CEA-861-E - 5.1 Default Encoding Parameters */ -/* FIXME: This bit is only valid when using TMDS encoding and 8 -* bit per color mode. */ -if (pipe_config->has_hdmi_sink && -drm_match_cea_mode (adjusted_mode) >1 ) - pipe_config->limited_color_range = true; + pipe_config->limited_color_range = + pipe_config->has_hdmi_sink && +drm_match_cea_mode (adjusted_mode) >1 ; }else { -if (pipe_config->has_hdmi_sink && - intel_sdvo->color_range ==HDMI_COLOR_RANGE_16_235 ) - pipe_config->limited_color_range = true; + pipe_config->limited_color_range = + intel_sdvo->limited_color_range; }/* Clock computation needs to happen after pixel multiplier. */
@@ -1268,6 +1265,8 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)/* The real mode polarity is set by the SDVO commands, using * struct intel_sdvo_dtd. */ sdvox =SDVO_VSYNC_ACTIVE_HIGH |SDVO_HSYNC_ACTIVE_HIGH ; +/* FIXME: this bit is only valid when using TMDS +* encoding and 8 bit per color mode. */ if (!HAS_PCH_SPLIT (dev) && crtc->config->limited_color_range) sdvox |=HDMI_COLOR_RANGE_16_235 ;if (INTEL_INFO (dev)->gen <5 )
@@ -2017,7 +2016,7 @@ intel_sdvo_set_property(struct drm_connector *connector,if (property == dev_priv->broadcast_rgb_property) {bool old_auto = intel_sdvo->color_range_auto; -uint32_t old_range = intel_sdvo->color_range; +bool old_range = intel_sdvo->limited_color_range;switch (val) {case INTEL_BROADCAST_RGB_AUTO :
@@ -2025,20 +2024,18 @@ intel_sdvo_set_property(struct drm_connector *connector,break ;case INTEL_BROADCAST_RGB_FULL : intel_sdvo->color_range_auto = false; - intel_sdvo->color_range =0 ; + intel_sdvo->limited_color_range = false;break ;case INTEL_BROADCAST_RGB_LIMITED : intel_sdvo->color_range_auto = false; -/* FIXME: this bit is only valid when using TMDS -* encoding and 8 bit per color mode. */ - intel_sdvo->color_range =HDMI_COLOR_RANGE_16_235 ; + intel_sdvo->limited_color_range = true;break ;default :return -EINVAL ; }if (old_auto == intel_sdvo->color_range_auto && - old_range == intel_sdvo->color_range) + old_range == intel_sdvo->limited_color_range)return 0 ; goto done;
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/4 drm/i915: Fix SDVO colorimetry bit defines
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Fix up the SDVO colorimetry bits to match the spec.
--- drivers/gpu/drm/i915/intel_sdvo_regs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_sdvo_regs.h +4 -4
@@ -699,10 +699,10 @@ struct intel_sdvo_enhancements_arg {#define SDVO_CMD_GET_PIXEL_REPLI 0x8c#define SDVO_CMD_GET_COLORIMETRY_CAP 0x8d#define SDVO_CMD_SET_COLORIMETRY 0x8e -#define SDVO_COLORIMETRY_RGB256 0x0 -#define SDVO_COLORIMETRY_RGB220 0x1 -#define SDVO_COLORIMETRY_YCrCb422 0x3 -#define SDVO_COLORIMETRY_YCrCb444 0x4 +#define SDVO_COLORIMETRY_RGB256 (1 << 0) +#define SDVO_COLORIMETRY_RGB220 (1 << 1) +#define SDVO_COLORIMETRY_YCrCb422 (1 << 2) +#define SDVO_COLORIMETRY_YCrCb444 (1 << 3)#define SDVO_CMD_GET_COLORIMETRY 0x8f#define SDVO_CMD_GET_AUDIO_ENCRYPT_PREFER 0x90#define SDVO_CMD_SET_AUDIO_STAT 0x91
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/4 drm/i915: Implement limited color range for SDVO properly
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The SDVO/HDMI port register limited color range bit can only be used with TMDS encoding and not SDVO encoding, ie. to be used only when using the port as a HDMI port as opposed to a SDVO port.
To implement limited color range support for SDVO->HDMI we need to ask the SDVO device to do the range compression. Do so, but first check if the device even supports the colorimetry selection.
--- drivers/gpu/drm/i915/intel_sdvo.c | 63 +++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +44 -19
@@ -85,6 +85,8 @@ struct intel_sdvo {*/ struct intel_sdvo_caps caps; +uint8_t colorimetry_cap; +/* Pixel clock limitations reported by the SDVO device, in kHz */ int pixel_clock_min, pixel_clock_max;
@@ -1164,14 +1166,16 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor; -if (intel_sdvo->color_range_auto) { -/* See CEA-861-E - 5.1 Default Encoding Parameters */ - pipe_config->limited_color_range = - pipe_config->has_hdmi_sink && -drm_match_cea_mode (adjusted_mode) >1 ; - }else { - pipe_config->limited_color_range = - intel_sdvo->limited_color_range; +if (intel_sdvo->colorimetry_cap &SDVO_COLORIMETRY_RGB220 ) { +if (intel_sdvo->color_range_auto) { +/* See CEA-861-E - 5.1 Default Encoding Parameters */ + pipe_config->limited_color_range = + pipe_config->has_hdmi_sink && +drm_match_cea_mode (adjusted_mode) >1 ; + }else { + pipe_config->limited_color_range = + intel_sdvo->limited_color_range; + } }/* Clock computation needs to happen after pixel multiplier. */
@@ -1232,8 +1236,12 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)if (crtc->config->has_hdmi_sink) {intel_sdvo_set_encode (intel_sdvo,SDVO_ENCODE_HDMI ); -intel_sdvo_set_colorimetry (intel_sdvo, -SDVO_COLORIMETRY_RGB256 ); +if (crtc->config->limited_color_range) +intel_sdvo_set_colorimetry (intel_sdvo, +SDVO_COLORIMETRY_RGB220 ); +else +intel_sdvo_set_colorimetry (intel_sdvo, +SDVO_COLORIMETRY_RGB256 );intel_sdvo_set_avi_infoframe (intel_sdvo, adjusted_mode); }else intel_sdvo_set_encode (intel_sdvo,SDVO_ENCODE_DVI );
@@ -1265,10 +1273,6 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)/* The real mode polarity is set by the SDVO commands, using * struct intel_sdvo_dtd. */ sdvox =SDVO_VSYNC_ACTIVE_HIGH |SDVO_HSYNC_ACTIVE_HIGH ; -/* FIXME: this bit is only valid when using TMDS -* encoding and 8 bit per color mode. */ -if (!HAS_PCH_SPLIT (dev) && crtc->config->limited_color_range) - sdvox |=HDMI_COLOR_RANGE_16_235 ;if (INTEL_INFO (dev)->gen <5 ) sdvox |=SDVO_BORDER_ENABLE ; }else {
@@ -1418,8 +1422,16 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, } } -if (sdvox &HDMI_COLOR_RANGE_16_235 ) - pipe_config->limited_color_range = true; +if (intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_COLORIMETRY , + &val,1 )) { +switch (val) { +case SDVO_COLORIMETRY_RGB220 : + pipe_config->limited_color_range = true; +break ; +default : +break ; + } + }if (intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_ENCODE , &val,1 )) {
@@ -1570,6 +1582,17 @@ static bool intel_sdvo_get_capabilities(struct intel_sdvo *intel_sdvo, struct inreturn true; } +static uint8_t intel_sdvo_get_colorimetry_cap (struct intel_sdvo *intel_sdvo) +{ +uint8_t cap; + +if (!intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_COLORIMETRY_CAP , + &cap,sizeof (cap))) +return SDVO_COLORIMETRY_RGB256 ; + +return cap; +} +static uint16_t intel_sdvo_get_hotplug_support (struct intel_sdvo *intel_sdvo) {struct drm_device *dev = intel_sdvo->base.base.dev;
@@ -2373,10 +2396,9 @@ static void intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo, struct intel_sdvo_connector *connector) { - struct drm_device *dev = connector->base.base.dev; - intel_attach_force_audio_property(&connector->base.base); -if (INTEL_INFO (dev)->gen >=4 &&IS_MOBILE (dev)) { + +if (intel_sdvo->colorimetry_cap &SDVO_COLORIMETRY_RGB220 ) {intel_attach_broadcast_rgb_property (&connector->base.base); intel_sdvo->color_range_auto = true; }
@@ -2958,6 +2980,9 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)if (!intel_sdvo_get_capabilities (intel_sdvo, &intel_sdvo->caps)) goto err; + intel_sdvo->colorimetry_cap = +intel_sdvo_get_colorimetry_cap (intel_sdvo); +if (intel_sdvo_output_setup (intel_sdvo, intel_sdvo->caps.output_flags) != true) { DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/4 drm/i915: Make SDVO deal with HDMI pixel repeat
In reply to [email protected]From: Ville Syrjälä <[email protected]>
With SDVO the pipe config pixel_multiplier only concerns itself with the data on the SDVO bus. Any HDMI specific pixel repeat must be handled by the SDVO device itself. To do that simply configure the SDVO pixel replication factor appropriately. We already set up the infoframe PRB values correctly via the infoframe helpers.
--- drivers/gpu/drm/i915/intel_sdvo.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_sdvo.c +11 -0
@@ -931,6 +931,12 @@ static bool intel_sdvo_set_colorimetry(struct intel_sdvo *intel_sdvo,return intel_sdvo_set_value (intel_sdvo,SDVO_CMD_SET_COLORIMETRY , &mode,1 ); } +static bool intel_sdvo_set_pixel_replication (struct intel_sdvo *intel_sdvo, +uint8_t pixel_repeat) +{ +return intel_sdvo_set_value (intel_sdvo,SDVO_CMD_SET_PIXEL_REPLI , &pixel_repeat,1 ); +} +#if 0 static void intel_sdvo_dump_hdmi_buf (struct intel_sdvo *intel_sdvo) {
@@ -1243,6 +1249,11 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)intel_sdvo_set_colorimetry (intel_sdvo,SDVO_COLORIMETRY_RGB256 );intel_sdvo_set_avi_infoframe (intel_sdvo, adjusted_mode); + +if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK ) +intel_sdvo_set_pixel_replication (intel_sdvo,1 ); +else +intel_sdvo_set_pixel_replication (intel_sdvo,0 ); }else intel_sdvo_set_encode (intel_sdvo,SDVO_ENCODE_DVI );
Signature · 6 lines
2.4.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/4] drm/i915: Make SDVO deal with HDMI pixel repeat
Task id: 7184 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK -1 302/302 301/302
SNB 315/315 315/315 IVB 336/336 336/336
BYT -1 283/283 282/283
HSW 378/378 378/378
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@wf_vblank-vs-modeset-interruptible PASS(1) DMESG_WARN(1)
*BYT igt@gem_partial_pwrite_pread@reads-uncached PASS(1) FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx