drm/i915: Some FDI related dotclock stuff
Subsystems (2)
cover drm/i915: Some FDI related dotclock stuff
From: Ville Syrjälä <[email protected]>
Imre's SNB had a crappy BIOS that failed to configure the hardware correctly when hooked up to a 4K monitor, which then resulted in lots of noise from i915 when it was trying to make sense of the bad state. That spurred me to reorganize the FDI dotclock vs. encoder dotclock sanity check we have in the encoder .get_config() hooks. And while doing that I figured we might as well try to read out the actual VGA dotclock via sideband on HSW/BDW, which can then be compared to the one compute from FDI parameters.
Apparently a BIOS update solved the problem for Imre, but I think these patches still have some value by adding more thorough state cross checking on HSW/BDW, and just moving out the sanity checks from the state readout code makes quite a bit of sense to me, especially if we run into more buggy BIOSen. Though if people prefer, I could respin these without that particular change, ie. just keep the LPT-H dotclock readout and cross checking essentially.
I also ended up fixing the port clock limits for CRT for various platforms.
Ville Syrjälä (6):
drm/i915: Dump ddi_pll_sel in hex instead of decimal on HSW/BDW drm/i915: Move the encoder vs. FDI dotclock check out from encoder
.get_config()
drm/i915: Remove the SPLL==270Mhz assumption from
intel_fdi_link_freq()
drm/i915: Make the LPT iclkip 20MHz case more generic drm/i915: Read out VGA dotclock properly on LPT drm/i915: Try to fix CRT port clock limits
drivers/gpu/drm/i915/i915_reg.h | 8 +- drivers/gpu/drm/i915/intel_crt.c | 30 ++++---- drivers/gpu/drm/i915/intel_display.c | 143 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_dp.c | 11 +-- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_hdmi.c | 3 - drivers/gpu/drm/i915/intel_lvds.c | 8 +- drivers/gpu/drm/i915/intel_sdvo.c | 4 +- 8 files changed, 123 insertions(+), 88 deletions(-)
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/6 drm/i915: Dump ddi_pll_sel in hex instead of decimal on HSW/BDW
From: Ville Syrjälä <[email protected]>
On HSW/BDW ddi_pll_sel is the actual register value. Let's dump it in hex so that people migth actually understand what it says.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -12220,7 +12220,7 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, pipe_config->dpll_hw_state.cfgcr1, pipe_config->dpll_hw_state.cfgcr2); }else if (HAS_DDI (dev)) { -DRM_DEBUG_KMS ("ddi_pll_sel: %u; dpll_hw_state: wrpll: 0x%x spll: 0x%x\n" , +DRM_DEBUG_KMS ("ddi_pll_sel: 0x%x; dpll_hw_state: wrpll: 0x%x spll: 0x%x\n" , pipe_config->ddi_pll_sel, pipe_config->dpll_hw_state.wrpll, pipe_config->dpll_hw_state.spll);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/6] drm/i915: Dump ddi_pll_sel in hex instead of decimal on HSW/BDW
Quoted 6 lines · On ke, 2016-02-17 at 21:41 +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
On HSW/BDW
ddi_pll_selis the actual register value. Let's dump it in hex so that people migth actually understand what it says.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 9 lines
---
drivers/gpu/drm/i915/intel_display.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static void intel_dump_pipe_config(struct intel_crtc *crtc, · line 12226
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -12220,7 +12220,7 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, pipe_config->dpll_hw_state.cfgcr1, pipe_config->dpll_hw_state.cfgcr2); } else if (HAS_DDI(dev)) { -DRM_DEBUG_KMS ("ddi_pll_sel: %u; dpll_hw_state: wrpll: 0x%x spll: 0x%x\n" , +DRM_DEBUG_KMS ("ddi_pll_sel: 0x%x; dpll_hw_state: wrpll: 0x%x spll: 0x%x\n" , pipe_config->ddi_pll_sel, pipe_config->dpll_hw_state.wrpll, pipe_config->dpll_hw_state.spll);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 drm/i915: Move the encoder vs. FDI dotclock check out from encoder .get_config()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Currently we check if the encoder's idea of dotclock agrees with what we calculated based on the FDI parameters. We do this in the encoder .get_config() hooks, which isn't so nice in case the BIOS (or some other outside party) made a mess of the state and we're just trying to take over.
So as a prep step to being able sanitize such a bogus state, move the the sanity check to just after we've read out the entire state. If we then need to sanitize a bad state, it should be easier to move the sanity check to occur after sanitation instead of before it.
--- drivers/gpu/drm/i915/intel_crt.c | 10 +------ drivers/gpu/drm/i915/intel_display.c | 57 ++++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_dp.c | 11 ++----- drivers/gpu/drm/i915/intel_drv.h | 3 -- drivers/gpu/drm/i915/intel_hdmi.c | 3 -- drivers/gpu/drm/i915/intel_lvds.c | 8 +---- drivers/gpu/drm/i915/intel_sdvo.c | 4 +-- 7 files changed, 38 insertions(+), 58 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +1 -9
@@ -120,17 +120,9 @@ static unsigned int intel_crt_get_flags(struct intel_encoder *encoder)static void intel_crt_get_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->base.dev; -int dotclock; - pipe_config->base.adjusted_mode.flags |=intel_crt_get_flags (encoder); - dotclock = pipe_config->port_clock; - -if (HAS_PCH_SPLIT (dev)) -ironlake_check_encoder_dotclock (pipe_config, dotclock); - - pipe_config->base.adjusted_mode.crtc_clock = dotclock; + pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock; } static void hsw_crt_get_config(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_display.c +32 -25
114 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp.c +3 -8
@@ -2409,7 +2409,6 @@ static void intel_dp_get_config(struct intel_encoder *encoder,struct drm_i915_private *dev_priv = dev->dev_private;enum port port =dp_to_dig_port (intel_dp)->port;struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc); -int dotclock; tmp =I915_READ (intel_dp->output_reg);
@@ -2459,13 +2458,9 @@ static void intel_dp_get_config(struct intel_encoder *encoder, pipe_config->port_clock =270000 ; } - dotclock =intel_dotclock_calculate (pipe_config->port_clock, - &pipe_config->dp_m_n); - -if (HAS_PCH_SPLIT (dev_priv->dev) && port !=PORT_A ) -ironlake_check_encoder_dotclock (pipe_config, dotclock); - - pipe_config->base.adjusted_mode.crtc_clock = dotclock; + pipe_config->base.adjusted_mode.crtc_clock = +intel_dotclock_calculate (pipe_config->port_clock, + &pipe_config->dp_m_n);if (is_edp (intel_dp) && dev_priv->vbt.edp_bpp && pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) {
drivers/gpu/drm/i915/intel_drv.h +0 -3
@@ -1197,9 +1197,6 @@ void intel_dp_get_m_n(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config);void intel_dp_set_m_n (struct intel_crtc *crtc,enum link_m_n_set m_n);int intel_dotclock_calculate (int link_freq,const struct intel_link_m_n *m_n); -void -ironlake_check_encoder_dotclock (const struct intel_crtc_state *pipe_config, -int dotclock);bool bxt_find_best_dpll (struct intel_crtc_state *crtc_state,int target_clock,intel_clock_t *best_clock);int chv_calc_dpll_params (int refclk,intel_clock_t *pll_clock);
drivers/gpu/drm/i915/intel_hdmi.c +0 -3
@@ -952,9 +952,6 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,if (pipe_config->pixel_multiplier) dotclock /= pipe_config->pixel_multiplier; -if (HAS_PCH_SPLIT (dev_priv->dev)) -ironlake_check_encoder_dotclock (pipe_config, dotclock); - pipe_config->base.adjusted_mode.crtc_clock = dotclock; }
drivers/gpu/drm/i915/intel_lvds.c +1 -7
@@ -109,7 +109,6 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,struct drm_i915_private *dev_priv = dev->dev_private;struct intel_lvds_encoder *lvds_encoder =to_lvds_encoder (&encoder->base);u32 tmp, flags =0 ; -int dotclock; tmp =I915_READ (lvds_encoder->reg);if (tmp &LVDS_HSYNC_POLARITY )
@@ -130,12 +129,7 @@ static void intel_lvds_get_config(struct intel_encoder *encoder, pipe_config->gmch_pfit.control |= tmp &PANEL_8TO6_DITHER_ENABLE ; } - dotclock = pipe_config->port_clock; - -if (HAS_PCH_SPLIT (dev_priv->dev)) -ironlake_check_encoder_dotclock (pipe_config, dotclock); - - pipe_config->base.adjusted_mode.crtc_clock = dotclock; + pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock; }static void intel_pre_enable_lvds (struct intel_encoder *encoder)
drivers/gpu/drm/i915/intel_sdvo.c +1 -3
@@ -1398,12 +1398,10 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, } dotclock = pipe_config->port_clock; +if (pipe_config->pixel_multiplier) dotclock /= pipe_config->pixel_multiplier; -if (HAS_PCH_SPLIT (dev)) -ironlake_check_encoder_dotclock (pipe_config, dotclock); - pipe_config->base.adjusted_mode.crtc_clock = dotclock;/* Cross check the port pixel multiplier with the sdvo encoder state. */
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/6] drm/i915: Move the encoder vs. FDI dotclock check out from encoder .get_config()
Quoted 9 lines · On ke, 2016-02-17 at 21:41 +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Currently we check if the encoder's idea of dotclock agrees with what we calculated based on the FDI parameters. We do this in the encoder .get_config() hooks, which isn't so nice in case the BIOS (or some other
outside party) made a mess of the state and we're just trying to take over.
Quoted 6 lines
So as a prep step to being able sanitize such a bogus state, move the the sanity check to just after we've read out the entire state. If we then need to sanitize a bad state, it should be easier to move the sanity check to occur after sanitation instead of before it.
Signed-off-by Ville Syrjälä <[email protected]>
Separating the get-config and check steps makes things more logical in any case. Looks ok to me:
Quoted 315 lines
---
drivers/gpu/drm/i915/intel_crt.c | 10 +------drivers/gpu/drm/i915/intel_display.c| 57 ++++++++++++++++++++----
------------
drivers/gpu/drm/i915/intel_dp.c | 11 ++----- drivers/gpu/drm/i915/intel_drv.h | 3 --drivers/gpu/drm/i915/intel_hdmi.c | 3 -- drivers/gpu/drm/i915/intel_lvds.c | 8 +---- drivers/gpu/drm/i915/intel_sdvo.c | 4 +-- 7 files changed, 38 insertions(+), 58 deletions(-)drivers/gpu/drm/i915/intel_crt.c +0
-0@@ -120,17 +120,9 @@ static unsigned int intel_crt_get_flags(struct intel_encoder *encoder) static void intel_crt_get_config(struct intel_encoder *encoder,struct
intel_crtc_state*pipe_config)
{drivers/gpu/drm/i915/intel_crt.c +0
-3-struct drm_device *dev = encoder->base.dev; -int dotclock; -
pipe_config->base.adjusted_mode.flags|=intel_crt_get_flags(encoder);drivers/gpu/drm/i915/intel_crt.c +0
-4- dotclock = pipe_config->port_clock; - -if (HAS_PCH_SPLIT (dev)) - ironlake_check_encoder_dotclock(pipe_config,dotclock);
drivers/gpu/drm/i915/intel_crt.c +1
-2- - pipe_config->base.adjusted_mode.crtc_clock = dotclock; + pipe_config->base.adjusted_mode.crtc_clock = pipe_config-Quoted 1 line
port_clock;}
static void hsw_crt_get_config(structintel_encoder*encoder,drivers/gpu/drm/i915/intel_display.c +0
-0@@ -224,12 +224,11 @@ static void intel_update_czclk(struct drm_i915_private *dev_priv) }
static inline u32 /* units of 100MHz */drivers/gpu/drm/i915/intel_display.c +1
-1-intel_fdi_link_freq(struct drm_device *dev) +intel_fdi_link_freq(struct drm_i915_private *dev_priv){
drivers/gpu/drm/i915/intel_display.c +0
-2-if (IS_GEN5 (dev)) { - struct drm_i915_private *dev_priv = dev-Quoted 1 line
dev_private;drivers/gpu/drm/i915/intel_display.c +1
-0+if (IS_GEN5 (dev_priv))return (
I915_READ(FDI_PLL_BIOS_0)&FDI_PLL_FB_CLOCK_MASK) + 2;drivers/gpu/drm/i915/intel_display.c +1
-1- }else +else return 27;
}drivers/gpu/drm/i915/intel_display.c +1
-1@@ -6589,7 +6588,7 @@ retry:* Hence the bw of each lane in terms of the mode signal * is: */ - link_bw =intel_fdi_link_freq (dev) *MHz (100 )/KHz (1 )/10 ; + link_bw =intel_fdi_link_freq (to_i915 (dev)) *MHz (100 )/KHz (1 )/10 ;
fdi_dotclock=adjusted_mode->crtc_clock;drivers/gpu/drm/i915/intel_display.c +0
-0@@ -6601,8 +6600,7 @@ retry: intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock, link_bw, &pipe_config->fdi_m_n);drivers/gpu/drm/i915/intel_display.c +0
-2- ret = ironlake_check_fdi_lanes(intel_crtc->base.dev, - intel_crtc->pipe,
pipe_config);drivers/gpu/drm/i915/intel_display.c +1
-0+ ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe,
pipe_config);
if (ret ==-EINVAL&&pipe_config->pipe_bpp> 6*3) {pipe_config->pipe_bpp-= 2*3; DRM_DEBUG_KMS("fdi link bw constraint, reducing pipe bpp to %i\n",drivers/gpu/drm/i915/intel_display.c +0
-0@@ -10765,19 +10763,18 @@ int intel_dotclock_calculate(int link_freq, static void ironlake_pch_clock_get(struct intel_crtc *crtc,struct
intel_crtc_state*pipe_config)
{drivers/gpu/drm/i915/intel_display.c +1
-1-struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);
/* read outport_clockfrom the DPLL */
i9xx_crtc_clock_get(crtc, pipe_config);
/*drivers/gpu/drm/i915/intel_display.c +0
-2- * This value does not include pixel_multiplier. - * We will check that port_clock andadjusted_mode.crtc_clock
drivers/gpu/drm/i915/intel_display.c +3
-2- * agree once we know their relationship in the encoder's - * get_config() function. + * In case there is an active pipe without active ports, + * we may need some idea for the dotclock anyway. + * Calculate one based on the FDI configuration.*/
pipe_config->base.adjusted_mode.crtc_clock=drivers/gpu/drm/i915/intel_display.c +0
-1- intel_dotclock_calculate(intel_fdi_link_freq(dev) *10000,
drivers/gpu/drm/i915/intel_display.c +1
-0+ intel_dotclock_calculate(intel_fdi_link_freq(dev_priv) * 10000,
&pipe_config->fdi_m_n); }drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12788,6 +12785,24 @@ intel_pipe_config_compare(struct drm_device *dev, return ret; }
+static void intel_pipe_config_sanity_check(structdrm_i915_private*dev_priv,drivers/gpu/drm/i915/intel_display.c +1
-0+ const struct
intel_crtc_state*pipe_config)drivers/gpu/drm/i915/intel_display.c +3
-0+{ +if (pipe_config->has_pch_encoder) { + int fdi_dotclock =intel_dotclock_calculate(intel_fdi_link_freq(dev_priv) * 10000,
drivers/gpu/drm/i915/intel_display.c +1
-0+ &pipe_co
nfig->fdi_m_n);drivers/gpu/drm/i915/intel_display.c +1
-0+ int dotclock = pipe_config-Quoted 1 line
base.adjusted_mode.crtc_clock;
drivers/gpu/drm/i915/intel_display.c +6
-0+ +/* +* FDI already provided one idea for the dotclock. +* Yell if the encoder disagrees. +*/ + WARN(!intel_fuzzy_clock_check(fdi_dotclock,dotclock),
drivers/gpu/drm/i915/intel_display.c +1
-0+ "FDI dotclock and encoder dotclock mismatch,fdi: %i, encoder: %i\n",
drivers/gpu/drm/i915/intel_display.c +4
-0+ fdi_dotclock, dotclock); + } +} +static void
check_wm_state(struct drm_device *dev){
structdrm_i915_private*dev_priv=dev->dev_private;drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12961,6 +12976,8 @@ check_crtc_state(struct drm_device *dev, struct drm_atomic_state *old_state) if (!crtc->state->active) continue;drivers/gpu/drm/i915/intel_display.c +1
-0+ intel_pipe_config_sanity_check(dev_priv,
pipe_config);
+
sw_config=to_intel_crtc_state(crtc->state); if (!intel_pipe_config_compare(dev,sw_config,pipe_config, false)) {drivers/gpu/drm/i915/intel_display.c +0
-0@@ -13033,18 +13050,6 @@ intel_modeset_check_state(struct drm_device *dev, check_shared_dpll_state(dev); }
-void ironlake_check_encoder_dotclock(const structintel_crtc_state*pipe_config,drivers/gpu/drm/i915/intel_display.c +0
-7- int dotclock) -{ - /* - * FDI already provided one idea for the dotclock. - * Yell if the encoder disagrees. - */ - WARN(!intel_fuzzy_clock_check(pipe_config-Quoted 1 line
base.adjusted_mode.crtc_clock, dotclock),
drivers/gpu/drm/i915/intel_display.c +0
-1- "FDI dotclock and encoder dotclock mismatch, fdi: %i,encoder: %i\n",
drivers/gpu/drm/i915/intel_display.c +0
-3- pipe_config->base.adjusted_mode.crtc_clock, dotclock); -} -static void
update_scanline_offset(struct intel_crtc *crtc){
structdrm_device*dev =crtc->base.dev;drivers/gpu/drm/i915/intel_display.c +2
-0@@ -15847,6 +15852,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode); update_scanline_offset(crtc); } + +intel_pipe_config_sanity_check (dev_priv, crtc- >config);}
}drivers/gpu/drm/i915/intel_dp.c +0
-1@@ -2409,7 +2409,6 @@ static void intel_dp_get_config(struct intel_encoder *encoder, struct drm_i915_private *dev_priv = dev->dev_private; enum port port = dp_to_dig_port(intel_dp)->port; struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); -int dotclock;
tmp =I915_READ(intel_dp->output_reg);drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -2459,13 +2458,9 @@ static void intel_dp_get_config(structintel_encoder *encoder, pipe_config->port_clock = 270000; }drivers/gpu/drm/i915/intel_dp.c +0
-5- dotclock =intel_dotclock_calculate (pipe_config->port_clock, - &pipe_config->dp_m_n); - -if (HAS_PCH_SPLIT (dev_priv->dev) && port !=PORT_A ) - ironlake_check_encoder_dotclock(pipe_config,dotclock);
drivers/gpu/drm/i915/intel_dp.c +3
-2- - pipe_config->base.adjusted_mode.crtc_clock = dotclock; + pipe_config->base.adjusted_mode.crtc_clock = +intel_dotclock_calculate (pipe_config->port_clock, + &pipe_config->dp_m_n);
if (is_edp(intel_dp)&&dev_priv->vbt.edp_bpp&&pipe_config->pipe_bpp>dev_priv->vbt.edp_bpp) {drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1197,9 +1197,6 @@ void intel_dp_get_m_n(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config);void
intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
intintel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);drivers/gpu/drm/i915/intel_drv.h +0
-2-void -ironlake_check_encoder_dotclock(const struct intel_crtc_state
*pipe_config,drivers/gpu/drm/i915/intel_drv.h +0
-1- int dotclock);bool bxt_find_best_dpll(struct
intel_crtc_state*crtc_state, inttarget_clock,
intel_clock_t*best_clock);
intchv_calc_dpll_params(int refclk, intel_clock_t *pll_clock);drivers/gpu/drm/i915/intel_hdmi.c +0
-0@@ -952,9 +952,6 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, if (pipe_config->pixel_multiplier) dotclock /= pipe_config->pixel_multiplier;drivers/gpu/drm/i915/intel_hdmi.c +0
-2-if (HAS_PCH_SPLIT (dev_priv->dev)) - ironlake_check_encoder_dotclock(pipe_config,dotclock);
-
pipe_config->base.adjusted_mode.crtc_clock= dotclock; }drivers/gpu/drm/i915/intel_lvds.c +0
-0@@ -109,7 +109,6 @@ static void intel_lvds_get_config(struct intel_encoder *encoder, struct drm_i915_private *dev_priv = dev->dev_private;struct
intel_lvds_encoder*lvds_encoder=to_lvds_encoder(&encoder->base);
u32 tmp, flags = 0;drivers/gpu/drm/i915/intel_lvds.c +0
-1-int dotclock;
tmp =I915_READ(lvds_encoder->reg);
if (tmp &LVDS_HSYNC_POLARITY)drivers/gpu/drm/i915/intel_lvds.c +0
-0@@ -130,12 +129,7 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,
pipe_config->gmch_pfit.control|= tmp &PANEL_8TO6_DITHER_ENABLE;
}drivers/gpu/drm/i915/intel_lvds.c +0
-4- dotclock = pipe_config->port_clock; - -if (HAS_PCH_SPLIT (dev_priv->dev)) - ironlake_check_encoder_dotclock(pipe_config,dotclock);
drivers/gpu/drm/i915/intel_lvds.c +1
-2- - pipe_config->base.adjusted_mode.crtc_clock = dotclock; + pipe_config->base.adjusted_mode.crtc_clock = pipe_config-Quoted 1 line
port_clock;}
static voidintel_pre_enable_lvds(struct intel_encoder *encoder)drivers/gpu/drm/i915/intel_sdvo.c +0
-0@@ -1398,12 +1398,10 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, }
dotclock =pipe_config->port_clock;
+
if (pipe_config->pixel_multiplier) dotclock /=pipe_config->pixel_multiplier;drivers/gpu/drm/i915/intel_sdvo.c +0
-2-if (HAS_PCH_SPLIT (dev)) - ironlake_check_encoder_dotclock(pipe_config,
Quoted 6 lines
dotclock);
-
pipe_config->base.adjusted_mode.crtc_clock= dotclock;
/* Cross check the port pixel multiplier with the sdvo encoder state. */
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/6 drm/i915: Remove the SPLL==270Mhz assumption from intel_fdi_link_freq()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Instead of assuming we've correctly set up SPLL to run at 270Mhz for FDI, let's use the port_clock from pipe_config which should be what we want. This would catch problems if someone misconfigures SPLL for whatever reason.
--- drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +10 -7
@@ -224,12 +224,15 @@ static void intel_update_czclk(struct drm_i915_private *dev_priv) }static inline u32 /* units of 100MHz */ -intel_fdi_link_freq (struct drm_i915_private *dev_priv) +intel_fdi_link_freq (struct drm_i915_private *dev_priv, +const struct intel_crtc_state *pipe_config) { -if (IS_GEN5 (dev_priv)) -return (I915_READ (FDI_PLL_BIOS_0 ) &FDI_PLL_FB_CLOCK_MASK ) +2 ; +if (HAS_DDI (dev_priv)) +return pipe_config->port_clock;/* SPLL */ +else if (IS_GEN5 (dev_priv)) +return ((I915_READ (FDI_PLL_BIOS_0 ) &FDI_PLL_FB_CLOCK_MASK ) +2 ) *10000 ;else -return 27 ; +return 270000 ; }static const intel_limit_t intel_limits_i8xx_dac = {
@@ -6588,7 +6591,7 @@ retry:* Hence the bw of each lane in terms of the mode signal * is: */ - link_bw =intel_fdi_link_freq (to_i915 (dev)) *MHz (100 )/KHz (1 )/10 ; + link_bw =intel_fdi_link_freq (to_i915 (dev), pipe_config); fdi_dotclock = adjusted_mode->crtc_clock;
@@ -10774,7 +10777,7 @@ static void ironlake_pch_clock_get(struct intel_crtc *crtc,* Calculate one based on the FDI configuration. */ pipe_config->base.adjusted_mode.crtc_clock = -intel_dotclock_calculate (intel_fdi_link_freq (dev_priv) *10000 , +intel_dotclock_calculate (intel_fdi_link_freq (dev_priv, pipe_config), &pipe_config->fdi_m_n); }
@@ -12789,7 +12792,7 @@ static void intel_pipe_config_sanity_check(struct drm_i915_private *dev_priv, const struct intel_crtc_state *pipe_config) {if (pipe_config->has_pch_encoder) { -int fdi_dotclock =intel_dotclock_calculate (intel_fdi_link_freq (dev_priv) *10000 , +int fdi_dotclock =intel_dotclock_calculate (intel_fdi_link_freq (dev_priv, pipe_config), &pipe_config->fdi_m_n);int dotclock = pipe_config->base.adjusted_mode.crtc_clock;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/6] drm/i915: Remove the SPLL==270Mhz assumption from intel_fdi_link_freq()
Quoted 8 lines · On ke, 2016-02-17 at 21:41 +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Instead of assuming we've correctly set up SPLL to run at 270Mhz for FDI, let's use the
port_clockfrompipe_configwhich should be what we want. This would catch problems if someone misconfigures SPLL for whatever reason.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 67 lines
---
drivers/gpu/drm/i915/intel_display.c | 17 ++++++++++-------1 file changed, 10 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -224,12 +224,15 @@ static void intel_update_czclk(struct drm_i915_private *dev_priv) }
static inline u32 /* units of 100MHz */drivers/gpu/drm/i915/intel_display.c +2
-1-intel_fdi_link_freq(struct drm_i915_private *dev_priv) +intel_fdi_link_freq(struct drm_i915_private *dev_priv, + const struct intel_crtc_state *pipe_config){
drivers/gpu/drm/i915/intel_display.c +0
-2-if (IS_GEN5 (dev_priv)) - return (I915_READ(FDI_PLL_BIOS_0) &
FDI_PLL_FB_CLOCK_MASK) + 2;drivers/gpu/drm/i915/intel_display.c +4
-0+if (HAS_DDI (dev_priv)) +return pipe_config->port_clock;/* SPLL */ +else if (IS_GEN5 (dev_priv)) + return ((I915_READ(FDI_PLL_BIOS_0) &
FDI_PLL_FB_CLOCK_MASK) + 2) * 10000;
elsedrivers/gpu/drm/i915/intel_display.c +1
-1-return 27 ; +return 270000 ;}
static constintel_limit_tintel_limits_i8xx_dac= {drivers/gpu/drm/i915/intel_display.c +1
-1@@ -6588,7 +6591,7 @@ retry:* Hence the bw of each lane in terms of the mode signal * is: */ - link_bw =intel_fdi_link_freq (to_i915 (dev)) *MHz (100 )/KHz (1 )/10 ; + link_bw =intel_fdi_link_freq (to_i915 (dev), pipe_config);
fdi_dotclock=adjusted_mode->crtc_clock;drivers/gpu/drm/i915/intel_display.c +0
-0@@ -10774,7 +10777,7 @@ static void ironlake_pch_clock_get(structintel_crtc *crtc, * Calculate one based on the FDI configuration. */
pipe_config->base.adjusted_mode.crtc_clock=drivers/gpu/drm/i915/intel_display.c +0
-1- intel_dotclock_calculate(intel_fdi_link_freq(dev_priv) * 10000,
drivers/gpu/drm/i915/intel_display.c +1
-0+ intel_dotclock_calculate(intel_fdi_link_freq(dev_priv,
pipe_config),
&pipe_config->fdi_m_n); }drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12789,7 +12792,7 @@ static void intel_pipe_config_sanity_check(struct drm_i915_private *dev_priv,const struct
intel_crtc_state*pipe_config)
{
if (pipe_config->has_pch_encoder) {drivers/gpu/drm/i915/intel_display.c +0
-1- int fdi_dotclock =intel_dotclock_calculate(intel_fdi_link_freq(dev_priv) * 10000,
drivers/gpu/drm/i915/intel_display.c +1
-0+ int fdi_dotclock =
intel_dotclock_calculate(intel_fdi_link_freq(dev_priv, pipe_config), &pipe_co nfig->fdi_m_n);
int dotclock = pipe_config-
Quoted 2 lines
Quoted 1 line
base.adjusted_mode.crtc_clock;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 drm/i915: Make the LPT iclkip 20MHz case more generic
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The reason for spcial casing 20MHz in the iclkip calculations is that it would overflow the 7 bit divisor value. Let's rewrite the special case to check for just that, and bump up auxdiv when needed. This makes the code work for freqeuencies close to but not exactly 20MHz. The real lower limit for auxdiv=0 is actually:
172800000/(0x7f+2)*64)=~20930 kHz, and below that we must resort to auxdiv=1.
Actually this is all very theoretical since we limit the dotclock to min 25MHz with CRT on all platforms. 25Mhz is actually the documented limit in Bspec, so it seems we ought to never need to worry about the auxdiv=1 case. But no harm in having it.
--- drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_display.c +19 -21
@@ -3957,37 +3957,35 @@ static void lpt_disable_iclkip(struct drm_i915_private *dev_priv)/* Program iCLKIP clock to the desired frequency */ static void lpt_program_iclkip (struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv =to_i915 (crtc->dev);int clock =to_intel_crtc (crtc)->config->base.adjusted_mode.crtc_clock;u32 divsel, phaseinc, auxdiv, phasedir =0 ;u32 temp;lpt_disable_iclkip (dev_priv); -/* 20MHz is a corner case which is out of range for the 7-bit divisor */ -if (clock ==20000 ) { - auxdiv =1 ; - divsel =0x41 ; - phaseinc =0x20 ; - }else { -/* The iCLK virtual clock root frequency is in MHz, -* but the adjusted_mode->crtc_clock in in KHz. To get the -* divisors, it is necessary to divide one by another, so we -* convert the virtual clock precision to KHz here for higher -* precision. -*/ +/* The iCLK virtual clock root frequency is in MHz, +* but the adjusted_mode->crtc_clock in in KHz. To get the +* divisors, it is necessary to divide one by another, so we +* convert the virtual clock precision to KHz here for higher +* precision. +*/ +for (auxdiv =0 ; auxdiv <2 ; auxdiv++) {u32 iclk_virtual_root_freq =172800 *1000 ;u32 iclk_pi_range =64 ; -u32 desired_divisor, msb_divisor_value, pi_value; +u32 desired_divisor; - desired_divisor =DIV_ROUND_CLOSEST (iclk_virtual_root_freq, clock); - msb_divisor_value = desired_divisor / iclk_pi_range; - pi_value = desired_divisor % iclk_pi_range; + desired_divisor =DIV_ROUND_CLOSEST (iclk_virtual_root_freq, + clock << auxdiv); + divsel = (desired_divisor / iclk_pi_range) -2 ; + phaseinc = desired_divisor % iclk_pi_range; - auxdiv =0 ; - divsel = msb_divisor_value -2 ; - phaseinc = pi_value; +/* +* Near 20MHz is a corner case which is +* out of range for the 7-bit divisor +*/ +if (divsel <=0x7f ) +break ; }/* This should not happen with any sane values */
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/6] drm/i915: Make the LPT iclkip 20MHz case more generic
Em Qua, 2016-02-17 às 21:41 +0200, [email protected] escreveu:
Quoted 12 lines
From: Ville Syrjälä <[email protected]>
The reason for spcial casing 20MHz in the iclkip calculations is that it would overflow the 7 bit divisor value. Let's rewrite the special case to check for just that, and bump up auxdiv when needed. This makes
the code work for freqeuencies close to but not exactly 20MHz. The real
lower limit for auxdiv=0 is actually:
172800000/(0x7f+2)*64)=~20930 kHz, and below that we must resort to auxdiv=1.
Quoted 4 lines
Actually this is all very theoretical since we limit the dotclock to min 25MHz with CRT on all platforms. 25Mhz is actually the documented limit in Bspec, so it seems we ought to never need to worry about the auxdiv=1 case. But no harm in having it.
I like the patch and it looks correct. The main "advantage" of the previous version is that it matched the spec exactly, so future code readers may be confused now. Maybe a little comment more explicitly explaining why it doesn't match the spec now would help: possibly some shorter version of your commit message, with the typos fixed.
Anyway, git-bisect should be enough and I'm fine even without the comment:
Quoted 77 lines
Cc Paulo Zanoni <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>---
drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++---------
----------1 file changed, 19 insertions(+), 21 deletions(-)drivers/gpu/drm/i915/intel_display.c +1
-2@@ -3957,37 +3957,35 @@ static void lpt_disable_iclkip(struct drm_i915_private *dev_priv) /* Program iCLKIP clock to the desired frequency */ static void lpt_program_iclkip(struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv =to_i915 (crtc->dev);int clock = to_intel_crtc(crtc)->config-
Quoted 1 line
base.adjusted_mode.crtc_clock;
u32 divsel, phaseinc, auxdiv, phasedir = 0; u32 temp;
lpt_disable_iclkip(dev_priv);drivers/gpu/drm/i915/intel_display.c +0
-1-/* 20MHz is a corner case which is out of range for the 7- bit divisor */
drivers/gpu/drm/i915/intel_display.c +0
-7-if (clock ==20000 ) { - auxdiv =1 ; - divsel =0x41 ; - phaseinc =0x20 ; - }else { -/* The iCLK virtual clock root frequency is in MHz, -* but the adjusted_mode->crtc_clock in in KHz. To get the
drivers/gpu/drm/i915/intel_display.c +0
-1- * divisors, it is necessary to divide one byanother, so we
drivers/gpu/drm/i915/intel_display.c +0
-1- * convert the virtual clock precision to KHz herefor higher
drivers/gpu/drm/i915/intel_display.c +4
-2-* precision. -*/ +/* The iCLK virtual clock root frequency is in MHz, +* but the adjusted_mode->crtc_clock in in KHz. To get the +* divisors, it is necessary to divide one by another, so we +* convert the virtual clock precision to KHz here for higher
drivers/gpu/drm/i915/intel_display.c +3
-0+* precision. +*/ +for (auxdiv =0 ; auxdiv <2 ; auxdiv++) {u32
iclk_virtual_root_freq= 172800 * 1000; u32iclk_pi_range= 64;drivers/gpu/drm/i915/intel_display.c +1
-1-u32 desired_divisor, msb_divisor_value, pi_value; +u32 desired_divisor;drivers/gpu/drm/i915/intel_display.c +0
-1- desired_divisor =
DIV_ROUND_CLOSEST(iclk_virtual_root_freq, clock);drivers/gpu/drm/i915/intel_display.c +1
-2- msb_divisor_value = desired_divisor / iclk_pi_range; - pi_value = desired_divisor % iclk_pi_range; + desired_divisor =DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
drivers/gpu/drm/i915/intel_display.c +1
-0+ clock <<auxdiv);
drivers/gpu/drm/i915/intel_display.c +2
-0+ divsel = (desired_divisor / iclk_pi_range) -2 ; + phaseinc = desired_divisor % iclk_pi_range;drivers/gpu/drm/i915/intel_display.c +6
-3- auxdiv =0 ; - divsel = msb_divisor_value -2 ; - phaseinc = pi_value; +/* +* Near 20MHz is a corner case which is +* out of range for the 7-bit divisor +*/ +if (divsel <=0x7f ) +break ;
Quoted 3 lines
}
/* This should not happen with any sane values */
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/6] drm/i915: Make the LPT iclkip 20MHz case more generic
In reply to [email protected]Quoted 12 lines · On ke, 2016-02-17 at 21:41 +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The reason for spcial casing 20MHz in the iclkip calculations is that it would overflow the 7 bit divisor value. Let's rewrite the special case to check for just that, and bump up auxdiv when needed. This makes
the code work for freqeuencies close to but not exactly 20MHz. The real
lower limit for auxdiv=0 is actually:
172800000/(0x7f+2)*64)=~20930 kHz, and below that we must resort to auxdiv=1.
Quoted 7 lines
Actually this is all very theoretical since we limit the dotclock to min 25MHz with CRT on all platforms. 25Mhz is actually the documented limit in Bspec, so it seems we ought to never need to worry about the auxdiv=1 case. But no harm in having it.
Cc Paulo Zanoni <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Yep, fewer special casing is better. Btw, the spec could have just as well describe how to calculate aux_div instead of providing special cases and tables, I wonder why this is done at places. The patch looks good:
Quoted 74 lines
---
drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++---------
----------1 file changed, 19 insertions(+), 21 deletions(-)drivers/gpu/drm/i915/intel_display.c +1
-2@@ -3957,37 +3957,35 @@ static void lpt_disable_iclkip(struct drm_i915_private *dev_priv) /* Program iCLKIP clock to the desired frequency */ static void lpt_program_iclkip(struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv =to_i915 (crtc->dev);int clock = to_intel_crtc(crtc)->config-
Quoted 1 line
base.adjusted_mode.crtc_clock;
u32 divsel, phaseinc, auxdiv, phasedir = 0; u32 temp;
lpt_disable_iclkip(dev_priv);drivers/gpu/drm/i915/intel_display.c +0
-1-/* 20MHz is a corner case which is out of range for the 7- bit divisor */
drivers/gpu/drm/i915/intel_display.c +0
-7-if (clock ==20000 ) { - auxdiv =1 ; - divsel =0x41 ; - phaseinc =0x20 ; - }else { -/* The iCLK virtual clock root frequency is in MHz, -* but the adjusted_mode->crtc_clock in in KHz. To get the
drivers/gpu/drm/i915/intel_display.c +0
-1- * divisors, it is necessary to divide one byanother, so we
drivers/gpu/drm/i915/intel_display.c +0
-1- * convert the virtual clock precision to KHz herefor higher
drivers/gpu/drm/i915/intel_display.c +4
-2-* precision. -*/ +/* The iCLK virtual clock root frequency is in MHz, +* but the adjusted_mode->crtc_clock in in KHz. To get the +* divisors, it is necessary to divide one by another, so we +* convert the virtual clock precision to KHz here for higher
drivers/gpu/drm/i915/intel_display.c +3
-0+* precision. +*/ +for (auxdiv =0 ; auxdiv <2 ; auxdiv++) {u32
iclk_virtual_root_freq= 172800 * 1000; u32iclk_pi_range= 64;drivers/gpu/drm/i915/intel_display.c +1
-1-u32 desired_divisor, msb_divisor_value, pi_value; +u32 desired_divisor;drivers/gpu/drm/i915/intel_display.c +0
-1- desired_divisor =
DIV_ROUND_CLOSEST(iclk_virtual_root_freq, clock);drivers/gpu/drm/i915/intel_display.c +1
-2- msb_divisor_value = desired_divisor / iclk_pi_range; - pi_value = desired_divisor % iclk_pi_range; + desired_divisor =DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
drivers/gpu/drm/i915/intel_display.c +1
-0+ clock <<auxdiv);
drivers/gpu/drm/i915/intel_display.c +2
-0+ divsel = (desired_divisor / iclk_pi_range) -2 ; + phaseinc = desired_divisor % iclk_pi_range;drivers/gpu/drm/i915/intel_display.c +6
-3- auxdiv =0 ; - divsel = msb_divisor_value -2 ; - phaseinc = pi_value; +/* +* Near 20MHz is a corner case which is +* out of range for the 7-bit divisor +*/ +if (divsel <=0x7f ) +break ;
Quoted 3 lines
}
/* This should not happen with any sane values */
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 drm/i915: Read out VGA dotclock properly on LPT
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Rather than assume the VGA dotclock is really the FDI based thing, let's read out the real thing via iclkip, and after readout it'll get to compare it with the FDI based number to make sure they're in sync.
--- drivers/gpu/drm/i915/i915_reg.h | 8 ++++++-- drivers/gpu/drm/i915/intel_crt.c | 4 ++++ drivers/gpu/drm/i915/intel_display.c | 37 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + 4 files changed, 48 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -2
@@ -7362,9 +7362,11 @@ enum skl_disp_power_wells {/* SBI offsets */ #define SBI_SSCDIVINTPHASE 0x0200#define SBI_SSCDIVINTPHASE6 0x0600 -#define SBI_SSCDIVINTPHASE_DIVSEL_MASK ((0x7f)<<1) +#define SBI_SSCDIVINTPHASE_DIVSEL_SHIFT 1 +#define SBI_SSCDIVINTPHASE_DIVSEL_MASK (0x7f<<1)#define SBI_SSCDIVINTPHASE_DIVSEL (x) ((x)<<1) -#define SBI_SSCDIVINTPHASE_INCVAL_MASK ((0x7f)<<8) +#define SBI_SSCDIVINTPHASE_INCVAL_SHIFT 8 +#define SBI_SSCDIVINTPHASE_INCVAL_MASK (0x7f<<8)#define SBI_SSCDIVINTPHASE_INCVAL (x) ((x)<<8)#define SBI_SSCDIVINTPHASE_DIR (x) ((x)<<15)#define SBI_SSCDIVINTPHASE_PROPAGATE (1<<0)
@@ -7374,6 +7376,8 @@ enum skl_disp_power_wells {#define SBI_SSCCTL_PATHALT (1<<3)#define SBI_SSCCTL_DISABLE (1<<0)#define SBI_SSCAUXDIV6 0x0610 +#define SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT 4 +#define SBI_SSCAUXDIV_FINALDIV2SEL_MASK (1<<4)#define SBI_SSCAUXDIV_FINALDIV2SEL (x) ((x)<<4)#define SBI_DBUFF0 0x2a00#define SBI_GEN0 0x1f00
drivers/gpu/drm/i915/intel_crt.c +4 -0
@@ -128,6 +128,8 @@ static void intel_crt_get_config(struct intel_encoder *encoder,static void hsw_crt_get_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config) { +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +intel_ddi_get_config (encoder, pipe_config); pipe_config->base.adjusted_mode.flags &= ~(DRM_MODE_FLAG_PHSYNC |
@@ -135,6 +137,8 @@ static void hsw_crt_get_config(struct intel_encoder *encoder,DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC); pipe_config->base.adjusted_mode.flags |=intel_crt_get_flags (encoder); + + pipe_config->base.adjusted_mode.crtc_clock =lpt_get_iclkip (dev_priv); }/* Note: The caller is required to filter out dpms modes not supported by the
drivers/gpu/drm/i915/intel_display.c +37 -0
@@ -4032,6 +4032,43 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)I915_WRITE (PIXCLK_GATE ,PIXCLK_GATE_UNGATE ); } +int lpt_get_iclkip (struct drm_i915_private *dev_priv) +{ +u32 divsel, phaseinc, auxdiv; +u32 iclk_virtual_root_freq =172800 *1000 ; +u32 iclk_pi_range =64 ; +u32 desired_divisor; +u32 temp; + +if ((I915_READ (PIXCLK_GATE ) &PIXCLK_GATE_UNGATE ) ==0 ) +return 0 ; + +mutex_lock (&dev_priv->sb_lock); + + temp =intel_sbi_read (dev_priv,SBI_SSCCTL6 ,SBI_ICLK ); +if (temp &SBI_SSCCTL_DISABLE ) { +mutex_unlock (&dev_priv->sb_lock); +return 0 ; + } + + temp =intel_sbi_read (dev_priv,SBI_SSCDIVINTPHASE6 ,SBI_ICLK ); + divsel = (temp &SBI_SSCDIVINTPHASE_DIVSEL_MASK ) >> +SBI_SSCDIVINTPHASE_DIVSEL_SHIFT ; + phaseinc = (temp &SBI_SSCDIVINTPHASE_INCVAL_MASK ) >> +SBI_SSCDIVINTPHASE_INCVAL_SHIFT ; + + temp =intel_sbi_read (dev_priv,SBI_SSCAUXDIV6 ,SBI_ICLK ); + auxdiv = (temp &SBI_SSCAUXDIV_FINALDIV2SEL_MASK ) >> +SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT ; + +mutex_unlock (&dev_priv->sb_lock); + + desired_divisor = (divsel +2 ) * iclk_pi_range + phaseinc; + +return DIV_ROUND_CLOSEST (iclk_virtual_root_freq, + desired_divisor << auxdiv); +} +static void ironlake_pch_transcoder_set_timings (struct intel_crtc *crtc,enum pipe pch_transcoder) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1158,6 +1158,7 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,int vlv_force_pll_on (struct drm_device *dev,enum pipe pipe,const struct dpll *dpll);void vlv_force_pll_off (struct drm_device *dev,enum pipe pipe); +int lpt_get_iclkip (struct drm_i915_private *dev_priv);/* modesetting asserts */ void assert_panel_unlocked(struct drm_i915_private *dev_priv,
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/6] drm/i915: Read out VGA dotclock properly on LPT
Quoted 9 lines · On ke, 2016-02-17 at 21:41 +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Rather than assume the VGA dotclock is really the FDI based thing, let's read out the real thing via iclkip, and after readout it'll get to compare it with the FDI based number to make sure they're in sync.
Cc Paulo Zanoni <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 130 lines
---
drivers/gpu/drm/i915/i915_reg.h | 8 ++++++-- drivers/gpu/drm/i915/intel_crt.c | 4 ++++drivers/gpu/drm/i915/intel_display.c| 37
++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_drv.h | 1 +4 files changed, 48 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +6
-2@@ -7362,9 +7362,11 @@ enum skl_disp_power_wells { /* SBI offsets */ #define SBI_SSCDIVINTPHASE 0x0200 #define SBI_SSCDIVINTPHASE6 0x0600 -#define SBI_SSCDIVINTPHASE_DIVSEL_MASK ((0x7f)<<1) +#define SBI_SSCDIVINTPHASE_DIVSEL_SHIFT 1 +#define SBI_SSCDIVINTPHASE_DIVSEL_MASK (0x7f<<1) #define SBI_SSCDIVINTPHASE_DIVSEL(x) ((x)<<1) -#define SBI_SSCDIVINTPHASE_INCVAL_MASK ((0x7f)<<8) +#define SBI_SSCDIVINTPHASE_INCVAL_SHIFT 8 +#define SBI_SSCDIVINTPHASE_INCVAL_MASK (0x7f<<8) #define SBI_SSCDIVINTPHASE_INCVAL(x) ((x)<<8) #define SBI_SSCDIVINTPHASE_DIR(x) ((x)<<15) #define SBI_SSCDIVINTPHASE_PROPAGATE (1<<0)@@ -7374,6 +7376,8 @@ enum skl_disp_power_wells { #define SBI_SSCCTL_PATHALT (1<<3) #define SBI_SSCCTL_DISABLE (1<<0) #define SBI_SSCAUXDIV6 0x0610 +#define SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT 4 +#define SBI_SSCAUXDIV_FINALDIV2SEL_MASK (1<<4) #define SBI_SSCAUXDIV_FINALDIV2SEL(x) ((x)<<4) #define SBI_DBUFF0 0x2a00 #define SBI_GEN0 0x1f00drivers/gpu/drm/i915/intel_crt.c +2
-0@@ -128,6 +128,8 @@ static void intel_crt_get_config(structintel_encoder *encoder, static void hsw_crt_get_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) { + struct drm_i915_private *dev_priv = to_i915(encoder- >base.dev); + intel_ddi_get_config(encoder, pipe_config);
pipe_config->base.adjusted_mode.flags&=
~(DRM_MODE_FLAG_PHSYNC |drivers/gpu/drm/i915/intel_crt.c +0
-0@@ -135,6 +137,8 @@ static void hsw_crt_get_config(struct intel_encoder *encoder,DRM_MODE_FLAG_PVSYNC |
DRM_MODE_FLAG_NVSYNC);pipe_config->base.adjusted_mode.flags|=intel_crt_get_flags(encoder);drivers/gpu/drm/i915/intel_crt.c +2
-0+ + pipe_config->base.adjusted_mode.crtc_clock =
lpt_get_iclkip(dev_priv);
}
/* Note: The caller is required to filter out dpms modes not supported by thedrivers/gpu/drm/i915/intel_display.c +0
-0@@ -4032,6 +4032,43 @@ static void lpt_program_iclkip(struct drm_crtc *crtc) I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE); }drivers/gpu/drm/i915/intel_display.c +20
-0+int lpt_get_iclkip (struct drm_i915_private *dev_priv) +{ +u32 divsel, phaseinc, auxdiv; +u32 iclk_virtual_root_freq =172800 *1000 ; +u32 iclk_pi_range =64 ; +u32 desired_divisor; +u32 temp; + +if ((I915_READ (PIXCLK_GATE ) &PIXCLK_GATE_UNGATE ) ==0 ) +return 0 ; + +mutex_lock (&dev_priv->sb_lock); + + temp =intel_sbi_read (dev_priv,SBI_SSCCTL6 ,SBI_ICLK ); +if (temp &SBI_SSCCTL_DISABLE ) { +mutex_unlock (&dev_priv->sb_lock); +return 0 ; + } + + temp = intel_sbi_read(dev_priv, SBI_SSCDIVINTPHASE6,
SBI_ICLK);drivers/gpu/drm/i915/intel_display.c +17
-0+ divsel = (temp &SBI_SSCDIVINTPHASE_DIVSEL_MASK ) >> +SBI_SSCDIVINTPHASE_DIVSEL_SHIFT ; + phaseinc = (temp &SBI_SSCDIVINTPHASE_INCVAL_MASK ) >> +SBI_SSCDIVINTPHASE_INCVAL_SHIFT ; + + temp =intel_sbi_read (dev_priv,SBI_SSCAUXDIV6 ,SBI_ICLK ); + auxdiv = (temp &SBI_SSCAUXDIV_FINALDIV2SEL_MASK ) >> +SBI_SSCAUXDIV_FINALDIV2SEL_SHIFT ; + +mutex_unlock (&dev_priv->sb_lock); + + desired_divisor = (divsel +2 ) * iclk_pi_range + phaseinc; + +return DIV_ROUND_CLOSEST (iclk_virtual_root_freq, + desired_divisor << auxdiv); +} +static void ironlake_pch_transcoder_set_timings(struct
intel_crtc*crtc,
enum pipepch_transcoder)
{drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1158,6 +1158,7 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, const struct dpll *dpll); void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe); +int lpt_get_iclkip (struct drm_i915_private *dev_priv);
Quoted 3 lines
/* modesetting asserts */
void assert_panel_unlocked(structdrm_i915_private*dev_priv,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 drm/i915: Try to fix CRT port clock limits
In reply to [email protected]From: Ville Syrjälä <[email protected]>
LPT/WPT-H are limited to max 180 MHz CRT dotclock. Most other platforms have a limit of 350 MHz. Supposedly gen3 and gen4 go up to 400 MHz.
VLV is a bit special since the docs are poor. Supposedly the DAC would be good up to 355 MHz, but currently we limit the DPLL to 270 MHz, so we'll have to limit the port clock to the same unless we change the DPLL limits.
--- drivers/gpu/drm/i915/intel_crt.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +12 -4
@@ -220,18 +220,26 @@ intel_crt_mode_valid(struct drm_connector *connector, {struct drm_device *dev = connector->dev;int max_dotclk =to_i915 (dev)->max_dotclk_freq; +int max_clock; -int max_clock =0 ;if (mode->flags &DRM_MODE_FLAG_DBLSCAN )return MODE_NO_DBLESCAN ;if (mode->clock <25000 )return MODE_CLOCK_LOW ; -if (IS_GEN2 (dev)) - max_clock =350000 ; -else +if (HAS_PCH_LPT (dev)) + max_clock =180000 ; +else if (IS_VALLEYVIEW (dev)) +/* +* 270 MHz due to current DPLL limits, +* DAC limit supposedly 355 MHz. +*/ + max_clock =270000 ; +else if (IS_GEN3 (dev) ||IS_GEN4 (dev)) max_clock =400000 ; +else + max_clock =350000 ;if (mode->clock > max_clock)return MODE_CLOCK_HIGH ;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915: Try to fix CRT port clock limits
Quoted 6 lines · On ke, 2016-02-17 at 21:41 +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
LPT/WPT-H are limited to max 180 MHz CRT dotclock. Most other platforms
have a limit of 350 MHz. Supposedly gen3 and gen4 go up to 400 MHz.
Quoted 6 lines
VLV is a bit special since the docs are poor. Supposedly the DAC would be good up to 355 MHz, but currently we limit the DPLL to 270 MHz, so we'll have to limit the port clock to the same unless we change the DPLL limits.
Signed-off-by Ville Syrjälä <[email protected]>
Quoted 38 lines
---
drivers/gpu/drm/i915/intel_crt.c | 16 ++++++++++++----1 file changed, 12 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_crt.c +1
-0@@ -220,18 +220,26 @@ intel_crt_mode_valid(struct drm_connector *connector, { struct drm_device *dev = connector->dev; int max_dotclk = to_i915(dev)->max_dotclk_freq; +int max_clock;drivers/gpu/drm/i915/intel_crt.c +0
-1-int max_clock =0 ;if (
mode->flags&DRM_MODE_FLAG_DBLSCAN)
returnMODE_NO_DBLESCAN;
if (mode->clock< 25000)
returnMODE_CLOCK_LOW;drivers/gpu/drm/i915/intel_crt.c +9
-3-if (IS_GEN2 (dev)) - max_clock =350000 ; -else +if (HAS_PCH_LPT (dev)) + max_clock =180000 ; +else if (IS_VALLEYVIEW (dev)) +/* +* 270 MHz due to current DPLL limits, +* DAC limit supposedly 355 MHz. +*/ + max_clock =270000 ; +else if (IS_GEN3 (dev) ||IS_GEN4 (dev))
max_clock= 400000;drivers/gpu/drm/i915/intel_crt.c +2
-0+else + max_clock =350000 ;
Quoted 3 lines
if (
mode->clock>max_clock)
returnMODE_CLOCK_HIGH;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Some FDI related dotclock stuff
In reply to [email protected]== Summary ==
== Summary ==
Series 3541v1 drm/i915: Some FDI related dotclock stuff
http://patchwork.freedesktop.org/api/1.0/series/3541/revisions/1/mbox/
Test kms_flip:
Subgroup basic-flip-vs-dpms:
dmesg-warn -> PASS (ilk-hp8440p) UNSTABLE
Subgroup basic-flip-vs-wf_vblank:
pass -> FAIL (snb-x220t)
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-b:
pass -> INCOMPLETE (ilk-hp8440p)
Subgroup suspend-read-crc-pipe-a:
dmesg-warn -> PASS (skl-i5k-2) UNSTABLE
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (skl-i5k-2) UNSTABLE
Subgroup suspend-read-crc-pipe-c:
dmesg-warn -> PASS (bsw-nuc-2)
Test pm_rpm:
Subgroup basic-pci-d3-state:
dmesg-warn -> PASS (bsw-nuc-2)
pass -> DMESG-WARN (byt-nuc)
Subgroup basic-rte:
pass -> DMESG-WARN (bsw-nuc-2)
pass -> FAIL (bdw-ultra)
dmesg-warn -> PASS (byt-nuc) UNSTABLEbdw-nuci7 total:164 pass:153 dwarn:0 dfail:0 fail:0 skip:11 bdw-ultra total:167 pass:152 dwarn:0 dfail:0 fail:1 skip:14 bsw-nuc-2 total:167 pass:136 dwarn:1 dfail:0 fail:0 skip:30 byt-nuc total:167 pass:141 dwarn:1 dfail:0 fail:0 skip:25 hsw-gt2 total:167 pass:156 dwarn:0 dfail:0 fail:1 skip:10 ilk-hp8440p total:163 pass:114 dwarn:0 dfail:0 fail:1 skip:47 ivb-t430s total:167 pass:152 dwarn:0 dfail:0 fail:1 skip:14 skl-i5k-2 total:167 pass:150 dwarn:1 dfail:0 fail:0 skip:16 snb-dellxps total:167 pass:144 dwarn:0 dfail:0 fail:1 skip:22 snb-x220t total:167 pass:143 dwarn:0 dfail:0 fail:3 skip:21
Results at /archive/results/CI_IGT_test/Patchwork_1429/
631053ba117c294f0cdfe704718a040b4406a240 drm-intel-nightly: 2016y-02m-17d-21h-05m-38s UTC integration manifest beb6d5046d6b0eafd0aa4bc15a87e534e3e0aa8e drm/i915: Try to fix CRT port clock limits c7f53fb3c57d5a91216c037d757876e3a692ae0e drm/i915: Read out VGA dotclock properly on LPT 3c2e8606fb856686e2fa84b10f1c22ef2d209e17 drm/i915: Make the LPT iclkip 20MHz case more generic 6bb0fff788112afbb60391b5a77e4f62745ba0f7 drm/i915: Remove the SPLL==270Mhz assumption from intel_fdi_link_freq() f8260170eff5e4763d1c99e1baa3246f19c294d5 drm/i915: Move the encoder vs. FDI dotclock check out from encoder .get_config() 865134f99bff4ba3a91d2703282aa16c83d8ce52 drm/i915: Dump ddi_pll_sel in hex instead of decimal on HSW/BDW
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Fi.CI.BAT: failure for drm/i915: Some FDI related dotclock stuff
Quoted 10 lines · Patchwork
== Summary ==
Series 3541v1 drm/i915: Some FDI related dotclock stuff
http://patchwork.freedesktop.org/api/1.0/series/3541/revisions/1/mbox/Test
kms_flip:Subgroup basic-flip-vs-dpms: dmesg-warn -> PASS (ilk-hp8440p) UNSTABLE Subgroup basic-flip-vs-wf_vblank: pass -> FAIL (snb-x220t)
(kms_flip:6443) DEBUG: name = vblanklast_ts = 594.687318 useclast_received_ts = 594.687142 useclast_seq = 24682current_ts = 594.870400 useccurrent_received_ts = 594.870267 useccurrent_seq = 24692
count = 44seq_step = 10
(kms_flip:6443) CRITICAL: Test assertion failure function check_state, file kms_flip.c:692:
(kms_flip:6443) CRITICAL: Failed assertion: fabs((((double) diff.tv_usec) - usec_interflip) / usec_interflip) <= 0.005 (kms_flip:6443) CRITICAL: Last errno: 25, Inappropriate ioctl for device
(kms_flip:6443) CRITICAL: inter-vblank ts jitter: 0s, 183082usec
Hmm. So here it looks like the seq number says 10, but the timestamp difference says 11. I found a few more of the same in the CI results. This could be due to the race with even numbered vblank seq increments that could be fixed by:
https://lists.freedesktop.org/archives/dri-devel/2015-September/090288.html
Filed a bug:
https://bugs.freedesktop.org/show_bug.cgi?id=94294
Quoted 13 lines
Test
kms_pipe_crc_basic:Subgroup read-crc-pipe-b: pass -> INCOMPLETE (ilk-hp8440p) Subgroup suspend-read-crc-pipe-a: dmesg-warn -> PASS (skl-i5k-2) UNSTABLE Subgroup suspend-read-crc-pipe-b: pass -> DMESG-WARN (skl-i5k-2) UNSTABLE Subgroup suspend-read-crc-pipe-c: dmesg-warn -> PASS (bsw-nuc-2) Test pm_rpm: Subgroup basic-pci-d3-state: dmesg-warn -> PASS (bsw-nuc-2) pass -> DMESG-WARN (byt-nuc)
[ 126.296996] [drm:intel_runtime_suspend [i915]] *ERROR* Unclaimed access detected prior to suspending
https://bugs.freedesktop.org/show_bug.cgi?id=94164
Quoted 3 lines
Subgroup basic-rte:
pass -> DMESG-WARN (bsw-nuc-2)
pass -> FAIL (bdw-ultra)https://bugs.freedesktop.org/show_bug.cgi?id=94163
Quoted 22 lines
dmesg-warn -> PASS (byt-nuc) UNSTABLEbdw-nuci7 total:164 pass:153 dwarn:0 dfail:0 fail:0 skip:11 bdw-ultra total:167 pass:152 dwarn:0 dfail:0 fail:1 skip:14 bsw-nuc-2 total:167 pass:136 dwarn:1 dfail:0 fail:0 skip:30 byt-nuc total:167 pass:141 dwarn:1 dfail:0 fail:0 skip:25 hsw-gt2 total:167 pass:156 dwarn:0 dfail:0 fail:1 skip:10 ilk-hp8440p total:163 pass:114 dwarn:0 dfail:0 fail:1 skip:47 ivb-t430s total:167 pass:152 dwarn:0 dfail:0 fail:1 skip:14 skl-i5k-2 total:167 pass:150 dwarn:1 dfail:0 fail:0 skip:16 snb-dellxps total:167 pass:144 dwarn:0 dfail:0 fail:1 skip:22 snb-x220t total:167 pass:143 dwarn:0 dfail:0 fail:3 skip:21Results at /archive/results/CI_IGT_test/Patchwork_1429/
631053ba117c294f0cdfe704718a040b4406a240drm-intel-nightly: 2016y-02m-17d-21h-05m-38s UTC integration manifestbeb6d5046d6b0eafd0aa4bc15a87e534e3e0aa8edrm/i915: Try to fix CRT port clock limitsc7f53fb3c57d5a91216c037d757876e3a692ae0edrm/i915: Read out VGA dotclock properly on LPT3c2e8606fb856686e2fa84b10f1c22ef2d209e17drm/i915: Make the LPT iclkip 20MHz case more generic6bb0fff788112afbb60391b5a77e4f62745ba0f7drm/i915: Remove the SPLL==270Mhz assumption fromintel_fdi_link_freq()f8260170eff5e4763d1c99e1baa3246f19c294d5drm/i915: Move the encoder vs. FDI dotclock check out from encoder .get_config()865134f99bff4ba3a91d2703282aa16c83d8ce52drm/i915: Dumpddi_pll_selin hex instead of decimal on HSW/BDW
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · On Wed, Feb 17, 2016 at 09:41:07PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Imre's SNB had a crappy BIOS that failed to configure the hardware correctly when hooked up to a 4K monitor, which then resulted in lots of noise from i915 when it was trying to make sense of the bad state. That spurred me to reorganize the FDI dotclock vs. encoder dotclock sanity check we have in the encoder .get_config() hooks. And while doing that I figured we might as well try to read out the actual VGA dotclock via sideband on HSW/BDW, which can then be compared to the one compute from FDI parameters.
Apparently a BIOS update solved the problem for Imre, but I think these patches still have some value by adding more thorough state cross checking on HSW/BDW, and just moving out the sanity checks from the state readout code makes quite a bit of sense to me, especially if we run into more buggy BIOSen. Though if people prefer, I could respin these without that particular change, ie. just keep the LPT-H dotclock readout and cross checking essentially.
I also ended up fixing the port clock limits for CRT for various platforms.
Ville Syrjälä (6):
drm/i915: Dumpddi_pll_selin hex instead of decimal on HSW/BDW drm/i915: Move the encoder vs. FDI dotclock check out from encoder
Quoted 6 lines
.get_config()drm/i915: Remove the SPLL==270Mhz assumption from
intel_fdi_link_freq()
drm/i915: Make the LPT iclkip 20MHz case more generic drm/i915: Read out VGA dotclock properly on LPT drm/i915: Try to fix CRT port clock limits
Entire series pushed to dinq. Thanks for the reviews.
Quoted 13 lines
drivers/gpu/drm/i915/i915_reg.h | 8 +- drivers/gpu/drm/i915/intel_crt.c | 30 ++++---- drivers/gpu/drm/i915/intel_display.c | 143 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_dp.c | 11 +-- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_hdmi.c | 3 - drivers/gpu/drm/i915/intel_lvds.c | 8 +- drivers/gpu/drm/i915/intel_sdvo.c | 4 +- 8 files changed, 123 insertions(+), 88 deletions(-)Signature · 1 line
2.4.10
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx