drm/i915: All sorts of cdclk stuff
Subsystems (2)
cover drm/i915: All sorts of cdclk stuff
From: Ville Syrjälä <[email protected]>
My main motivation here was to get dev_priv->max_cdclk into place on all platforms so that we can start to use it to validate modes and whatnot. This series doesn't actually add any new checks like that apart from the BDW IPS case, and converting over whatever checks we already had.
The other thing I managed to do is add support for cdclk dynamic frequency scaling on HSW/BDW, and I also fixed it for CHV.
The HSW stuff we may want to drop actually since I was told it's not validated, and it doesn't scale the voltage in any case so the benefits may not be worth it. I did try it out on my HSW here and it seemed to work just fine. In any case I figured I'll include the patch anyway.
As usual, the CHV case is again a major documentation snafu. Let's just say I made it work despite the documentation. The 400MHz case doesn't seem to work actually, or rather the Punit seems to reject any request above 320MHz. Also the 200MHz case seems as busted as on VLV. I just get an immediate underrun and a black screen, even though the pixel clock is definitely below the 90% of cdclk limit.
I pushed the lot (+ a hack to force a higher cdclk via a modparam) here:git://gitorious.org/vsyrjala/linux.git cdclk_7
Ville Syrjälä (18):
drm/i915: Return more precise cdclk for gen2/3 drm/i915: Fix i855_get_display_clock_speed()
drm/i915: Fix 852GM/GMV cdclk
drm/i915: Add cdclk extraction for g33, 965gm and g4x drm/i915: ILK cdclk seems to be 450MHz
drm/i915: Assume 400 MHz cdclk for the rest of gen4-7 drm/i915: Simplify ilk_get_aux_clock_divider() drm/i915: Convert the ddi cdclk code to .get_display_clock_speed() drm/i915: Warn when cdclk for the platforms is not known drm/i915: Cache the current cdclk frequency in dev_priv drm/i915: Use cached cdclk value
drm/i915: Unify ilk and hsw .get_aux_clock_divider() drm/i915: Store max cdclk value in dev_priv
drm/i915: Don't enable IPS when pixel rate exceeds 95% of cdclk drm/i915: Fix chv cdclk support
drm/i915: HSW cdclk change support
drm/i915: Add IS_BDW_ULX()
drm/i915: BDW cdclk change support
drivers/gpu/drm/i915/i915_drv.h | 5 +- drivers/gpu/drm/i915/i915_reg.h | 18 +- drivers/gpu/drm/i915/intel_ddi.c | 101 +---- drivers/gpu/drm/i915/intel_display.c | 697 +++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/intel_dp.c | 26 +- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_pm.c | 18 +- drivers/gpu/drm/i915/intel_runtime_pm.c | 2 +- 8 files changed, 672 insertions(+), 197 deletions(-)
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/18 drm/i915: Return more precise cdclk for gen2/3
From: Ville Syrjälä <[email protected]>
Fill out the lower three digits for gen2 and gen3 cdclk frqeuncy. It's not clear if these are accurate frquencies or just in the ballpark, but without docs this is the best we can do.
--- drivers/gpu/drm/i915/intel_display.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +11 -11
@@ -5605,7 +5605,7 @@ static int i945_get_display_clock_speed(struct drm_device *dev)static int i915_get_display_clock_speed (struct drm_device *dev) { -return 333000 ; +return 333333 ; }static int i9xx_misc_get_display_clock_speed (struct drm_device *dev)
@@ -5621,19 +5621,19 @@ static int pnv_get_display_clock_speed(struct drm_device *dev)switch (gcfgc &GC_DISPLAY_CLOCK_MASK ) {case GC_DISPLAY_CLOCK_267_MHZ_PNV : -return 267000 ; +return 266667 ;case GC_DISPLAY_CLOCK_333_MHZ_PNV : -return 333000 ; +return 333333 ;case GC_DISPLAY_CLOCK_444_MHZ_PNV : -return 444000 ; +return 444444 ;case GC_DISPLAY_CLOCK_200_MHZ_PNV :return 200000 ;default :DRM_ERROR ("Unknown pnv display core clock 0x%04x\n" , gcfgc);case GC_DISPLAY_CLOCK_133_MHZ_PNV : -return 133000 ; +return 133333 ;case GC_DISPLAY_CLOCK_167_MHZ_PNV : -return 167000 ; +return 166667 ; } }
@@ -5644,11 +5644,11 @@ static int i915gm_get_display_clock_speed(struct drm_device *dev)pci_read_config_word (dev->pdev,GCFGC , &gcfgc);if (gcfgc &GC_LOW_FREQUENCY_ENABLE ) -return 133000 ; +return 133333 ;else {switch (gcfgc &GC_DISPLAY_CLOCK_MASK ) {case GC_DISPLAY_CLOCK_333_MHZ : -return 333000 ; +return 333333 ;default :case GC_DISPLAY_CLOCK_190_200_MHZ :return 190000 ;
@@ -5658,7 +5658,7 @@ static int i915gm_get_display_clock_speed(struct drm_device *dev)static int i865_get_display_clock_speed (struct drm_device *dev) { -return 266000 ; +return 266667 ; }static int i855_get_display_clock_speed (struct drm_device *dev)
@@ -5674,7 +5674,7 @@ static int i855_get_display_clock_speed(struct drm_device *dev)case GC_CLOCK_166_250 :return 250000 ;case GC_CLOCK_100_133 : -return 133000 ; +return 133333 ; }/* Shouldn't happen */
@@ -5683,7 +5683,7 @@ static int i855_get_display_clock_speed(struct drm_device *dev)static int i830_get_display_clock_speed (struct drm_device *dev) { -return 133000 ; +return 133333 ; } static void
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/18] drm/i915: Return more precise cdclk for gen2/3
Quoted 7 lines · On Mon, Nov 17, 2014 at 04:43:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Fill out the lower three digits for gen2 and gen3 cdclk frqeuncy. It's not clear if these are accurate frquencies or just in the ballpark, but without docs this is the best we can do.
Signed-off-by Ville Syrjälä <[email protected]>
Given that no one complained yet I'm not sure this is worth the trouble. Otoh it's all below the 10% margin we have already anyway, so one big wash ;-)
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/18] drm/i915: Return more precise cdclk for gen2/3
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · On Mon, Nov 17, 2014 at 04:43:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Fill out the lower three digits for gen2 and gen3 cdclk frqeuncy. It's not clear if these are accurate frquencies or just in the ballpark, but without docs this is the best we can do.
Quoted 5 lines
Quoted 1 line
Signed-off-by Ville Syrjälä <[email protected]>Given that no one complained yet I'm not sure this is worth the trouble. Otoh it's all below the 10% margin we have already anyway, so one big wash ;-)
Yeah <1Mhz is a fairly small error here. But I still prefer to make the change, if only for consistency. Otherwise it'll keep bugging me and I'll have to keep fighting the urge to change it every time I see those numbers.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/18] drm/i915: Return more precise cdclk for gen2/3
Quoted 10 lines · Ville Syrjälä
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · On Mon, Nov 17, 2014 at 04:43:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Fill out the lower three digits for gen2 and gen3 cdclk frqeuncy. It's not clear if these are accurate frquencies or just in the ballpark, but without docs this is the best we can do.
Signed-off-by Ville Syrjälä <[email protected]>
Quoted 8 lines
Quoted 3 lines
Given that no one complained yet I'm not sure this is worth the trouble. Otoh it's all below the 10% margin we have already anyway, so one big wash ;-)
Yeah <1Mhz is a fairly small error here. But I still prefer to make the change, if only for consistency. Otherwise it'll keep bugging me and I'll have to keep fighting the urge to change it every time I see those numbers.
I fully approve of OCD urges ;-) Series overall looks really nifty, I think it would be best to sign up a senior person from the vpg display team for to review the details in this - maybe they remember some of the old lore ...
And one aside for atomic: I guess we need a clocks_lock ww mutex to protect any dynamic cdclock state. Same for shared dpll state too. This will be fun to integrate, but since all the code that checks cdclock can fail with -EINVAL already wiring up -EDEADLK shouldn't cause any fuzz. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/18 drm/i915: Fix i855_get_display_clock_speed()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Actually read the HPLLCC register insted of assuming it's 0. Fix the HPLLCC bit definitions and all the missing ones from the 852GME spec.
852GME, 854 and 855 all seem to match the same HPLLC encoding even though only some of the values are valid is some of the platforms.
--- drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++--- drivers/gpu/drm/i915/intel_display.c | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -3
@@ -37,12 +37,17 @@/* PCI config space */ -#define HPLLCC 0xc0/* 855 only */ -#define GC_CLOCK_CONTROL_MASK (0xf << 0) +#define HPLLCC 0xc0/* 85x only */ +#define GC_CLOCK_CONTROL_MASK (0x7 << 0)#define GC_CLOCK_133_200 (0 << 0)#define GC_CLOCK_100_200 (1 << 0)#define GC_CLOCK_100_133 (2 << 0) -#define GC_CLOCK_166_250 (3 << 0) +#define GC_CLOCK_133_266 (3 << 0) +#define GC_CLOCK_133_200_2 (4 << 0) +#define GC_CLOCK_133_266_2 (5 << 0) +#define GC_CLOCK_166_266 (6 << 0) +#define GC_CLOCK_166_250 (7 << 0) +#define GCFGC2 0xda#define GCFGC 0xf0/* 915+ only */ #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
drivers/gpu/drm/i915/intel_display.c +12 -3
@@ -5661,20 +5661,29 @@ static int i865_get_display_clock_speed(struct drm_device *dev)return 266667 ; } -static int i855_get_display_clock_speed (struct drm_device *dev) +static int i85x_get_display_clock_speed (struct drm_device *dev) {u16 hpllcc =0 ; + +pci_bus_read_config_word (dev->pdev->bus, +PCI_DEVFN (0 ,3 ),HPLLCC , &hpllcc); +/* Assume that the hardware is in the high speed state. This * should be the default. */ switch (hpllcc &GC_CLOCK_CONTROL_MASK ) {case GC_CLOCK_133_200 : +case GC_CLOCK_133_200_2 :case GC_CLOCK_100_200 :return 200000 ;case GC_CLOCK_166_250 :return 250000 ;case GC_CLOCK_100_133 :return 133333 ; +case GC_CLOCK_133_266 : +case GC_CLOCK_133_266_2 : +case GC_CLOCK_166_266 : +return 266667 ; }/* Shouldn't happen */
@@ -12726,8 +12735,8 @@ static void intel_init_display(struct drm_device *dev)i865_get_display_clock_speed ; else if (IS_I85X(dev)) dev_priv->display.get_display_clock_speed = - i855_get_display_clock_speed; - else /* 852, 830 */ + i85x_get_display_clock_speed; + else /* 830 */ dev_priv->display.get_display_clock_speed = i830_get_display_clock_speed;
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/18 drm/i915: Fix 852GM/GMV cdclk
In reply to [email protected]From: Ville Syrjälä <[email protected]>
It seems 852GM/GMV uses a different HPLLCC encoding than the other 85x platforms. For 852GM/GMV cdclk is always 133MHz. Try to detect that using the PCI revision (sinc the device ID seems useless for that). I'm not at all sure this is a good idea, but according to the specs it should work.
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +8 -0
@@ -5665,6 +5665,14 @@ static int i85x_get_display_clock_speed(struct drm_device *dev) {u16 hpllcc =0 ; +/* +* 852GM/852GMV only supports 133 MHz and the HPLLCC +* encoding is different :( +* FIXME is this the right way to detect 852GM/852GMV? +*/ +if (dev->pdev->revision ==0x1 ) +return 133333 ; +pci_bus_read_config_word (dev->pdev->bus,PCI_DEVFN (0 ,3 ),HPLLCC , &hpllcc);
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/18 drm/i915: Add cdclk extraction for g33, 965gm and g4x
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Implement cdclk extraction for g33, 965gm and g4x platforms. The details came from configdb. Sadly there isn't anything there for other gen3/gen4 chipsets.
So far I've tested this on one ELK where it gave me a HPLL VCO of 5333 MHz and cdclk of 444 MHz which seems perfectly sane for this machine.
--- drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_display.c | 186 ++++++++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -2102,6 +2102,9 @@ enum punit_power_well {#define CLKCFG_MEM_800 (3 << 4)#define CLKCFG_MEM_MASK (7 << 4) +#define HPLLVCO (MCHBAR_MIRROR_BASE + 0xc38) +#define HPLLVCO_MOBILE (MCHBAR_MIRROR_BASE + 0xc0f) +#define TSC1 0x11001#define TSE (1<<0)#define TR1 0x11006
drivers/gpu/drm/i915/intel_display.c +182 -4
204 lines not on this page · raw message
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/18 drm/i915: ILK cdclk seems to be 450MHz
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Based on the BIOS DP A AUX 2x clock divider the cdclk frequency on ILK is 450Mhz. At least that holds on my ILK and it matches how we program the divider.
Supposedly cdclk is 400MHz on SNB and IVB, again based on the AUX 2x clock divider. Note that I don't have a SNB or IVB machine with eDP so I couldn't verify what the BIOS used, so this notion is purely based on our current code,
--- drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_display.c +8 -0
@@ -5598,6 +5598,11 @@ static int valleyview_get_display_clock_speed(struct drm_device *dev)return DIV_ROUND_CLOSEST (dev_priv->hpll_freq <<1 , divider +1 ); } +static int ilk_get_display_clock_speed (struct drm_device *dev) +{ +return 450000 ; +} +static int i945_get_display_clock_speed (struct drm_device *dev) {return 400000 ;
@@ -12892,6 +12897,9 @@ static void intel_init_display(struct drm_device *dev)if (IS_VALLEYVIEW (dev)) dev_priv->display.get_display_clock_speed = valleyview_get_display_clock_speed; +else if (IS_GEN5 (dev)) + dev_priv->display.get_display_clock_speed = + ilk_get_display_clock_speed;else if (IS_GM45 (dev)) dev_priv->display.get_display_clock_speed = gm45_get_display_clock_speed;
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/18 drm/i915: Assume 400 MHz cdclk for the rest of gen4-7
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We don't currently have cdclk extraction code for 965g,snb,ivb. Let's assumee 400 MHz until we know better. That seems to match hints in various vague documents. Whether that's good enough is not entirely clear.
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -12912,7 +12912,8 @@ static void intel_init_display(struct drm_device *dev)else if (IS_G33 (dev) ||IS_G4X (dev)) dev_priv->display.get_display_clock_speed = g33_get_display_clock_speed; -else if (IS_I945G (dev)) +else if (IS_I945G (dev) ||IS_BROADWATER (dev) || +IS_GEN6 (dev) ||IS_IVYBRIDGE (dev)) dev_priv->display.get_display_clock_speed = i945_get_display_clock_speed;else if (IS_I915G (dev))
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/18] drm/i915: Assume 400 MHz cdclk for the rest of gen4-7
Quoted 8 lines · On Mon, Nov 17, 2014 at 04:43:40PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We don't currently have cdclk extraction code for 965g,snb,ivb. Let's assumee 400 MHz until we know better. That seems to match hints in various vague documents. Whether that's good enough is not entirely clear.
Signed-off-by Ville Syrjälä <[email protected]>
Hm, not sure whether these chips even had outputs which could drive this high really. And if we now start rejecting modes that previously worked (really unlikely imo) we'll get the regression reports and can fudge the numbers some more. So even without more spec hints I'm totally fine with going forward with this.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/18] drm/i915: Assume 400 MHz cdclk for the rest of gen4-7
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · On Mon, Nov 17, 2014 at 04:43:40PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We don't currently have cdclk extraction code for 965g,snb,ivb. Let's assumee 400 MHz until we know better. That seems to match hints in various vague documents. Whether that's good enough is not entirely clear.
Quoted 7 lines
Quoted 1 line
Signed-off-by Ville Syrjälä <[email protected]>Hm, not sure whether these chips even had outputs which could drive this high really. And if we now start rejecting modes that previously worked (really unlikely imo) we'll get the regression reports and can fudge the numbers some more. So even without more spec hints I'm totally fine with going forward with this.
At least one IVB out there seems to agree with this 400MHz limit:
https://bugs.freedesktop.org/show_bug.cgi?id=85621
But it does look like we're also failing to respect the port limits which according to BSpec are 315Mhz-388Mhz (depending on the port and/or bpc) for IVB. So I guess you're right that the cdclk wouldn't matter all that much if we actually checked the port limits.
Although there are also various sprite scaling/format related limits we fail to check where the limit ends up being of the form cdclk*N where N is something < 1.0. So having a decent approximation of the cdclk around should be useful eventually.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/18 drm/i915: Simplify ilk_get_aux_clock_divider()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Now that we are "extracting" the cdclk frequency on ILK-IVB we can also simplify ilk_get_aux_clock_divider() to calculate the divider based on cdclk instead of hardcoding the values.
--- drivers/gpu/drm/i915/intel_dp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -4
@@ -698,15 +698,13 @@ static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index) {struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);struct drm_device *dev = intel_dig_port->base.base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;if (index)return 0 ;if (intel_dig_port->port ==PORT_A ) { -if (IS_GEN6 (dev) ||IS_GEN7 (dev)) -return 200 ;/* SNB & IVB eDP input clock at 400Mhz */ -else -return 225 ;/* eDP input clock at 450Mhz */ +return DIV_ROUND_UP (dev_priv->display.get_display_clock_speed (dev),2000 ); }else {return DIV_ROUND_UP (intel_pch_rawclk (dev),2 ); }
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/18 drm/i915: Convert the ddi cdclk code to .get_display_clock_speed()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Unify the HSW/BDW/SKL cdclk extraction code to conform to the same .get_display_clock_speed() mold that all the other platforms use.
v2: Update due to SKL code getting added
--- drivers/gpu/drm/i915/intel_ddi.c | 101 +------------------------------- drivers/gpu/drm/i915/intel_display.c | 98 ++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_pm.c | 2 +- drivers/gpu/drm/i915/intel_runtime_pm.c | 2 +- 6 files changed, 101 insertions(+), 105 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -100
@@ -1614,105 +1614,6 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) } } -static int skl_get_cdclk_freq (struct drm_i915_private *dev_priv) -{ -uint32_t lcpll1 =I915_READ (LCPLL1_CTL ); -uint32_t cdctl =I915_READ (CDCLK_CTL ); -uint32_t linkrate; - -if (!(lcpll1 &LCPLL_PLL_ENABLE )) { -WARN (1 ,"LCPLL1 not enabled\n" ); -return 24000 ;/* 24MHz is the cd freq with NSSC ref */ - } - -if ((cdctl &CDCLK_FREQ_SEL_MASK ) ==CDCLK_FREQ_540 ) -return 540000 ; - - linkrate = (I915_READ (DPLL_CTRL1 ) & -DPLL_CRTL1_LINK_RATE_MASK (SKL_DPLL0 )) >>1 ; - -if (linkrate ==DPLL_CRTL1_LINK_RATE_2160 || - linkrate ==DPLL_CRTL1_LINK_RATE_1080 ) { -/* vco 8640 */ -switch (cdctl &CDCLK_FREQ_SEL_MASK ) { -case CDCLK_FREQ_450_432 : -return 432000 ; -case CDCLK_FREQ_337_308 : -return 308570 ; -case CDCLK_FREQ_675_617 : -return 617140 ; -default : -WARN (1 ,"Unknown cd freq selection\n" ); - } - }else { -/* vco 8100 */ -switch (cdctl &CDCLK_FREQ_SEL_MASK ) { -case CDCLK_FREQ_450_432 : -return 450000 ; -case CDCLK_FREQ_337_308 : -return 337500 ; -case CDCLK_FREQ_675_617 : -return 675000 ; -default : -WARN (1 ,"Unknown cd freq selection\n" ); - } - } - -/* error case, do as if DPLL0 isn't enabled */ -return 24000 ; -} - -static int bdw_get_cdclk_freq (struct drm_i915_private *dev_priv) -{ -uint32_t lcpll =I915_READ (LCPLL_CTL ); -uint32_t freq = lcpll &LCPLL_CLK_FREQ_MASK ; - -if (lcpll &LCPLL_CD_SOURCE_FCLK ) -return 800000 ; -else if (I915_READ (FUSE_STRAP ) &HSW_CDCLK_LIMIT ) -return 450000 ; -else if (freq ==LCPLL_CLK_FREQ_450 ) -return 450000 ; -else if (freq ==LCPLL_CLK_FREQ_54O_BDW ) -return 540000 ; -else if (freq ==LCPLL_CLK_FREQ_337_5_BDW ) -return 337500 ; -else -return 675000 ; -} - -static int hsw_get_cdclk_freq (struct drm_i915_private *dev_priv) -{ -struct drm_device *dev = dev_priv->dev; -uint32_t lcpll =I915_READ (LCPLL_CTL ); -uint32_t freq = lcpll &LCPLL_CLK_FREQ_MASK ; - -if (lcpll &LCPLL_CD_SOURCE_FCLK ) -return 800000 ; -else if (I915_READ (FUSE_STRAP ) &HSW_CDCLK_LIMIT ) -return 450000 ; -else if (freq ==LCPLL_CLK_FREQ_450 ) -return 450000 ; -else if (IS_HSW_ULT (dev)) -return 337500 ; -else -return 540000 ; -} - -int intel_ddi_get_cdclk_freq (struct drm_i915_private *dev_priv) -{ -struct drm_device *dev = dev_priv->dev; - -if (IS_SKYLAKE (dev)) -return skl_get_cdclk_freq (dev_priv); - -if (IS_BROADWELL (dev)) -return bdw_get_cdclk_freq (dev_priv); - -/* Haswell */ -return hsw_get_cdclk_freq (dev_priv); -} -static void hsw_ddi_pll_enable (struct drm_i915_private *dev_priv,struct intel_shared_dpll *pll) {
@@ -1899,7 +1800,7 @@ void intel_ddi_pll_init(struct drm_device *dev)hsw_shared_dplls_init (dev_priv);DRM_DEBUG_KMS ("CDCLK running at %dKHz\n" , -intel_ddi_get_cdclk_freq (dev_priv)); + dev_priv->display.get_display_clock_speed (dev));if (IS_SKYLAKE (dev)) {if (!(I915_READ (LCPLL1_CTL ) &LCPLL_PLL_ENABLE ))
drivers/gpu/drm/i915/intel_display.c +97 -1
110 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -719,7 +719,7 @@ static uint32_t hsw_get_aux_clock_divider(struct intel_dp *intel_dp, int index)if (intel_dig_port->port ==PORT_A ) {if (index)return 0 ; -return DIV_ROUND_CLOSEST (intel_ddi_get_cdclk_freq (dev_priv),2000 ); +return DIV_ROUND_CLOSEST (dev_priv->display.get_display_clock_speed (dev),2000 ); }else if (dev_priv->pch_id ==INTEL_PCH_LPT_DEVICE_ID_TYPE ) {/* Workaround for non-ULT HSW */ switch (index) {
drivers/gpu/drm/i915/intel_drv.h +0 -1
@@ -817,7 +817,6 @@ void hsw_fdi_link_train(struct drm_crtc *crtc);void intel_ddi_init (struct drm_device *dev,enum port port);enum port intel_ddi_get_encoder_port (struct intel_encoder *intel_encoder);bool intel_ddi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe); -int intel_ddi_get_cdclk_freq (struct drm_i915_private *dev_priv);void intel_ddi_pll_init (struct drm_device *dev);void intel_ddi_enable_transcoder_func (struct drm_crtc *crtc); void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2273,7 +2273,7 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) linetime =DIV_ROUND_CLOSEST (mode->crtc_htotal *1000 *8 , mode->crtc_clock); ips_linetime =DIV_ROUND_CLOSEST (mode->crtc_htotal *1000 *8 , -intel_ddi_get_cdclk_freq (dev_priv)); + dev_priv->display.get_display_clock_speed (dev));return PIPE_WM_LINETIME_IPS_LINETIME (ips_linetime) |PIPE_WM_LINETIME_TIME (linetime);
drivers/gpu/drm/i915/intel_runtime_pm.c +1 -1
@@ -1401,6 +1401,6 @@ int i915_get_cdclk_freq(void) dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains); -return intel_ddi_get_cdclk_freq (dev_priv); +return dev_priv->display.get_display_clock_speed (dev_priv->dev); }EXPORT_SYMBOL_GPL (i915_get_cdclk_freq);
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/18 drm/i915: Warn when cdclk for the platforms is not known
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Print a warning if we fall through the .get_display_clock_speed() function pointer setup. We end up assuming a 133MHz cdclk which should mean that at least we avoid any 0 deivisions and whatnot. But this could at least help remind people that they have to provide this function for new platforms.
--- drivers/gpu/drm/i915/intel_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -13027,9 +13027,11 @@ static void intel_init_display(struct drm_device *dev)else if (IS_I85X (dev)) dev_priv->display.get_display_clock_speed = i85x_get_display_clock_speed; -else /* 830 */ +else {/* 830 */ +WARN (!IS_I830 (dev),"Unknown platform. Assuming 133 MHz CDCLK\n" ); dev_priv->display.get_display_clock_speed = i830_get_display_clock_speed; + }if (IS_GEN5 (dev)) { dev_priv->display.fdi_link_train = ironlake_fdi_link_train;
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/18 drm/i915: Cache the current cdclk frequency in dev_priv
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Rather that extracting the current cdclk freuqncy every time someone wants to know it, cache the current value and use that. VLV/CHV already stored a cached value there so just expand that to cover all platforms.
--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 44 ++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -1632,7 +1632,7 @@ struct drm_i915_private {int num_fence_regs;/* 8 on pre-965, 16 otherwise */ unsigned int fsb_freq, mem_freq, is_ddr3; -unsigned int vlv_cdclk_freq; +unsigned int cdclk_freq;unsigned int hpll_freq;/**
drivers/gpu/drm/i915/intel_display.c +25 -19
116 lines not on this page · raw message
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/18 drm/i915: Use cached cdclk value
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Rather than reading out the current cdclk value use the cached value we have tucked away in dev_priv.
--- drivers/gpu/drm/i915/intel_display.c | 3 +-- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- drivers/gpu/drm/i915/intel_pm.c | 2 +- drivers/gpu/drm/i915/intel_runtime_pm.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -2
@@ -5519,8 +5519,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,/* FIXME should check pixel clock limits on all platforms */ if (INTEL_INFO (dev)->gen <4 ) { -int clock_limit = - dev_priv->display.get_display_clock_speed (dev); +int clock_limit = dev_priv->cdclk_freq;/* * Enable pixel doubling when the dot clock
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -704,7 +704,7 @@ static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)return 0 ;if (intel_dig_port->port ==PORT_A ) { -return DIV_ROUND_UP (dev_priv->display.get_display_clock_speed (dev),2000 ); +return DIV_ROUND_UP (dev_priv->cdclk_freq,2000 ); }else {return DIV_ROUND_UP (intel_pch_rawclk (dev),2 ); }
@@ -719,7 +719,7 @@ static uint32_t hsw_get_aux_clock_divider(struct intel_dp *intel_dp, int index)if (intel_dig_port->port ==PORT_A ) {if (index)return 0 ; -return DIV_ROUND_CLOSEST (dev_priv->display.get_display_clock_speed (dev),2000 ); +return DIV_ROUND_CLOSEST (dev_priv->cdclk_freq,2000 ); }else if (dev_priv->pch_id ==INTEL_PCH_LPT_DEVICE_ID_TYPE ) {/* Workaround for non-ULT HSW */ switch (index) {
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2273,7 +2273,7 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) linetime =DIV_ROUND_CLOSEST (mode->crtc_htotal *1000 *8 , mode->crtc_clock); ips_linetime =DIV_ROUND_CLOSEST (mode->crtc_htotal *1000 *8 , - dev_priv->display.get_display_clock_speed (dev)); + dev_priv->cdclk_freq);return PIPE_WM_LINETIME_IPS_LINETIME (ips_linetime) |PIPE_WM_LINETIME_TIME (linetime);
drivers/gpu/drm/i915/intel_runtime_pm.c +1 -1
@@ -1401,6 +1401,6 @@ int i915_get_cdclk_freq(void) dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains); -return dev_priv->display.get_display_clock_speed (dev_priv->dev); +return dev_priv->cdclk_freq; }EXPORT_SYMBOL_GPL (i915_get_cdclk_freq);
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/18] drm/i915: Use cached cdclk value
drivers/gpu/drm/i915/intel_runtime_pm.c int i915_get_cdclk_freq(void) · line 1404
Quoted 10 lines · On Mon, Nov 17, 2014 at 04:43:45PM +0200, [email protected] wrote:
drivers/gpu/drm/i915/intel_runtime_pm.c +1
-1@@ -1401,6 +1401,6 @@ int i915_get_cdclk_freq(void) dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains); -return dev_priv->display.get_display_clock_speed (dev_priv->dev); +return dev_priv->cdclk_freq;
Maybe this here is the reason why hsw shouldn't change cdclck - the audio side just falls over?
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/18] drm/i915: Use cached cdclk value
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · On Mon, Nov 17, 2014 at 04:43:45PM +0200, [email protected] wrote:
drivers/gpu/drm/i915/intel_runtime_pm.c +0
-0@@ -1401,6 +1401,6 @@ int i915_get_cdclk_freq(void) dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains);
Quoted 5 lines
drivers/gpu/drm/i915/intel_runtime_pm.c int i915_get_cdclk_freq(void) · line 1404
Quoted 2 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +1
-1-return dev_priv->display.get_display_clock_speed (dev_priv->dev); +return dev_priv->cdclk_freq;Maybe this here is the reason why hsw shouldn't change cdclck - the audio side just falls over?
I must admit that I didn't check whether the audio side will query the cdclk again after every mode change. It really should, but often reality doesn't match my expectations :)
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/18] drm/i915: Use cached cdclk value
Quoted 16 lines · Ville Syrjälä
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · On Mon, Nov 17, 2014 at 04:43:45PM +0200, [email protected] wrote:
drivers/gpu/drm/i915/intel_runtime_pm.c +0
-0@@ -1401,6 +1401,6 @@ int i915_get_cdclk_freq(void) dev_priv = container_of(hsw_pwr, struct drm_i915_private, power_domains);Quoted 5 lines
drivers/gpu/drm/i915/intel_runtime_pm.c int i915_get_cdclk_freq(void) · line 1404
Quoted 2 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +1
-1-return dev_priv->display.get_display_clock_speed (dev_priv->dev); +return dev_priv->cdclk_freq;Maybe this here is the reason why hsw shouldn't change cdclck - the audio side just falls over?
Quoted 3 lines
I must admit that I didn't check whether the audio side will query the cdclk again after every mode change. It really should, but often reality doesn't match my expectations :)
Hm right, we only change cdclk on modeset changes, and those will always generate an unsolicited event irq. So if we break stuff here that's indeed just a bug in hda-intel and not something we can't fix. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/18 drm/i915: Unify ilk and hsw .get_aux_clock_divider()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
ilk_get_aux_clock_divider() is now a subset ofhsw_get_aux_clock_divider() so unify them.
--- drivers/gpu/drm/i915/intel_dp.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -19
@@ -700,22 +700,6 @@ static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)struct drm_device *dev = intel_dig_port->base.base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -if (index) -return 0 ; - -if (intel_dig_port->port ==PORT_A ) { -return DIV_ROUND_UP (dev_priv->cdclk_freq,2000 ); - }else { -return DIV_ROUND_UP (intel_pch_rawclk (dev),2 ); - } -} - -static uint32_t hsw_get_aux_clock_divider (struct intel_dp *intel_dp,int index) -{ -struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp); -struct drm_device *dev = intel_dig_port->base.base.dev; -struct drm_i915_private *dev_priv = dev->dev_private; -if (intel_dig_port->port ==PORT_A ) {if (index)return 0 ;
@@ -728,7 +712,9 @@ static uint32_t hsw_get_aux_clock_divider(struct intel_dp *intel_dp, int index)default :return 0 ; } }else { -return index ?0 :DIV_ROUND_UP (intel_pch_rawclk (dev),2 ); +if (index) +return 0 ; +return DIV_ROUND_UP (intel_pch_rawclk (dev),2 ); } }
@@ -5346,8 +5332,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; else if (IS_VALLEYVIEW(dev)) intel_dp->get_aux_clock_divider = vlv_get_aux_clock_divider; - else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) - intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider; else if (HAS_PCH_SPLIT(dev)) intel_dp->get_aux_clock_divider = ilk_get_aux_clock_divider; else
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/18 drm/i915: Store max cdclk value in dev_priv
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Keep the cdclk maximum supported frequency around in dev_priv so that we can verify certain things against it before actually changing the cdclk frequency.
For now only VLV/CHV have support changing cdclk frequency, so other plarforms get to assume cdclk is fixed.
--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -1632,7 +1632,7 @@ struct drm_i915_private {int num_fence_regs;/* 8 on pre-965, 16 otherwise */ unsigned int fsb_freq, mem_freq, is_ddr3; -unsigned int cdclk_freq; +unsigned int cdclk_freq, max_cdclk_freq;unsigned int hpll_freq;/**
drivers/gpu/drm/i915/intel_display.c +19 -1
@@ -4745,6 +4745,21 @@ static int valleyview_get_vco(struct drm_i915_private *dev_priv)return vco_freq[hpll_freq] *1000 ; } +static void intel_update_max_cdclk (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +if (IS_VALLEYVIEW (dev)) { + dev_priv->max_cdclk_freq =400000 ; + }else { +/* otherwise assume cdclk is fixed */ + dev_priv->max_cdclk_freq = dev_priv->cdclk_freq; + } + +DRM_DEBUG_DRIVER ("Max CD clock rate: %d kHz\n" , + dev_priv->max_cdclk_freq); +} +static void intel_update_cdclk (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4761,6 +4776,9 @@ static void intel_update_cdclk(struct drm_device *dev)*/ I915_WRITE (GMBUSFREQ_VLV ,DIV_ROUND_UP (dev_priv->cdclk_freq,1000 )); } + +if (dev_priv->max_cdclk_freq ==0 ) +intel_update_max_cdclk (dev); }/* Adjust CDclk dividers to allow high res or save power if possible */
@@ -5519,7 +5537,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,/* FIXME should check pixel clock limits on all platforms */ if (INTEL_INFO (dev)->gen <4 ) { -int clock_limit = dev_priv->cdclk_freq; +int clock_limit = dev_priv->max_cdclk_freq;/* * Enable pixel doubling when the dot clock
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/18] drm/i915: Store max cdclk value in dev_priv
Quoted 5 lines · On Mon, Nov 17, 2014 at 04:43:47PM +0200, [email protected] wrote:
drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static int valleyview_get_vco(struct drm_i915_private *dev_priv) · line 4753
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0@@ -4745,6 +4745,21 @@ static int valleyview_get_vco(struct drm_i915_private *dev_priv)return vco_freq[hpll_freq] *1000 ; } +static void intel_update_max_cdclk (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +if (IS_VALLEYVIEW (dev)) { + dev_priv->max_cdclk_freq =400000 ;
I've thought the 400MHz mode is busted? Or is that just Punit bonghits on SDVs and pre-prod boards?
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/18] drm/i915: Store max cdclk value in dev_priv
Quoted 9 lines · Daniel Vetter
Quoted 8 lines · On Mon, Nov 17, 2014 at 04:43:47PM +0200, [email protected] wrote:
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -4745,6 +4745,21 @@ static int valleyview_get_vco(struct drm_i915_private *dev_priv)return vco_freq[hpll_freq] *1000 ; }
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int valleyview_get_vco(struct drm_i915_private *dev_priv) · line 4753
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+static void intel_update_max_cdclk (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +if (IS_VALLEYVIEW (dev)) { + dev_priv->max_cdclk_freq =400000 ;I've thought the 400MHz mode is busted? Or is that just Punit bonghits on SDVs and pre-prod boards?
AFAIK it should work. It's just that the Punit doesn't actually support it, so we have to bypass the Punit and poke at CCK directly to get there.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/18 drm/i915: Don't enable IPS when pixel rate exceeds 95% of cdclk
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Bspec says we shouldn't enable IPS on BDW when the pipe pixel rate exceeds 95% of the core display clock. Apparently this can cause underruns.
There's no similar restriction listed for HSW, so leave that one alone for now.
v2: Add pipe_config_supports_ips() (Chris)
v3: Compare against the max cdclk insted of the current cdclk
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83497
--- drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 16 +++++++--------- 3 files changed, 36 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +28 -2
@@ -5520,12 +5520,38 @@ retry:return setup_ok ?0 : -EINVAL ; } +static bool pipe_config_supports_ips (struct drm_i915_private *dev_priv, +struct intel_crtc_config *pipe_config) +{ +if (pipe_config->pipe_bpp >24 ) +return false; + +/* HSW can handle pixel rate up to cdclk? */ +if (IS_HASWELL (dev_priv->dev)) +return true; + +/* +* FIXME if we compare against max we should then +* increase the cdclk frequency when the current +* value is too low. The other option is to compare +* against the cdclk frqeuncy we're going have post +* modeset (ie. one we computed using other constraints). +* Need to measure whether using a lower cdclk w/o IPS +* is better or worse than a higher cdclk w/ IPS. +*/ +return ilk_pipe_pixel_rate (pipe_config) <= + dev_priv->max_cdclk_freq *95 /100 ; +} +static void hsw_compute_ips_config (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config) { +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; + pipe_config->ips_enabled = i915.enable_ips && -hsw_crtc_supports_ips (crtc) && - pipe_config->pipe_bpp <=24 ; +hsw_crtc_supports_ips (crtc) && +pipe_config_supports_ips (dev_priv, pipe_config); } static int intel_crtc_compute_config(struct intel_crtc *crtc,
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1169,6 +1169,7 @@ void ilk_wm_get_hw_state(struct drm_device *dev);void skl_wm_get_hw_state (struct drm_device *dev);void skl_ddb_get_hw_state (struct drm_i915_private *dev_priv,struct skl_ddb_allocation *ddb/* out */ ); +uint32_t ilk_pipe_pixel_rate (const struct intel_crtc_config *pipe_config);/* intel_sdvo.c */
drivers/gpu/drm/i915/intel_pm.c +7 -9
@@ -1892,23 +1892,21 @@ static void i845_update_wm(struct drm_crtc *unused_crtc)I915_WRITE (FW_BLC , fwater_lo); } -static uint32_t ilk_pipe_pixel_rate (struct drm_device *dev, -struct drm_crtc *crtc) +uint32_t ilk_pipe_pixel_rate (const struct intel_crtc_config *pipe_config) { -struct intel_crtc *intel_crtc =to_intel_crtc (crtc);uint32_t pixel_rate; - pixel_rate = intel_crtc->config.adjusted_mode.crtc_clock; + pixel_rate = pipe_config->adjusted_mode.crtc_clock;/* We only use IF-ID interlacing. If we ever use PF-ID we'll need to * adjust the pixel_rate here. */ -if (intel_crtc->config.pch_pfit.enabled) { +if (pipe_config->pch_pfit.enabled) {uint64_t pipe_w, pipe_h, pfit_w, pfit_h; -uint32_t pfit_size = intel_crtc->config.pch_pfit.size; +uint32_t pfit_size = pipe_config->pch_pfit.size; - pipe_w = intel_crtc->config.pipe_src_w; - pipe_h = intel_crtc->config.pipe_src_h; + pipe_w = pipe_config->pipe_src_w; + pipe_h = pipe_config->pipe_src_h; pfit_w = (pfit_size >>16 ) &0xFFFF ; pfit_h = pfit_size &0xFFFF ;if (pipe_w < pfit_w)
@@ -2522,7 +2520,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc, p->active = true; p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; - p->pixel_rate =ilk_pipe_pixel_rate (dev, crtc); + p->pixel_rate =ilk_pipe_pixel_rate (&intel_crtc->config); p->pri.bytes_per_pixel = crtc->primary->fb->bits_per_pixel /8 ; p->cur.bytes_per_pixel =4 ; p->pri.horiz_pixels = intel_crtc->config.pipe_src_w;
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/18] drm/i915: Don't enable IPS when pixel rate exceeds 95% of cdclk
Quoted 41 lines · On Mon, Nov 17, 2014 at 3:43 PM, <[email protected]> wrote:
From: Ville Syrjälä <[email protected]>
Bspec says we shouldn't enable IPS on BDW when the pipe pixel rate exceeds 95% of the core display clock. Apparently this can cause underruns.
There's no similar restriction listed for HSW, so leave that one alone for now.
v2: Add
pipe_config_supports_ips()(Chris)
v3: Compare against the max cdclk insted of the current cdclkTested-by Timo Aaltonen <[email protected]>Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83497
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 16 +++++++--------- 3 files changed, 36 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_display.c +12
-0@@ -5520,12 +5520,38 @@ retry:return setup_ok ?0 : -EINVAL ; } +static bool pipe_config_supports_ips (struct drm_i915_private *dev_priv, +struct intel_crtc_config *pipe_config) +{ +if (pipe_config->pipe_bpp >24 ) +return false; + +/* HSW can handle pixel rate up to cdclk? */ +if (IS_HASWELL (dev_priv->dev)) +return true; + +/* +* FIXME if we compare against max we should then
drivers/gpu/drm/i915/intel_display.c retry: · line 5544
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+* increase the cdclk frequency when the current +* value is too low. The other option is to compare +* against the cdclk frqeuncy we're going have post +* modeset (ie. one we computed using other constraints). +* Need to measure whether using a lower cdclk w/o IPS +* is better or worse than a higher cdclk w/ IPS. +*/ +return ilk_pipe_pixel_rate (pipe_config) <= + dev_priv->max_cdclk_freq *95 /100 ; +}
Adding Art for insight into this question (lower cdclock or ips) or whether this just isn't worth the complexity.
-Daniel
Quoted 77 lines
drivers/gpu/drm/i915/intel_display.c +6
-2+static void hsw_compute_ips_config (struct intel_crtc *crtc,struct intel_crtc_config *pipe_config) { +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; + pipe_config->ips_enabled = i915.enable_ips && -hsw_crtc_supports_ips (crtc) && - pipe_config->pipe_bpp <=24 ; +hsw_crtc_supports_ips (crtc) && +pipe_config_supports_ips (dev_priv, pipe_config); } static int intel_crtc_compute_config(struct intel_crtc *crtc,drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1169,6 +1169,7 @@ void ilk_wm_get_hw_state(struct drm_device *dev);void skl_wm_get_hw_state (struct drm_device *dev);void skl_ddb_get_hw_state (struct drm_i915_private *dev_priv,struct skl_ddb_allocation *ddb/* out */ ); +uint32_t ilk_pipe_pixel_rate (const struct intel_crtc_config *pipe_config);/* intel_sdvo.c */ drivers/gpu/drm/i915/intel_pm.c +7
-10@@ -1892,23 +1892,21 @@ static void i845_update_wm(struct drm_crtc *unused_crtc)I915_WRITE (FW_BLC , fwater_lo); } -static uint32_t ilk_pipe_pixel_rate (struct drm_device *dev, -struct drm_crtc *crtc) +uint32_t ilk_pipe_pixel_rate (const struct intel_crtc_config *pipe_config) { -struct intel_crtc *intel_crtc =to_intel_crtc (crtc);uint32_t pixel_rate; - pixel_rate = intel_crtc->config.adjusted_mode.crtc_clock; + pixel_rate = pipe_config->adjusted_mode.crtc_clock;/* We only use IF-ID interlacing. If we ever use PF-ID we'll need to * adjust the pixel_rate here. */ -if (intel_crtc->config.pch_pfit.enabled) { +if (pipe_config->pch_pfit.enabled) {uint64_t pipe_w, pipe_h, pfit_w, pfit_h; -uint32_t pfit_size = intel_crtc->config.pch_pfit.size; +uint32_t pfit_size = pipe_config->pch_pfit.size; - pipe_w = intel_crtc->config.pipe_src_w; - pipe_h = intel_crtc->config.pipe_src_h; + pipe_w = pipe_config->pipe_src_w; + pipe_h = pipe_config->pipe_src_h; pfit_w = (pfit_size >>16 ) &0xFFFF ; pfit_h = pfit_size &0xFFFF ;if (pipe_w < pfit_w)@@ -2522,7 +2520,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc, p->active = true; p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; - p->pixel_rate =ilk_pipe_pixel_rate (dev, crtc); + p->pixel_rate =ilk_pipe_pixel_rate (&intel_crtc->config); p->pri.bytes_per_pixel = crtc->primary->fb->bits_per_pixel /8 ; p->cur.bytes_per_pixel =4 ; p->pri.horiz_pixels = intel_crtc->config.pipe_src_w; --2.0.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/18] drm/i915: Don't enable IPS when pixel rate exceeds 95% of cdclk
Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c retry: · line 5544
Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +12
-0+/* +* FIXME if we compare against max we should then +* increase the cdclk frequency when the current +* value is too low. The other option is to compare +* against the cdclk frqeuncy we're going have post +* modeset (ie. one we computed using other constraints). +* Need to measure whether using a lower cdclk w/o IPS +* is better or worse than a higher cdclk w/ IPS. +*/ +return ilk_pipe_pixel_rate (pipe_config) <= + dev_priv->max_cdclk_freq *95 /100 ; +}
Quoted 3 lines
Adding Art for insight into this question (lower cdclock or ips) or whether this just isn't worth the complexity.
-Daniel
IPS enabled probably saves more power than lower cdclk, but it will be dependent on resolution, content, and other features, like FBC and PSR. I don't have any real measurements.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 15/18 drm/i915: Fix chv cdclk support
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The specs seem to be full of misinformation wrt. the Punit register 0x36. Some versions still show the old VLV bit layout, some the new layout, and all of them seem to tell us nonsense about the cdclk value encoding.
Testing on actual hardware has shown that we simply need to program the desired CCK divider into the Punit register using the new layout of the bits. Doing that, the status bit change to indicate the same value, and the CCK 0x6b register also changes accordingly to indicate that CCK is now using the new divider.
--- drivers/gpu/drm/i915/intel_display.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -15
@@ -4855,23 +4855,23 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)switch (cdclk) {case 400000 : - cmd =3 ; -break ;case 333333 :case 320000 : - cmd =2 ; -break ;case 266667 : - cmd =1 ; -break ;case 200000 : - cmd =0 ;break ;default :WARN_ON (1 );return ; } +/* +* Specs are full of misinformation, but testing on actual +* hardware has shown that we just need to write the desired +* CCK divider into the Punit register. +*/ + cmd =DIV_ROUND_CLOSEST (dev_priv->hpll_freq <<1 , cdclk) -1 ; +mutex_lock (&dev_priv->rps.hw_lock); val =vlv_punit_read (dev_priv,PUNIT_REG_DSPFREQ ); val &= ~DSPFREQGUAR_MASK_CHV ;
@@ -4892,10 +4892,6 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv, {int freq_320 = (dev_priv->hpll_freq <<1 ) %320000 !=0 ?333333 :320000 ; -/* FIXME: Punit isn't quite ready yet */ -if (IS_CHERRYVIEW (dev_priv->dev)) -return 400000 ; -/* * Really only a few cases to deal with, as only 4 CDclks are supported: * 200MHz
@@ -5709,10 +5705,6 @@ static int valleyview_get_display_clock_speed(struct drm_device *dev)u32 val;int divider; -/* FIXME: Punit isn't quite ready yet */ -if (IS_CHERRYVIEW (dev)) -return 400000 ; -if (dev_priv->hpll_freq ==0 ) dev_priv->hpll_freq =valleyview_get_vco (dev_priv);
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 16/18 drm/i915: HSW cdclk change support
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Implement support for changing the cdclk frequency during runtime on HSW. VLV/CHV already have support for this, so we can follow their example for the most part. Only the actual hardware programming differs, the rest is pretty much the same.
The pipe pixel rate stuff is handled a bit differently for now due to the difference in pch vs. gmch pfit handling. Eventually we should unify that part to eliminate what is essentially duplicated code.
v2: Grab rps.hw_lock around sandybridge_pcode_write()
v3: Rebase due to power well vs. .global_resources() reordering
--- drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_display.c | 138 ++++++++++++++++++++++++++++++++++- 2 files changed, 138 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -6045,6 +6045,7 @@ enum punit_power_well {#define GEN6_PCODE_WRITE_D_COMP 0x11#define GEN6_ENCODE_RC6_VID (mv) (((mv) - 245) / 5)#define GEN6_DECODE_RC6_VID (vids) (((vids) * 5) + 245) +#define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17#define DISPLAY_IPS_CONTROL 0x19#define GEN6_PCODE_DATA 0x138128#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
@@ -6454,10 +6455,12 @@ enum punit_power_well {#define LCPLL_PLL_LOCK (1<<30)#define LCPLL_CLK_FREQ_MASK (3<<26)#define LCPLL_CLK_FREQ_450 (0<<26) +#define LCPLL_CLK_FREQ_ALT_HSW (1<<26)/* 337.5 (ULX) or 540 */ #define LCPLL_CLK_FREQ_54O_BDW (1<<26)#define LCPLL_CLK_FREQ_337_5_BDW (2<<26)#define LCPLL_CLK_FREQ_675_BDW (3<<26)#define LCPLL_CD_CLOCK_DISABLE (1<<25) +#define LCPLL_ROOT_CD_CLOCK_DISABLE (1<<24)#define LCPLL_CD2X_CLOCK_DISABLE (1<<23)#define LCPLL_POWER_DOWN_ALLOW (1<<22)#define LCPLL_CD_SOURCE_FCLK (1<<21)
drivers/gpu/drm/i915/intel_display.c +135 -3
162 lines not on this page · raw message
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 17/18 drm/i915: Add IS_BDW_ULX()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We need to tell BDW ULT and ULX apart.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2194,6 +2194,9 @@ struct drm_i915_cmd_table { ((INTEL_DEVID(dev) & 0xf) == 0x2 || \ (INTEL_DEVID(dev) & 0xf) == 0x6 || \ (INTEL_DEVID(dev) & 0xf) == 0xe)) +/* ULX machines are also considered ULT. */ +#define IS_BDW_ULX (dev) (IS_BROADWELL(dev) && \ + (INTEL_DEVID(dev) & 0xf) == 0xe)#define IS_BDW_GT3 (dev) (IS_BROADWELL(dev) && \ (INTEL_DEVID(dev) & 0x00F0) == 0x0020)#define IS_HSW_ULT (dev) (IS_HASWELL(dev) && \
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 18/18 drm/i915: BDW cdclk change support
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add support for changing cdclk frequency during runtime on BDW. The procedure is quite a bit different on BDW from the one on HSW, so add a separate function for it.
Also with IPS enabled the actual pixel rate mustn't exceed 95% of cdclk, so take that into account when computing the max pixel rate.
v2: Grab rps.hw_lock around sandybridge_pcode_write()
v3: Rebase due to power well vs. .global_resources() reordering
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 136 ++++++++++++++++++++++++++++++----- 2 files changed, 121 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -6046,6 +6046,7 @@ enum punit_power_well {#define GEN6_ENCODE_RC6_VID (mv) (((mv) - 245) / 5)#define GEN6_DECODE_RC6_VID (vids) (((vids) * 5) + 245)#define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17 +#define BDW_PCODE_DISPLAY_FREQ_CHANGE_REQ 0x18#define DISPLAY_IPS_CONTROL 0x19#define GEN6_PCODE_DATA 0x138128#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
drivers/gpu/drm/i915/intel_display.c +120 -16
184 lines not on this page · raw message
Signature · 6 lines
2.0.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 18/18] drm/i915: BDW cdclk change support
-------------------------------------Summary-------------------------------------
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=290/291->290/291
PNV: pass/total=356/356->355/356
ILK: pass/total=371/372->367/372
IVB: pass/total=545/546->545/546
SNB: pass/total=370/370->370/370
HSW: pass/total=581/581->579/581
BDW: pass/total=432/435->432/435
-------------------------------------Detailed-------------------------------------test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, machine_id...)...->result_with_patch_applied(count, machine_id)...
PNV: Intel_gpu_tools, igt_kms_sysfs_edid_timing, PASS(4, M7M23) -> FAIL(1, M23)PASS(3, M23)
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-modeset-vs-hang, PASS(4, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-modeset-vs-hang-interruptible, DMESG_WARN(1, M26)PASS(3, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_plain-flip, PASS(4, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
ILK: Intel_gpu_tools, igt_kms_flip_wf_vblank-vs-modeset-interruptible, DMESG_WARN(1, M26)PASS(3, M37M26) -> DMESG_WARN(1, M26)PASS(3, M26)
HSW: Intel_gpu_tools, igt_pm_rpm_cursor-dpms, DMESG_WARN(3, M40)PASS(1, M40) -> DMESG_WARN(1, M40)PASS(3, M40)
HSW: Intel_gpu_tools, igt_pm_rpm_dpms-mode-unset-non-lpsp, DMESG_WARN(3, M40)PASS(1, M40) -> DMESG_WARN(1, M40)PASS(3, M40)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx