Skip to contentSkip to conversation

drm/i915: Clamp linetime wm to <64usec

PATCH In review Ville Syrjala 3 participants 11 messages Jun 25, 2020 – Jun 29, 2020

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

PATCH 1/1 drm/i915: Clamp linetime wm to <64usec

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +12 -6
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 6 lines
2.26.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 30 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

Stan

Quoted 42 lines
drivers/gpu/drm/i915/display/intel_display.c +7 -4
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2

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

#2 lore raw
Quoted 35 lines · Stanislav
Quoted 34 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Quoted 44 lines

Stan

Quoted 42 lines
drivers/gpu/drm/i915/display/intel_display.c +7 -4
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Hi,

Quoted 59 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjälä
Sent: perjantai 26. kesäkuuta 2020 16.47
To: Lisovskiy, Stanislav <[email protected]>
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Clamp linetime wm to <64usec

Quoted 33 lines · Stanislav
Quoted 32 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18
++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct
 intel_crtc_state *crtc_state)  {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 *

8,

Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12589

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				 adjusted_mode-

crtc_clock);

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12589

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal *

1000 * 8,

Quoted 1 line

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12590

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+
	adjusted_mode->crtc_clock);
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12592

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value
543 in the bug because pixel rate is 14874 which doesn't seem correct.

Quoted 4 lines

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible

No, there is no gtilab issue as no tiled display at CI.

Quoted 49 lines

to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Quoted 11 lines

Stan

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state

*crtc_state, @@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state, {

drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 *

8,

Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				 cdclk_state-

logical.cdclk);

drivers/gpu/drm/i915/display/intel_display.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal *

1000 * 8,

Quoted 1 line
Quoted 1 line

+

	cdclk_state->logical.cdclk);
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state

*crtc_state) @@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const

struct intel_crtc_state *crtc_state)

Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 skl_linetime_wm(const struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static int hsw_compute_linetime_wm(struct intel_atomic_state

*state,
--
2.26.2

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

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

#4 lore raw
Quoted 61 lines · Jani

Hi,

Quoted 59 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjälä
Sent: perjantai 26. kesäkuuta 2020 16.47
To: Lisovskiy, Stanislav <[email protected]>
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Clamp linetime wm to <64usec

Quoted 33 lines · Stanislav
Quoted 32 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18
++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct
 intel_crtc_state *crtc_state)  {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 *

8,

Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12589

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				 adjusted_mode-

crtc_clock);

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12589

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal *

1000 * 8,

Quoted 1 line

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12590

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+
	adjusted_mode->crtc_clock);
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct · line 12592

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value
543 in the bug because pixel rate is 14874 which doesn't seem correct.

Quoted 5 lines
Quoted 4 lines

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible

No, there is no gtilab issue as no tiled display at CI.

Can't see what this has to do with tiled displays. I guess we're talking about some specific display that just happens to have that super slow mode?

Quoted 63 lines
Quoted 63 lines

to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Quoted 11 lines

Stan

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state

*crtc_state, @@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state, {

drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 *

8,

Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				 cdclk_state-

logical.cdclk);

drivers/gpu/drm/i915/display/intel_display.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal *

1000 * 8,

Quoted 1 line
Quoted 1 line

+

	cdclk_state->logical.cdclk);
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state

*crtc_state) @@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const

struct intel_crtc_state *crtc_state)

Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 skl_linetime_wm(const struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static int hsw_compute_linetime_wm(struct intel_atomic_state

*state,
--
2.26.2

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

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

Hi,

Quoted 75 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: perjantai 26. kesäkuuta 2020 17.09
To: Saarinen, Jani <[email protected]>
Cc: Lisovskiy, Stanislav <[email protected]>; intel- [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Clamp linetime wm to <64usec

Quoted 66 lines · Jani

Hi,

Quoted 64 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjälä
Sent: perjantai 26. kesäkuuta 2020 16.47
To: Lisovskiy, Stanislav <[email protected]>
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Clamp linetime wm to <64usec

Quoted 33 lines · Stanislav
Quoted 32 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18
++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const
 struct intel_crtc_state *crtc_state)  {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 *

8,

Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const · line 12589

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				 adjusted_mode-

crtc_clock);

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const · line 12589

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal *

1000 * 8,

Quoted 1 line

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const · line 12590

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+
	adjusted_mode->crtc_clock);
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const · line 12592

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value
543 in the bug because pixel rate is 14874 which doesn't seem correct.

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible

No, there is no gtilab issue as no tiled display at CI.

Can't see what this has to do with tiled displays. I guess we're talking about some specific display that just happens to have that super slow mode?

Perhaps, issue where seen in Dell UP2715K.

Quoted 66 lines
Quoted 52 lines
Quoted 52 lines

to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Quoted 11 lines

Stan

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state

*crtc_state, @@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state, {

drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
Quoted 4 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 *

8,

Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				 cdclk_state-

logical.cdclk);

drivers/gpu/drm/i915/display/intel_display.c

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal *

1000 * 8,

Quoted 1 line
Quoted 1 line

+

	cdclk_state->logical.cdclk);
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state

*crtc_state) @@ -12608,7 +12614,7 @@ static u16
skl_linetime_wm(const

struct intel_crtc_state *crtc_state)

Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 skl_linetime_wm(const struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static int hsw_compute_linetime_wm(struct intel_atomic_state

*state,
--
2.26.2

Quoted 7 lines

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

Quoted 3 lines

--
Ville Syrjälä
Intel

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

#6 lore raw
In reply to Ville Syrjälä
Quoted 46 lines · Ville Syrjälä
Quoted 35 lines · Stanislav
Quoted 34 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

Quoted 6 lines

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Htotal from modeline "848x480": 30 14874 848 896 928 1008 480 483 488 494 0x40 0x9 is 1008.

According to the formula above htotal(1008)*1000*8 / 14874(crtc_clock) = 542.154

So what's the catch? :)

Stan

Quoted 37 lines
Quoted 37 lines

Stan

Quoted 34 lines
drivers/gpu/drm/i915/display/intel_display.c +6 -3
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2
Signature · 2 lines
Ville Syrjälä
Intel

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

#7 lore raw
Quoted 54 lines · Stanislav
Quoted 46 lines · Ville Syrjälä
Quoted 35 lines · Stanislav
Quoted 34 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

Quoted 6 lines

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Quoted 6 lines

Htotal from modeline "848x480": 30 14874 848 896 928 1008 480 483 488 494 0x40 0x9 is 1008.

According to the formula above htotal(1008)*1000*8 / 14874(crtc_clock) = 542.154

So what's the catch? :)

What catch? Looks totally consistent to me.

Quoted 51 lines

Stan

Quoted 49 lines
Quoted 45 lines

Stan

Quoted 42 lines
drivers/gpu/drm/i915/display/intel_display.c +7 -4
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 55 lines · Ville Syrjälä
Quoted 54 lines · Stanislav
Quoted 52 lines · Ville Syrjälä
Quoted 35 lines · Stanislav
Quoted 34 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Quoted 8 lines
Quoted 6 lines

Htotal from modeline "848x480": 30 14874 848 896 928 1008 480 483 488 494 0x40 0x9 is 1008.

According to the formula above htotal(1008)*1000*8 / 14874(crtc_clock) = 542.154

So what's the catch? :)

What catch? Looks totally consistent to me.

I meant as I understood from your comment we were supposed to get 68 usec linetime, not 542.

Quoted 44 lines
Quoted 44 lines

Stan

Quoted 41 lines
Quoted 41 lines

Stan

Quoted 38 lines
drivers/gpu/drm/i915/display/intel_display.c +7 -4
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 2 lines
Ville Syrjälä
Intel

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

#9 lore raw
Quoted 59 lines · Stanislav
Quoted 58 lines · Ville Syrjälä
Quoted 57 lines · Stanislav
Quoted 46 lines · Ville Syrjälä
Quoted 35 lines · Stanislav
Quoted 34 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

Quoted 6 lines

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Htotal from modeline "848x480": 30 14874 848 896 928 1008 480 483 488 494 0x40 0x9 is 1008.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

According to the formula above htotal(1008)*1000*8 / 14874(crtc_clock) = 542.154

So what's the catch? :)

What catch? Looks totally consistent to me.

I meant as I understood from your comment we were supposed to get 68 usec linetime, not 542.

It's in units of .125 usec, or put another way .3 binary fixed point.

Quoted 59 lines
Quoted 56 lines
Quoted 52 lines

Stan

Quoted 49 lines
Quoted 45 lines

Stan

Quoted 42 lines
drivers/gpu/drm/i915/display/intel_display.c +7 -4
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
Quoted 62 lines · Ville Syrjälä
Quoted 61 lines · Stanislav
Quoted 60 lines · Ville Syrjälä
Quoted 59 lines · Stanislav
Quoted 46 lines · Ville Syrjälä
Quoted 35 lines · Stanislav
Quoted 34 lines · Ville Syrjala

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

The linetime watermark is a 9 bit value, which gives us a maximum linetime of just below 64 usec. If the linetime exceeds that value we currently just discard the high bits and program the rest into the register, which angers the state checker.

To avoid that let's just clamp the value to the max. I believe it should be perfectly fine to program a smaller linetime wm than strictly required, just means the hardware may fetch data sooner than strictly needed. We are further reassured by the fact that with DRRS the spec tells us to program the smaller of the two linetimes corresponding to the two refresh rates.

Cc Stanislav Lisovskiy <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
index a11bb675f9b3..d486d675166f 100644
@@ -12581,12 +12581,15 @@ static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_display.c static u16 hsw_linetime_wm(const struct intel_crtc_state *crtc_state) · line 12592

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -2
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 adjusted_mode->crtc_clock);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					adjusted_mode->crtc_clock);
+
+	return min(linetime_wm, 0x1ff);

Are we actually doing the right thing here? I just mean that we get value 543 in the bug because pixel rate is 14874 which doesn't seem correct.

Quoted 6 lines

As explained in the commit msg programming this to lower than necessary value should be totally fine. It just won't be optimal.

The values in the jira (was there an actual gitlab bug for this btw?) look quite sensible to me. Some kind of low res 848xsomething mode with dotclock of 14.874 Mhz, which gives us that linetime of ~68 usec.

Htotal from modeline "848x480": 30 14874 848 896 928 1008 480 483 488 494 0x40 0x9 is 1008.

According to the formula above htotal(1008)*1000*8 / 14874(crtc_clock) = 542.154

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

So what's the catch? :)

What catch? Looks totally consistent to me.

I meant as I understood from your comment we were supposed to get 68 usec linetime, not 542.

It's in units of .125 usec, or put another way .3 binary fixed point.

Yep, found this in BSpec already for WM_LINETIME reg.

Quoted 57 lines
Quoted 57 lines
Quoted 53 lines
Quoted 52 lines

Stan

Quoted 49 lines
Quoted 45 lines

Stan

Quoted 42 lines
drivers/gpu/drm/i915/display/intel_display.c +7 -4
 }
 
 static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
@@ -12594,12 +12597,15 @@ static u16 hsw_ips_linetime_wm(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
 
-	return DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
-				 cdclk_state->logical.cdclk);
+	linetime_wm = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
+					cdclk_state->logical.cdclk);
+
+	return min(linetime_wm, 0x1ff);
 }
 
 static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
@@ -12608,7 +12614,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
-	u16 linetime_wm;
+	int linetime_wm;
 
 	if (!crtc_state->hw.enable)
 		return 0;
@@ -12620,7 +12626,7 @@ static u16 skl_linetime_wm(const struct intel_crtc_state *crtc_state)
 	if (IS_GEN9_LP(dev_priv) && dev_priv->ipc_enabled)
 		linetime_wm /= 2;
 
-	return linetime_wm;
+	return min(linetime_wm, 0x1ff);
 }
 
 static int hsw_compute_linetime_wm(struct intel_atomic_state *state,
Signature · 1 line
2.26.2
Signature · 2 lines
Ville Syrjälä
Intel
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 2 lines
Ville Syrjälä
Intel

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