Skip to contentSkip to conversation

drm/i915/glk: limit pixel clock to 99% of cdclk workaround

PATCH In review Jani Nikula 5 participants 13 messages Apr 4, 2017

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

PATCH 1/1 drm/i915/glk: limit pixel clock to 99% of cdclk workaround

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some scenarios.

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc Ander Conselvan de Oliveira <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +13 -3
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
 static int glk_calc_cdclk(int max_pixclk)
 {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note that
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of max
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Jani Nikula

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some scenarios.

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc Ander Conselvan de Oliveira <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1076

Quoted 7 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -1
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
 static int glk_calc_cdclk(int max_pixclk)
 {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

With that fixed,

Quoted 13 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of max
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) · line 1680

Quoted 10 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;

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

#2 lore raw
Quoted 30 lines · Ander Conselvan De Oliveira
Quoted 29 lines · Jani Nikula

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some scenarios.

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc Ander Conselvan de Oliveira <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1076

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -1
 static int glk_calc_cdclk(int max_pixclk)
 {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write. There are issues with pixel clocks near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

BR,
Jani.

Quoted 28 lines

With that fixed,

Quoted 23 lines
drivers/gpu/drm/i915/intel_cdclk.c +10 -2
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of max
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 44 lines · Jani Nikula
Quoted 30 lines · Ander Conselvan De Oliveira
Quoted 29 lines · Jani Nikula

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some scenarios.

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc Ander Conselvan de Oliveira <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1076

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -1
 static int glk_calc_cdclk(int max_pixclk)
 {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

Quoted 6 lines

There are issues with pixel clocks
near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Ander

Quoted 17 lines
Quoted 17 lines

With that fixed,

Quoted 13 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of max
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
Quoted 12 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) · line 1680

Quoted 10 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;

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

#4 lore raw
Quoted 52 lines · Ander Conselvan De Oliveira
Quoted 44 lines · Jani Nikula
Quoted 30 lines · Ander Conselvan De Oliveira
Quoted 29 lines · Jani Nikula

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some scenarios.

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc Ander Conselvan de Oliveira <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1076

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -1
 static int glk_calc_cdclk(int max_pixclk)
 {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

Quoted 6 lines

There are issues with pixel clocks
near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Quoted 33 lines

Ander

Quoted 29 lines
Quoted 27 lines

With that fixed,

Quoted 23 lines
drivers/gpu/drm/i915/intel_cdclk.c +10 -2
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of max
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 68 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 2 lines · Ander Conselvan De Oliveira
Quoted 1 line · Jani Nikula

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 7 lines · <[email protected]> wrote:
Quoted 7 lines
Quoted 7 lines · Jani Nikula
Quoted 6 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 45 lines
Quoted 44 lines
Quoted 25 lines
Quoted 25 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc: Ander Conselvan de Oliveira
<[email protected]>

---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk)

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note
+that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

There are issues with pixel clocks
near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 4 lines
Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel
exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ
2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ
3. Practically 100% of the cdclk can’t be achieved, so 99% of 158400 KHZ = 156816 which is less than the desired pixlclk. This causes the corruption.

So why do we need to mention a particular panel??

Quoted 38 lines
Quoted 11 lines

Ander

Quoted 5 lines
Quoted 5 lines

With that fixed,

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1077

Quoted 1 line
drivers/gpu/drm/i915/intel_cdclk.c +1 -0
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of

max

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct

Quoted 10 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 14 lines
Quoted 14 lines
Quoted 12 lines

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) · line 1680

Quoted 12 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;
Quoted 2 lines

--
Jani Nikula, Intel Open Source Technology Center

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

#6 lore raw
Quoted 75 lines · Madhav
Quoted 70 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 2 lines · Ander Conselvan De Oliveira
Quoted 1 line · Jani Nikula

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 7 lines · <[email protected]> wrote:
Quoted 7 lines
Quoted 7 lines · Jani Nikula
Quoted 6 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 45 lines
Quoted 44 lines
Quoted 25 lines
Quoted 25 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc: Ander Conselvan de Oliveira
<[email protected]>

---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk)

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note
+that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

There are issues with pixel clocks
near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 4 lines
Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Quoted 8 lines

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel
exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ
2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ
3. Practically 100% of the cdclk can’t be achieved, so 99% of 158400 KHZ = 156816 which is less than the desired pixlclk. This causes the corruption.

So why do we need to mention a particular panel??

If someone else needs to deal with this six months or a year from now and you, me and Jani are nowhere to be found, the code or commit message should still have enough information to let that person assess whether it is safe to remove the workaround or not. Having the model number just makes it easier to determine what real world scenario triggers this problem, so it is easier to test a fix.

Ander

Quoted 41 lines
Quoted 41 lines
Quoted 4 lines
Quoted 8 lines

Ander

Quoted 5 lines
Quoted 5 lines

With that fixed,

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1077

Quoted 1 line
drivers/gpu/drm/i915/intel_cdclk.c +1 -0
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of

max

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct

Quoted 10 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 14 lines
Quoted 14 lines
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;
Quoted 2 lines
Quoted 2 lines

--
Jani Nikula, Intel Open Source Technology Center

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

#7 lore raw
Quoted 97 lines

-----Original Message-----
From: Ander Conselvan De Oliveira [mailto:[email protected]]
Sent: Tuesday, April 4, 2017 4:13 PM
To: Chauhan, Madhav <[email protected]>; Nikula, Jani <[email protected]>; [email protected]
Cc: Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 53 lines · Madhav
Quoted 53 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 2 lines · Ander Conselvan De Oliveira
Quoted 1 line · Jani Nikula

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines · Jani Nikula
Quoted 7 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc: Ander Conselvan de Oliveira
<[email protected]>

---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int
 max_pixclk)
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1075

Quoted 4 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of

the cdclk

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 9 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1077

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * as a temporary workaround. Use a higher cdclk instead.
+(Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

Quoted 6 lines

There are issues with pixel clocks near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Quoted 7 lines
Quoted 1 line

Madhav?

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ 2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ 3. Practically 100% of the cdclk can’t be achieved, so 99% of

158400 KHZ = 156816 which is less than the desired pixlclk.

Quoted 2 lines

This causes the corruption.

Quoted 8 lines
Quoted 1 line

So why do we need to mention a particular panel??

If someone else needs to deal with this six months or a year from now and you, me and Jani are nowhere to be found, the code or commit message should still have enough information to let that person assess whether it is safe to remove the workaround or not. Having the model number just makes it easier to determine what real world scenario triggers this problem, so it is easier to test a fix.

Agree from this perspective. Will add this explanation in commit message.

Quoted 32 lines

Ander

Quoted 29 lines
Quoted 29 lines
Quoted 7 lines

Ander

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

With that fixed,

Reviewed-by: Ander Conselvan de Oliveira
<[email protected]>

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1079

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * intel_compute_max_dotclk() limits the max pixel clock
+to 99% of

max

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int

intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary

workaround. See

Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -0
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;

--
Jani Nikula, Intel Open Source Technology Center

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

#8 lore raw
In reply to Chauhan, Madhav
Quoted 68 lines · Madhav
Quoted 68 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 2 lines · Ander Conselvan De Oliveira
Quoted 1 line · Jani Nikula

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 7 lines · <[email protected]> wrote:
Quoted 7 lines
Quoted 7 lines · Jani Nikula
Quoted 6 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 45 lines
Quoted 44 lines
Quoted 25 lines
Quoted 25 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc: Ander Conselvan de Oliveira
<[email protected]>

---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int max_pixclk)
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk)

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk
+	 * as a temporary workaround. Use a higher cdclk instead. (Note
+that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

There are issues with pixel clocks
near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ

And what is the actual pixel clock we end up using? As I've mentioned before our code is buggy because it assumes we can get any arbitrary clock frequency from the PLL. That is not generally true.

So I'd like to know if the problem really is that we can't reach 100% of cdclk, or if we just end up with a pixel clock that slightly higher than what we asked for and thus exceeds 100% of cdclk.

And if the problem is really that we can't reach 100% of cdclk, then why are we limiting this to GLK only?

Quoted 46 lines

2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ
3. Practically 100% of the cdclk can’t be achieved, so 99% of 158400 KHZ = 156816 which is less than the desired pixlclk. This causes the corruption.

So why do we need to mention a particular panel??

Quoted 40 lines
Quoted 11 lines

Ander

Quoted 5 lines
Quoted 5 lines

With that fixed,

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int max_pixclk) · line 1077

Quoted 1 line
drivers/gpu/drm/i915/intel_cdclk.c +1 -0
+	 * intel_compute_max_dotclk() limits the max pixel clock to 99% of

max

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct

Quoted 10 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 14 lines
Quoted 14 lines
Quoted 12 lines

drivers/gpu/drm/i915/intel_cdclk.c static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) · line 1680

Quoted 12 lines
drivers/gpu/drm/i915/intel_cdclk.c +5 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary workaround. See
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;

--
Jani Nikula, Intel Open Source Technology Center

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 91 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, April 4, 2017 5:09 PM
To: Chauhan, Madhav <[email protected]>
Cc: Nikula, Jani <[email protected]>; Ander Conselvan De Oliveira <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 51 lines · Madhav
Quoted 51 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 2 lines · Ander Conselvan De Oliveira
Quoted 1 line · Jani Nikula

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines · Jani Nikula
Quoted 7 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc: Ander Conselvan de Oliveira
<[email protected]>

---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int
 max_pixclk)
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1075

Quoted 4 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of

the cdclk

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1077

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * as a temporary workaround. Use a higher cdclk instead.
+(Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

There are issues with pixel clocks near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ

Quoted 7 lines

And what is the actual pixel clock we end up using? As I've mentioned before our code is buggy because it assumes we can get any arbitrary clock frequency from the PLL. That is not generally true.

So I'd like to know if the problem really is that we can't reach 100% of cdclk, or if we just end up with a pixel clock that slightly higher than what we asked for and thus exceeds 100% of cdclk.

AFAIK (from testing, GOP team inputs), problem is that we can't reach 100%CDCLK on GLK.
In this scenario calculated/required pixel clock is 157100 KHZ (might be higher due to buggy code as you mentioned) which should be handled very well if we set CDCLK 79200 KHZ but causes panel corruption.

Quoted 3 lines

And if the problem is really that we can't reach 100% of cdclk, then why are we limiting this to GLK only?

From discussion, looks like issue is specific to GLK platform. HW team is debugging this issue.

Quoted 49 lines
Quoted 3 lines

2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ 3. Practically 100% of the cdclk can’t be achieved, so 99% of

158400 KHZ = 156816 which is less than the desired pixlclk.

Quoted 29 lines

This causes the corruption.

So why do we need to mention a particular panel??

Quoted 25 lines
Quoted 6 lines

Ander

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

With that fixed,

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1079

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * intel_compute_max_dotclk() limits the max pixel clock to
+99% of

max

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int

intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary

workaround. See

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -0
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

--
Jani Nikula, Intel Open Source Technology Center

--
Ville Syrjälä
Intel OTC

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

#10 lore raw
Quoted 95 lines · Madhav
Quoted 95 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, April 4, 2017 5:09 PM
To: Chauhan, Madhav <[email protected]>
Cc: Nikula, Jani <[email protected]>; Ander Conselvan De Oliveira <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 51 lines · Madhav
Quoted 51 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 2 lines · Ander Conselvan De Oliveira
Quoted 1 line · Jani Nikula

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines · Jani Nikula
Quoted 7 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8 Mhz. Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Cc: Ander Conselvan de Oliveira
<[email protected]>

---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int
 max_pixclk)
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1075

Quoted 4 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than 99% of

the cdclk

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1077

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * as a temporary workaround. Use a higher cdclk instead.
+(Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this issue.

Frankly I did not know what to write.

There are issues with pixel clocks near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ

And what is the actual pixel clock we end up using? As I've mentioned before our code is buggy because it assumes we can get any arbitrary clock frequency from the PLL. That is not generally true.

Quoted 6 lines
Quoted 3 lines

So I'd like to know if the problem really is that we can't reach 100% of cdclk, or if we just end up with a pixel clock that slightly higher than what we asked for and thus exceeds 100% of cdclk.

AFAIK (from testing, GOP team inputs), problem is that we can't reach 100%CDCLK on GLK.
In this scenario calculated/required pixel clock is 157100 KHZ (might be higher due to buggy code as you mentioned)

Well, what is the clock we get from the PLL exactly?

Quoted 64 lines

which should be handled very well if we set CDCLK 79200 KHZ but causes panel corruption.

Quoted 3 lines

And if the problem is really that we can't reach 100% of cdclk, then why are we limiting this to GLK only?

From discussion, looks like issue is specific to GLK platform. HW team is debugging this issue.

Quoted 55 lines
Quoted 3 lines

2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ 3. Practically 100% of the cdclk can’t be achieved, so 99% of

158400 KHZ = 156816 which is less than the desired pixlclk.

Quoted 29 lines

This causes the corruption.

So why do we need to mention a particular panel??

Quoted 25 lines
Quoted 6 lines

Ander

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

With that fixed,

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1079

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * intel_compute_max_dotclk() limits the max pixel clock to
+99% of

max

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_cdclk.c +4 -1
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int

intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary

workaround. See

Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -0
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;

--
Jani Nikula, Intel Open Source Technology Center

--
Ville Syrjälä
Intel OTC

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw
Quoted 113 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, April 4, 2017 6:26 PM
To: Chauhan, Madhav <[email protected]>
Cc: Nikula, Jani <[email protected]>; Ander Conselvan De Oliveira <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 23 lines · Madhav
Quoted 23 lines

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Tuesday, April 4, 2017 5:09 PM
To: Chauhan, Madhav <[email protected]>
Cc: Nikula, Jani <[email protected]>; Ander Conselvan De Oliveira <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

Quoted 13 lines · Madhav
Quoted 13 lines

-----Original Message-----
From: Nikula, Jani
Sent: Tuesday, April 4, 2017 3:48 PM
To: Ander Conselvan De Oliveira <[email protected]>; intel- [email protected]
Cc: Chauhan, Madhav <[email protected]>; Ville Syrjälä <[email protected]>
Subject: Re: [PATCH] drm/i915/glk: limit pixel clock to 99% of cdclk workaround

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira
<[email protected]>
wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines · Jani Nikula
Quoted 1 line

On Tue, 04 Apr 2017, Ander Conselvan De Oliveira

Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
Quoted 4 lines · Jani Nikula
Quoted 3 lines

From: Madhav Chauhan <[email protected]>

As per BSPEC, valid cdclk values for glk are 79.2, 158.4, 316.8

Mhz.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Practically we can achive only 99% of these cdclk values (HW team checking on this). So cdclk should be calculated for the given pixclk as per that otherwise it may lead to screen corruption for some

scenarios.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

v2: Rebased to new CDLCK code framework
v3: Addressed review comments from Ander/Jani
- Add comment in code about 99% usage of CDCLK
- Calculate max dot clock as well with 99% limit
v4 by Jani:
- drop superfluous whitespace change
- rewrite code comments to clarify

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Cc: Ander Conselvan de Oliveira <[email protected]>
Cc: Ville Syrjälä <[email protected]>
Signed-off-by: Madhav Chauhan

<[email protected]>

Quoted 19 lines
Quoted 19 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
---
 drivers/gpu/drm/i915/intel_cdclk.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +0 -0
index dd3ad52b7dfe..763010f8ad89 100644
@@ -1071,9 +1071,15 @@ static int bxt_calc_cdclk(int
 max_pixclk)
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1076

Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -1
 static int glk_calc_cdclk(int max_pixclk)  {
-	if (max_pixclk > 2 * 158400)
+	/*
+	 * FIXME: Avoid using a pixel clock that is more than
+99% of

the cdclk

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1078

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * as a temporary workaround. Use a higher cdclk instead.
+(Note that

Temporary workaround for what? Neither the comment nor the commit message explicitly lists the scenario that triggers this

issue.

Quoted 28 lines
Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

Frankly I did not know what to write.

There are issues with pixel clocks near cdclk that shouldn't happen. People are looking into this, but in the mean time dodge the issues by using higher cdclk. The issue should not be encoder specific, but in practice this has only been seen with DSI because there were some modes with pixel clocks that are near the cdclk.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The above plus the model number of the DSI panel with which the issue has been seen would be good enough IMO.

Madhav?

Issue is generic (valid for DP/HDMI) not just MIPI DSI specific. Particular DSI panel exposing this issue as described below:
1. For XXXX panel (19X12) required pixclk is 157100 KHZ

And what is the actual pixel clock we end up using? As I've mentioned before our code is buggy because it assumes we can get any arbitrary clock frequency from the PLL. That is not generally true.

So I'd like to know if the problem really is that we can't reach 100% of cdclk, or if we just end up with a pixel clock that slightly higher than what we asked for and thus exceeds 100% of cdclk.

Quoted 6 lines
Quoted 1 line

AFAIK (from testing, GOP team inputs), problem is that we can't reach

100%CDCLK on GLK.

Quoted 2 lines

In this scenario calculated/required pixel clock is 157100 KHZ (might be higher due to buggy code as you mentioned)

Well, what is the clock we get from the PLL exactly?

Please explain more if I misunderstood your question.
For DSI, we get pclk for a panel by VBT parsing. On the basis of this pclk we Program PLL dividers and then enable the PLL to generate the required clk. Do you mean this pclk??

Quoted 66 lines
Quoted 2 lines

which should be handled very well if we set CDCLK 79200 KHZ but causes

panel corruption.

Quoted 63 lines
Quoted 4 lines

And if the problem is really that we can't reach 100% of cdclk, then why are we limiting this to GLK only?

From discussion, looks like issue is specific to GLK platform. HW team is debugging this issue.

Quoted 55 lines
Quoted 4 lines

2. glk_calc_cdclk returns 79200 KHZ for this pixclk. For 2PPC it will be 158400 KHZ 3. Practically 100% of the cdclk can’t be achieved, so 99% of

158400 KHZ = 156816 which is less than the desired pixlclk.

Quoted 31 lines

This causes the corruption.

So why do we need to mention a particular panel??

Quoted 27 lines
Quoted 6 lines

Ander

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

With that fixed,

Reviewed-by: Ander Conselvan de Oliveira
<[email protected]>

drivers/gpu/drm/i915/intel_cdclk.c static int bxt_calc_cdclk(int · line 1080

Quoted 2 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -0
+	 * intel_compute_max_dotclk() limits the max pixel
+clock to 99% of

max

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -0
+	 * cdclk.)
+	 */
+	if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
 		return 316800;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
-	else if (max_pixclk > 2 * 79200)
+	else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99,
+100))
 		return 158400;
 	else
 		return 79200;
@@ -1664,7 +1670,11 @@ static int

intel_compute_max_dotclk(struct

drm_i915_private *dev_priv)

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +2 -1
 	int max_cdclk_freq = dev_priv->max_cdclk_freq;
 
 	if (IS_GEMINILAKE(dev_priv))
-		return 2 * max_cdclk_freq;
+		/*
+		 * FIXME: Limiting to 99% as a temporary

workaround. See

Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_cdclk.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_cdclk.c +3 -0
+		 * glk_calc_cdclk() for details.
+		 */
+		return 2 * max_cdclk_freq * 99 / 100;
 	else if (INTEL_INFO(dev_priv)->gen >= 9 ||
 		 IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return max_cdclk_freq;

--
Jani Nikula, Intel Open Source Technology Center

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

--
Ville Syrjälä
Intel OTC

--
Ville Syrjälä
Intel OTC

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

#12 lore raw

✓ Fi.CI.BAT: success for drm/i915/glk: limit pixel clock to 99% of cdclk workaround

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/i915/glk: limit pixel clock to 99% of cdclk workaround
URL : https://patchwork.freedesktop.org/series/22404/
State : success

== Summary ==

Series 22404v1 drm/i915/glk: limit pixel clock to 99% of cdclk workaround
https://patchwork.freedesktop.org/api/1.0/series/22404/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                pass       -> DMESG-WARN (fi-bsw-n3050) fdo#100113
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> INCOMPLETE (fi-byt-n2820) fdo#99740

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100113 https://bugs.freedesktop.org/show_bug.cgi?id=100113
fdo#99740 https://bugs.freedesktop.org/show_bug.cgi?id=99740

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 431s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 426s
fi-bsw-n3050     total:278  pass:238  dwarn:1   dfail:0   fail:0   skip:39  time: 566s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 509s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 560s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 486s
fi-byt-n2820     total:241  pass:210  dwarn:0   dfail:0   fail:0   skip:30  time: 0s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 407s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 406s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 429s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 482s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 489s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 455s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 563s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 453s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 579s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 466s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 498s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 430s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 531s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 401s

5bc82ec7f62322a91ecf48fa966e68c876637fcd drm-tip: 2017y-04m-03d-16h-44m-48s UTC integration manifest 21890ca drm/i915/glk: limit pixel clock to 99% of cdclk workaround

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4387/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx