Skip to contentSkip to conversation

drm/i915: Allow pixel clock up to 95% of cdclk on CHV

PATCH In review [email protected] 5 participants 8 messages Mar 2, 2015 – Mar 9, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: Allow pixel clock up to 95% of cdclk on CHV

From: Ville Syrjälä <[email protected]>

Supposedly CHV can sustain a pixel clock of up to 95% of cdclk, as opposed to the 90% limit that was used old older platforms. Update the cdclk selection code to allow for this.

This will allow eg. HDMI 4k modes with their 297MHz pixel clock while still respecting the 320 MHz cdclk limit on CHV.

---
 drivers/gpu/drm/i915/intel_display.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -5
index 3fe9598..94ff310 100644
@@ -4926,6 +4926,7 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
 				 int max_pixclk)
 {
 	int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 333333 : 320000;
+	int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
 
 	/* FIXME: Punit isn't quite ready yet */
 	if (IS_CHERRYVIEW(dev_priv->dev))
@@ -4936,17 +4937,18 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
 	 *   200MHz
 	 *   267MHz
 	 *   320/333MHz (depends on HPLL freq)
-	 *   400MHz
-	 * So we check to see whether we're above 90% of the lower bin and
-	 * adjust if needed.
+	 *   400MHz (VLV only)
+	 * So we check to see whether we're above 90% (VLV) or 95% (CHV)
+	 * of the lower bin and adjust if needed.
 	 *
 	 * We seem to get an unstable or solid color picture at 200MHz.
 	 * Not sure what's wrong. For now use 200MHz only when all pipes
 	 * are off.
 	 */
-	if (max_pixclk > freq_320*9/10)
+	if (!IS_CHERRYVIEW(dev_priv) &&
+	    max_pixclk > freq_320*limit/100)
 		return 400000;
-	else if (max_pixclk > 266667*9/10)
+	else if (max_pixclk > 266667*limit/100)
 		return freq_320;
 	else if (max_pixclk > 0)
 		return 266667;
Signature · 6 lines
2.0.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm/i915: Fix chv cdclk support

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 | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -16
index 94ff310..ca49b6f 100644
@@ -4889,24 +4889,23 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
 	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
 
 	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:
 		MISSING_CASE(cdclk);
 		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;
@@ -4928,10 +4927,6 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
 	int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 333333 : 320000;
 	int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
 
-	/* 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
@@ -5606,10 +5601,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.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915: Fix chv cdclk support

Task id: 5872 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV -7 278/278 271/278
ILK 308/308 308/308
SNB -1 284/284 283/284

IVB                                  380/380              380/380
BYT                                  294/294              294/294
HSW                                  387/387              387/387
BDW                 -1              316/316              315/316
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*PNV  igt_gem_fence_thrash_bo-write-verify-none      PASS(5)      FAIL(1)PASS(1)
*PNV  igt_gem_fence_thrash_bo-write-verify-x      PASS(5)      FAIL(1)PASS(1)
*PNV  igt_gem_fence_thrash_bo-write-verify-y      PASS(5)      FAIL(1)NO_RESULT(1)
 PNV  igt_gem_userptr_blits_coherency-sync      CRASH(5)NRUN(1)PASS(7)      CRASH(2)
 PNV  igt_gem_userptr_blits_coherency-unsync      NO_RESULT(1)CRASH(4)PASS(6)      CRASH(1)PASS(1)
*PNV  igt_gen3_render_linear_blits      FAIL(3)DMESG_WARN(1)PASS(7)      FAIL(1)NO_RESULT(1)
*PNV  igt_gen3_render_mixed_blits      FAIL(5)PASS(9)      FAIL(1)NO_RESULT(1)
*SNB  igt_gem_fence_thrash_bo-write-verify-y      PASS(5)      DMESG_WARN(1)PASS(1)
*BDW  igt_gem_gtt_hog      PASS(16)      DMESG_WARN(1)PASS(1)

Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] drm/i915: Fix chv cdclk support

In reply to [email protected]
Quoted 7 lines · On 3/2/2015 11:37 PM, [email protected] wrote:

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.

Quoted 7 lines

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.

Thanks,
Vijay

Quoted 52 lines
---
  drivers/gpu/drm/i915/intel_display.c | 23 +++++++----------------
  1 file changed, 7 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -12
index 94ff310..ca49b6f 100644
@@ -4889,24 +4889,23 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
  	WARN_ON(dev_priv->display.get_display_clock_speed(dev) != dev_priv->vlv_cdclk_freq);
 
  	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:
  		MISSING_CASE(cdclk);
  		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;
@@ -4928,10 +4927,6 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
  	int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 333333 : 320000;
  	int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
 
-	/* 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

drivers/gpu/drm/i915/intel_display.c static int valleyview_get_display_clock_speed(struct drm_device *dev) · line 5606

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +0 -4
@@ -5606,10 +5601,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);
 

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/2] drm/i915: Fix chv cdclk support

Thank you,
Yogesh

Quoted 81 lines · Vijay A
Quoted 7 lines · On 3/2/2015 11:37 PM, [email protected] wrote:

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.

Quoted 7 lines

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.

Thanks,
Vijay

Quoted 60 lines
---
  drivers/gpu/drm/i915/intel_display.c | 23 +++++++----------------
  1 file changed, 7 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -11
index 94ff310..ca49b6f 100644
@@ -4889,24 +4889,23 @@ static void cherryview_set_cdclk(struct 
 drm_device *dev, int cdclk)
      WARN_ON(dev_priv->display.get_display_clock_speed(dev) != 
 dev_priv->vlv_cdclk_freq);
        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:
          MISSING_CASE(cdclk);
          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;
@@ -4928,10 +4927,6 @@ static int valleyview_calc_cdclk(struct 
 drm_i915_private *dev_priv,
      int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 
 333333 : 320000;
      int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
  -    /* 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

drivers/gpu/drm/i915/intel_display.c +0 -2
@@ -5606,10 +5601,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;
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c static int valleyview_get_display_clock_speed(struct drm_device *dev) · line 5605

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +0 -1
-
      if (dev_priv->hpll_freq == 0)
          dev_priv->hpll_freq = valleyview_get_vco(dev_priv);

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [PATCH 2/2] drm/i915: Fix chv cdclk support

Quoted 22 lines · Yogesh

Thank you,
Yogesh

Quoted 16 lines · Vijay A
Quoted 7 lines · On 3/2/2015 11:37 PM, [email protected] wrote:

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.

Quoted 7 lines

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.

Both patches from this series merged, thanks.
-Daniel

Quoted 79 lines
Quoted 66 lines

Thanks,
Vijay

Quoted 61 lines
---
 drivers/gpu/drm/i915/intel_display.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -11
index 94ff310..ca49b6f 100644
@@ -4889,24 +4889,23 @@ static void cherryview_set_cdclk(struct
 drm_device *dev, int cdclk)
     WARN_ON(dev_priv->display.get_display_clock_speed(dev) !=
 dev_priv->vlv_cdclk_freq);
       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:
         MISSING_CASE(cdclk);
         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;
@@ -4928,10 +4927,6 @@ static int valleyview_calc_cdclk(struct
 drm_i915_private *dev_priv,
     int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 333333
 : 320000;
     int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
 -    /* 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

drivers/gpu/drm/i915/intel_display.c +0 -2
@@ -5606,10 +5601,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;
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c static int valleyview_get_display_clock_speed(struct drm_device *dev) · line 5605

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +0 -1
-
     if (dev_priv->hpll_freq == 0)
         dev_priv->hpll_freq = valleyview_get_vco(dev_priv);

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
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
Reviewed-by on v1 1/2
#6 lore raw
In reply to [email protected]
Quoted 10 lines · On 3/2/2015 11:37 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Supposedly CHV can sustain a pixel clock of up to 95% of cdclk, as opposed to the 90% limit that was used old older platforms. Update the cdclk selection code to allow for this.

This will allow eg. HDMI 4k modes with their 297MHz pixel clock while still respecting the 320 MHz cdclk limit on CHV.

Thanks for forwarding the post si team confirmation. We were in the dark about this as usual.

Thanks,
Vijay

Quoted 30 lines
---
  drivers/gpu/drm/i915/intel_display.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -3
index 3fe9598..94ff310 100644
@@ -4926,6 +4926,7 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
  				 int max_pixclk)
  {
  	int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 333333 : 320000;
+	int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
 
  	/* FIXME: Punit isn't quite ready yet */
  	if (IS_CHERRYVIEW(dev_priv->dev))
@@ -4936,17 +4937,18 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
  	 *   200MHz
  	 *   267MHz
  	 *   320/333MHz (depends on HPLL freq)
-	 *   400MHz
-	 * So we check to see whether we're above 90% of the lower bin and
-	 * adjust if needed.
+	 *   400MHz (VLV only)
+	 * So we check to see whether we're above 90% (VLV) or 95% (CHV)
+	 * of the lower bin and adjust if needed.
  	 *
  	 * We seem to get an unstable or solid color picture at 200MHz.
  	 * Not sure what's wrong. For now use 200MHz only when all pipes
  	 * are off.

drivers/gpu/drm/i915/intel_display.c static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv, · line 4954

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3 -2
  	 */
-	if (max_pixclk > freq_320*9/10)
+	if (!IS_CHERRYVIEW(dev_priv) &&
+	    max_pixclk > freq_320*limit/100)
  		return 400000;
-	else if (max_pixclk > 266667*9/10)
+	else if (max_pixclk > 266667*limit/100)
  		return freq_320;
  	else if (max_pixclk > 0)
  		return 266667;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Thank you,
Yogesh

Quoted 56 lines · Vijay A
Quoted 10 lines · On 3/2/2015 11:37 PM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Supposedly CHV can sustain a pixel clock of up to 95% of cdclk, as opposed to the 90% limit that was used old older platforms. Update the cdclk selection code to allow for this.

This will allow eg. HDMI 4k modes with their 297MHz pixel clock while still respecting the 320 MHz cdclk limit on CHV.

Thanks for forwarding the post si team confirmation. We were in the dark about this as usual.

Thanks,
Vijay

Quoted 39 lines
---
  drivers/gpu/drm/i915/intel_display.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
index 3fe9598..94ff310 100644
@@ -4926,6 +4926,7 @@ static int valleyview_calc_cdclk(struct 
 drm_i915_private *dev_priv,
                   int max_pixclk)
  {
      int freq_320 = (dev_priv->hpll_freq <<  1) % 320000 != 0 ? 
 333333 : 320000;
+    int limit = IS_CHERRYVIEW(dev_priv) ? 95 : 90;
        /* FIXME: Punit isn't quite ready yet */
      if (IS_CHERRYVIEW(dev_priv->dev))
drivers/gpu/drm/i915/intel_display.c +6 -5
@@ -4936,17 +4937,18 @@ static int valleyview_calc_cdclk(struct 
 drm_i915_private *dev_priv,
       *   200MHz
       *   267MHz
       *   320/333MHz (depends on HPLL freq)
-     *   400MHz
-     * So we check to see whether we're above 90% of the lower bin and
-     * adjust if needed.
+     *   400MHz (VLV only)
+     * So we check to see whether we're above 90% (VLV) or 95% (CHV)
+     * of the lower bin and adjust if needed.
       *
       * We seem to get an unstable or solid color picture at 200MHz.
       * Not sure what's wrong. For now use 200MHz only when all pipes
       * are off.
       */
-    if (max_pixclk > freq_320*9/10)
+    if (!IS_CHERRYVIEW(dev_priv) &&
+        max_pixclk > freq_320*limit/100)
          return 400000;
-    else if (max_pixclk > 266667*9/10)
+    else if (max_pixclk > 266667*limit/100)
Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
          return freq_320;
      else if (max_pixclk > 0)
          return 266667;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx