drm/i915: Re-enable HDMI 12bpc
Subsystems (2)
v2 cover drm/i915: Re-enable HDMI 12bpc
From: Ville Syrjälä <[email protected]>
Here's my second attempt at flipping HDMI 12bpc back on. In my last attempt [1] Imre found that lots of standard CEA modes (1080p60 etc.) no longer work on BXT due to the 12bpc port clock landing in a range that the DPLL can't generate. CHV has the same limitation but it doesn't do 12bpc so the situation there isn't as bad.
This series attempts to work around this problem by falling back to 8bpc when the 1.5x port clock frequency turns out to be bad. Additionally we will from now on filter out any mode where both 8bpc and 12bpc port clock is bad.
[1] http://lists.freedesktop.org/archives/intel-gfx/2015-June/068988.html
Ville Syrjälä (4):
drm/i915: Fix HDMI 12bpc and pixel repeat clock readout for DDI
platforms
drm/i915: Bump HDMI min port clock to 25 MHz drm/i915: Account for CHV/BXT DPLL clock limittions Revert "drm/i915: Disable 12bpc hdmi for now"
drivers/gpu/drm/i915/intel_ddi.c | 49 +++++++++++++++++----------------- drivers/gpu/drm/i915/intel_hdmi.c | 55 +++++++++++++++++++++++++++------------ 2 files changed, 63 insertions(+), 41 deletions(-)
Signature · 6 lines
2.3.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/4 drm/i915: Fix HDMI 12bpc and pixel repeat clock readout for DDI platforms
From: Ville Syrjälä <[email protected]>
Take the HDMI 12bpc mode and pixel repeat into account when extracting the dotclock from the hardware on DDI platforms.
Tested on HSW only.
--- drivers/gpu/drm/i915/intel_ddi.c | 49 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +24 -25
@@ -855,6 +855,26 @@ static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv,return dco_freq / (p0 * p1 * p2 *5 ); } +static void ddi_dotclock_get (struct intel_crtc_state *pipe_config) +{ +int dotclock; + +if (pipe_config->has_pch_encoder) + dotclock =intel_dotclock_calculate (pipe_config->port_clock, + &pipe_config->fdi_m_n); +else if (pipe_config->has_dp_encoder) + dotclock =intel_dotclock_calculate (pipe_config->port_clock, + &pipe_config->dp_m_n); +else if (pipe_config->has_hdmi_sink && pipe_config->pipe_bpp ==36 ) + dotclock = pipe_config->port_clock *2 /3 ; +else + dotclock = pipe_config->port_clock; + +if (pipe_config->pixel_multiplier) + dotclock /= pipe_config->pixel_multiplier; + + pipe_config->base.adjusted_mode.crtc_clock = dotclock; +}static void skl_ddi_clock_get (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config)
@@ -901,12 +921,7 @@ static void skl_ddi_clock_get(struct intel_encoder *encoder, pipe_config->port_clock = link_clock; -if (pipe_config->has_dp_encoder) - pipe_config->base.adjusted_mode.crtc_clock = -intel_dotclock_calculate (pipe_config->port_clock, - &pipe_config->dp_m_n); -else - pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock; +ddi_dotclock_get (pipe_config); } static void hsw_ddi_clock_get(struct intel_encoder *encoder,
@@ -953,16 +968,7 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder, pipe_config->port_clock = link_clock *2 ; -if (pipe_config->has_pch_encoder) - pipe_config->base.adjusted_mode.crtc_clock = -intel_dotclock_calculate (pipe_config->port_clock, - &pipe_config->fdi_m_n); -else if (pipe_config->has_dp_encoder) - pipe_config->base.adjusted_mode.crtc_clock = -intel_dotclock_calculate (pipe_config->port_clock, - &pipe_config->dp_m_n); -else - pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock; +ddi_dotclock_get (pipe_config); } static int bxt_calc_pll_link(struct drm_i915_private *dev_priv,
@@ -979,16 +985,9 @@ static void bxt_ddi_clock_get(struct intel_encoder *encoder,enum port port =intel_ddi_get_encoder_port (encoder);uint32_t dpll = port; - pipe_config->port_clock = -bxt_calc_pll_link (dev_priv, dpll); + pipe_config->port_clock =bxt_calc_pll_link (dev_priv, dpll); -if (pipe_config->has_dp_encoder) - pipe_config->base.adjusted_mode.crtc_clock = -intel_dotclock_calculate (pipe_config->port_clock, - &pipe_config->dp_m_n); -else - pipe_config->base.adjusted_mode.crtc_clock = - pipe_config->port_clock; +ddi_dotclock_get (pipe_config); } void intel_ddi_clock_get(struct intel_encoder *encoder,
Signature · 6 lines
2.3.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/4 drm/i915: Bump HDMI min port clock to 25 MHz
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Increase the HDMI port minimum port clock from 20 to 25 MHz. This is is the minimum listed in the DVI/HDMI specs, and it's also the documented minimum DPLL frequency for most of our platforms.
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -1175,7 +1175,7 @@ intel_hdmi_mode_valid(struct drm_connector *connector,if (clock >hdmi_portclock_limit (intel_attached_hdmi (connector), true))return MODE_CLOCK_HIGH ; -if (clock <20000 ) +if (clock <25000 )return MODE_CLOCK_LOW ;if (mode->flags &DRM_MODE_FLAG_DBLSCAN )
Signature · 6 lines
2.3.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/4 drm/i915: Account for CHV/BXT DPLL clock limitations
In reply to [email protected]From: Ville Syrjälä <[email protected]>
CHV/BXT DPLL can't generate frequencies in the 216-240 MHz range. Account for that when checking whether the HDMI port clock is valid. This is particularly important for BXT since it can otherwise do 12bpc, and standard 1920x1080p60 CEA modes land right in the middle of that range when the clock gets multiplied to account for 12bpc.
With the extra checks we will now filter out any mode where both 8bpc and 12bpc clock are within the gap. During modeset we then pick whichever mode works, favoring 12bpc if both are possible.
12bpc isn't supported on CHV so we simply end up filtering out any mode where the 8bpc port clock is in the gap.
--- drivers/gpu/drm/i915/intel_hdmi.c | 52 ++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +38 -14
@@ -1151,7 +1151,7 @@ static void pch_post_disable_hdmi(struct intel_encoder *encoder)intel_disable_hdmi (encoder); } -static int hdmi_portclock_limit (struct intel_hdmi *hdmi,bool respect_dvi_limit) +static int hdmi_port_clock_limit (struct intel_hdmi *hdmi,bool respect_dvi_limit) {struct drm_device *dev =intel_hdmi_to_dev (hdmi);
@@ -1164,24 +1164,48 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit) }static enum drm_mode_status +hdmi_port_clock_valid (struct intel_hdmi *hdmi, +int clock,bool respect_dvi_limit) +{ +struct drm_device *dev =intel_hdmi_to_dev (hdmi); + +if (clock <25000 ) +return MODE_CLOCK_LOW ; +if (clock >hdmi_port_clock_limit (hdmi, respect_dvi_limit)) +return MODE_CLOCK_HIGH ; + +/* CHV/BXT DPLL can't generate 216-240 MHz */ +if ((IS_CHERRYVIEW (dev) ||IS_BROXTON (dev)) && + clock >216000 && clock <240000 ) +return MODE_CLOCK_RANGE ; + +return MODE_OK ; +} + +static enum drm_mode_status intel_hdmi_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) { -int clock = mode->clock; +struct intel_hdmi *hdmi =intel_attached_hdmi (connector); +struct drm_device *dev =intel_hdmi_to_dev (hdmi); +enum drm_mode_status status; +int clock; + +if (mode->flags &DRM_MODE_FLAG_DBLSCAN ) +return MODE_NO_DBLESCAN ; + clock = mode->clock;if (mode->flags &DRM_MODE_FLAG_DBLCLK ) clock *=2 ; -if (clock >hdmi_portclock_limit (intel_attached_hdmi (connector), - true)) -return MODE_CLOCK_HIGH ; -if (clock <25000 ) -return MODE_CLOCK_LOW ; +/* check if we can do 8bpc */ + status =hdmi_port_clock_valid (hdmi, clock, true); -if (mode->flags &DRM_MODE_FLAG_DBLSCAN ) -return MODE_NO_DBLESCAN ; +/* if we can't do 8bpc we may still be able to do 12bpc */ +if (!HAS_GMCH_DISPLAY (dev) && status !=MODE_OK ) + status =hdmi_port_clock_valid (hdmi, clock *3 /2 , true); -return MODE_OK ; +return status; }static bool hdmi_12bpc_possible (struct intel_crtc_state *crtc_state)
@@ -1223,7 +1247,6 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct drm_device *dev = encoder->base.dev;struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;int clock_12bpc = pipe_config->base.adjusted_mode.crtc_clock *3 /2 ; -int portclock_limit =hdmi_portclock_limit (intel_hdmi, false);int desired_bpp; pipe_config->has_hdmi_sink = intel_hdmi->has_hdmi_sink;
@@ -1261,7 +1284,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,* within limits. */ if (pipe_config->pipe_bpp >8 *3 && pipe_config->has_hdmi_sink && - clock_12bpc <= portclock_limit && +hdmi_port_clock_valid (intel_hdmi, clock_12bpc, false) ==MODE_OK &&hdmi_12bpc_possible (pipe_config) &&0 /* FIXME 12bpc support totally broken */ ) {DRM_DEBUG_KMS ("picking bpc to 12 for HDMI output\n" );
@@ -1279,8 +1302,9 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->pipe_bpp = desired_bpp; } -if (adjusted_mode->crtc_clock > portclock_limit) { -DRM_DEBUG_KMS ("too high HDMI clock, rejecting mode\n" ); +if (hdmi_port_clock_valid (intel_hdmi, adjusted_mode->crtc_clock, + false) !=MODE_OK ) { +DRM_DEBUG_KMS ("unsupported HDMI clock, rejecting mode\n" );return false; }
Signature · 6 lines
2.3.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/4 drm/i915: Account for CHV/BXT DPLL clock limitations
From: Ville Syrjälä <[email protected]>
CHV/BXT DPLL can't generate frequencies in the 216-240 MHz range. Account for that when checking whether the HDMI port clock is valid. This is particularly important for BXT since it can otherwise do 12bpc, and standard 1920x1080p60 CEA modes land right in the middle of that range when the clock gets multiplied to account for 12bpc.
With the extra checks we will now filter out any mode where both 8bpc and 12bpc clock are within the gap. During modeset we then pick whichever mode works, favoring 12bpc if both are possible.
12bpc isn't supported on CHV so we simply end up filtering out any mode where the 8bpc port clock is in the gap.
v2: Fix crtc_clock vs. port_clock fumble in compute_config() (Imre)
--- drivers/gpu/drm/i915/intel_hdmi.c | 58 +++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +43 -15
@@ -1151,7 +1151,7 @@ static void pch_post_disable_hdmi(struct intel_encoder *encoder)intel_disable_hdmi (encoder); } -static int hdmi_portclock_limit (struct intel_hdmi *hdmi,bool respect_dvi_limit) +static int hdmi_port_clock_limit (struct intel_hdmi *hdmi,bool respect_dvi_limit) {struct drm_device *dev =intel_hdmi_to_dev (hdmi);
@@ -1164,24 +1164,48 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit) }static enum drm_mode_status +hdmi_port_clock_valid (struct intel_hdmi *hdmi, +int clock,bool respect_dvi_limit) +{ +struct drm_device *dev =intel_hdmi_to_dev (hdmi); + +if (clock <25000 ) +return MODE_CLOCK_LOW ; +if (clock >hdmi_port_clock_limit (hdmi, respect_dvi_limit)) +return MODE_CLOCK_HIGH ; + +/* CHV/BXT DPLL can't generate 216-240 MHz */ +if ((IS_CHERRYVIEW (dev) ||IS_BROXTON (dev)) && + clock >216000 && clock <240000 ) +return MODE_CLOCK_RANGE ; + +return MODE_OK ; +} + +static enum drm_mode_status intel_hdmi_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) { -int clock = mode->clock; +struct intel_hdmi *hdmi =intel_attached_hdmi (connector); +struct drm_device *dev =intel_hdmi_to_dev (hdmi); +enum drm_mode_status status; +int clock; + +if (mode->flags &DRM_MODE_FLAG_DBLSCAN ) +return MODE_NO_DBLESCAN ; + clock = mode->clock;if (mode->flags &DRM_MODE_FLAG_DBLCLK ) clock *=2 ; -if (clock >hdmi_portclock_limit (intel_attached_hdmi (connector), - true)) -return MODE_CLOCK_HIGH ; -if (clock <25000 ) -return MODE_CLOCK_LOW ; +/* check if we can do 8bpc */ + status =hdmi_port_clock_valid (hdmi, clock, true); -if (mode->flags &DRM_MODE_FLAG_DBLSCAN ) -return MODE_NO_DBLESCAN ; +/* if we can't do 8bpc we may still be able to do 12bpc */ +if (!HAS_GMCH_DISPLAY (dev) && status !=MODE_OK ) + status =hdmi_port_clock_valid (hdmi, clock *3 /2 , true); -return MODE_OK ; +return status; }static bool hdmi_12bpc_possible (struct intel_crtc_state *crtc_state)
@@ -1222,8 +1246,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);struct drm_device *dev = encoder->base.dev;struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; -int clock_12bpc = pipe_config->base.adjusted_mode.crtc_clock *3 /2 ; -int portclock_limit =hdmi_portclock_limit (intel_hdmi, false); +int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock; +int clock_12bpc = clock_8bpc *3 /2 ;int desired_bpp; pipe_config->has_hdmi_sink = intel_hdmi->has_hdmi_sink;
@@ -1242,6 +1266,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK ) { pipe_config->pixel_multiplier =2 ; + clock_8bpc *=2 ; clock_12bpc *=2 ; }
@@ -1261,7 +1286,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,* within limits. */ if (pipe_config->pipe_bpp >8 *3 && pipe_config->has_hdmi_sink && - clock_12bpc <= portclock_limit && +hdmi_port_clock_valid (intel_hdmi, clock_12bpc, false) ==MODE_OK &&hdmi_12bpc_possible (pipe_config) &&0 /* FIXME 12bpc support totally broken */ ) {DRM_DEBUG_KMS ("picking bpc to 12 for HDMI output\n" );
@@ -1272,6 +1297,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, }else {DRM_DEBUG_KMS ("picking bpc to 8 for HDMI output\n" ); desired_bpp =8 *3 ; + + pipe_config->port_clock = clock_8bpc; }if (!pipe_config->bw_constrained) {
@@ -1279,8 +1306,9 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, pipe_config->pipe_bpp = desired_bpp; } -if (adjusted_mode->crtc_clock > portclock_limit) { -DRM_DEBUG_KMS ("too high HDMI clock, rejecting mode\n" ); +if (hdmi_port_clock_valid (intel_hdmi, pipe_config->port_clock, + false) !=MODE_OK ) { +DRM_DEBUG_KMS ("unsupported HDMI clock, rejecting mode\n" );return false; }
Signature · 6 lines
2.3.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/4 Revert "drm/i915: Disable 12bpc hdmi for now"
In reply to [email protected]From: Ville Syrjälä <[email protected]>
HDMI 12bpc should be working fine now. Let it loose.
This reverts commit 5e3daaca09f5158eff9c92290faa1d2001ecc6e4.
v2: Rebased due to CHV/BXT port clock check improvemnts
--- drivers/gpu/drm/i915/intel_hdmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -2
@@ -1285,8 +1285,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,*/ if (pipe_config->pipe_bpp >8 *3 && pipe_config->has_hdmi_sink &&hdmi_port_clock_valid (intel_hdmi, clock_12bpc, false) ==MODE_OK && -hdmi_12bpc_possible (pipe_config) && -0 /* FIXME 12bpc support totally broken */ ) { +hdmi_12bpc_possible (pipe_config)) {DRM_DEBUG_KMS ("picking bpc to 12 for HDMI output\n" ); desired_bpp =12 *3 ;
Signature · 6 lines
2.3.6 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 21 lines · On Tue, 2015-06-30 at 15:33 +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Here's my second attempt at flipping HDMI 12bpc back on. In my last attempt [1] Imre found that lots of standard CEA modes (1080p60 etc.) no longer work on BXT due to the 12bpc port clock landing in a range that the DPLL can't generate. CHV has the same limitation but it doesn't do 12bpc so the situation there isn't as bad.
This series attempts to work around this problem by falling back to 8bpc when the 1.5x port clock frequency turns out to be bad. Additionally we will from now on filter out any mode where both 8bpc and 12bpc port clock is bad.
[1] http://lists.freedesktop.org/archives/intel-gfx/2015-June/068988.html
Ville Syrjälä (4):
drm/i915: Fix HDMI 12bpc and pixel repeat clock readout for DDI
platforms
drm/i915: Bump HDMI min port clock to 25 MHz drm/i915: Account for CHV/BXT DPLL clock limittions Revert "drm/i915: Disable 12bpc hdmi for now"
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c | 49 +++++++++++++++++----------------- drivers/gpu/drm/i915/intel_hdmi.c | 55 +++++++++++++++++++++++++++------------ 2 files changed, 63 insertions(+), 41 deletions(-)
Looks ok to me. 12bpc modesets and the fall-back logic seems to work fine on BXT. On the series:
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 22 lines · Imre Deak
Quoted 21 lines · On Tue, 2015-06-30 at 15:33 +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Here's my second attempt at flipping HDMI 12bpc back on. In my last attempt [1] Imre found that lots of standard CEA modes (1080p60 etc.) no longer work on BXT due to the 12bpc port clock landing in a range that the DPLL can't generate. CHV has the same limitation but it doesn't do 12bpc so the situation there isn't as bad.
This series attempts to work around this problem by falling back to 8bpc when the 1.5x port clock frequency turns out to be bad. Additionally we will from now on filter out any mode where both 8bpc and 12bpc port clock is bad.
[1] http://lists.freedesktop.org/archives/intel-gfx/2015-June/068988.html
Ville Syrjälä (4):
drm/i915: Fix HDMI 12bpc and pixel repeat clock readout for DDI
platforms
drm/i915: Bump HDMI min port clock to 25 MHz drm/i915: Account for CHV/BXT DPLL clock limittions Revert "drm/i915: Disable 12bpc hdmi for now"
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c | 49 +++++++++++++++++----------------- drivers/gpu/drm/i915/intel_hdmi.c | 55 +++++++++++++++++++++++++++------------ 2 files changed, 63 insertions(+), 41 deletions(-)Looks ok to me. 12bpc modesets and the fall-back logic seems to work fine on BXT. On the series:
Reviewed-and-tested-by Imre Deak <[email protected]>
All merged to dinq, thanks.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx