Skip to contentSkip to conversation

drm/i915/dp: Guarantee a minimum HBlank time

PATCH Superseded Arun R Murthy 3 participants 4 messages Sep 30, 2024

Subsystems (3)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/dp: Guarantee a minimum HBlank time

Mandate a minimum Hblank symbol cycle count between BS and BE in 8b/10b MST and 12b/132b mode.
Spec: DP2.1a

---
 drivers/gpu/drm/i915/display/intel_display.c       | 6 ++++++
 drivers/gpu/drm/i915/display/intel_display_types.h | 1 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c        | 9 +++++++++
 drivers/gpu/drm/i915/i915_reg.h                    | 3 +++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +6 -0
index 78ce402a5cd0..027ab45d4d38 100644
@@ -2095,6 +2095,7 @@ void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 static void i9xx_configure_cpu_transcoder(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
@@ -2102,6 +2103,11 @@ static void i9xx_configure_cpu_transcoder(const struct intel_crtc_state *crtc_st
 					       &crtc_state->dp_m_n);
 		intel_cpu_transcoder_set_m2_n2(crtc, cpu_transcoder,
 					       &crtc_state->dp_m2_n2);
+
+		if (DISPLAY_VER(i915) >= 20 && crtc_state->dp_m_n.min_hblank)
+			intel_de_write(i915,
+				       DP_MIN_HBLANK_CTL(i915, cpu_transcoder),
+				       crtc_state->dp_m_n.min_hblank);
 	}
 
 	intel_set_transcoder_timings(crtc_state);
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index fa03157554b2..8d18545a369f 100644
@@ -1028,6 +1028,7 @@ struct intel_link_m_n {
 	u32 data_n;
 	u32 link_m;
 	u32 link_n;
+	u32 min_hblank;
 };
 
 struct intel_csc_matrix {
drivers/gpu/drm/i915/display/intel_dp_mst.c +9 -0
index 15541932b809..c8f045142881 100644
@@ -130,6 +130,8 @@ static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	u8 symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
+	u32 hblank;
 
 	/* TODO: Check WA 14013163432 to set data M/N for full BW utilization. */
 	intel_link_compute_m_n(bpp_x16, crtc_state->lane_count,
@@ -139,6 +141,13 @@ static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
 			       m_n);
 
 	m_n->tu = DIV_ROUND_UP_ULL(mul_u32_u32(m_n->data_m, 64), m_n->data_n);
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST & 128b/132b */
+	hblank = DIV_ROUND_UP((DIV_ROUND_UP(adjusted_mode->htotal - adjusted_mode->hdisplay, 4) * bpp_x16), symbol_size);
+	if (intel_dp_is_uhbr(crtc_state))
+		m_n->min_hblank = hblank > 5 ? hblank : 5;
+	else
+		m_n->min_hblank = hblank > 3 ? hblank : 3;
 }
 
 static int intel_dp_mst_calc_pbn(int pixel_clock, int bpp_x16, int bw_overhead)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 41f4350a7c6c..65133efe728c 100644
@@ -1109,6 +1109,7 @@
 #define _BCLRPAT_A		0x60020
 #define _TRANS_VSYNCSHIFT_A	0x60028
 #define _TRANS_MULT_A		0x6002c
+#define _DP_MIN_HBLANK_CTL_A	0x600ac
 
 /* Pipe/transcoder B timing regs */
 #define _TRANS_HTOTAL_B		0x61000
@@ -1121,6 +1122,7 @@
 #define _BCLRPAT_B		0x61020
 #define _TRANS_VSYNCSHIFT_B	0x61028
 #define _TRANS_MULT_B		0x6102c
+#define _DP_MIN_HBLANK_CTL_B	0x610ac
 
 /* DSI 0 timing regs */
 #define _TRANS_HTOTAL_DSI0	0x6b000
@@ -1146,6 +1148,7 @@
 #define TRANS_VSYNCSHIFT(dev_priv, trans)	_MMIO_TRANS2(dev_priv, (trans), _TRANS_VSYNCSHIFT_A)
 #define PIPESRC(dev_priv, pipe)		_MMIO_TRANS2(dev_priv, (pipe), _PIPEASRC)
 #define TRANS_MULT(dev_priv, trans)	_MMIO_TRANS2(dev_priv, (trans), _TRANS_MULT_A)
+#define DP_MIN_HBLANK_CTL(dev_priv, trans)	_MMIO_TRANS2(dev_priv, (trans), _DP_MIN_HBLANK_CTL_A)
 
 /* VGA port control */
 #define ADPA			_MMIO(0x61100)
Signature · 1 line
2.25.1
#1 lore raw

✗ Fi.CI.BUILD: failure for drm/i915/dp: Guarantee a minimum HBlank time

== Series Details ==

== Series Details ==

Series: drm/i915/dp: Guarantee a minimum HBlank time
URL : https://patchwork.freedesktop.org/series/139267/
State : failure

== Summary ==

Error: patch https://patchwork.freedesktop.org/api/1.0/series/139267/revisions/1/mbox/ not applied
Applying: drm/i915/dp: Guarantee a minimum HBlank time
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_display.c
M drivers/gpu/drm/i915/display/intel_display_types.h
M drivers/gpu/drm/i915/display/intel_dp_mst.c
M drivers/gpu/drm/i915/i915_reg.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_reg.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_reg.h
Auto-merging drivers/gpu/drm/i915/display/intel_dp_mst.c
Auto-merging drivers/gpu/drm/i915/display/intel_display_types.h
Auto-merging drivers/gpu/drm/i915/display/intel_display.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915/dp: Guarantee a minimum HBlank time
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced

#2 lore raw

✗ CI.Patch_applied: failure for drm/i915/dp: Guarantee a minimum HBlank time

In reply to Arun R Murthy
== Series Details ==

== Series Details ==

Series: drm/i915/dp: Guarantee a minimum HBlank time
URL : https://patchwork.freedesktop.org/series/139268/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 1accf1380ac2 drm-tip: 2024y-09m-30d-04h-27m-01s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/i915/i915_reg.h:1109
error: drivers/gpu/drm/i915/i915_reg.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/i915/dp: Guarantee a minimum HBlank time
Patch failed at 0001 drm/i915/dp: Guarantee a minimum HBlank time
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

maintainer
#3 lore raw
In reply to Arun R Murthy
Quoted 3 lines · Arun R Murthy

Mandate a minimum Hblank symbol cycle count between BS and BE in 8b/10b MST and 12b/132b mode.
Spec: DP2.1a

Why send patches on top of a baseline that's 20 days old? Please rebase and build before sending. Always.

Quoted 13 lines
---
 drivers/gpu/drm/i915/display/intel_display.c       | 6 ++++++
 drivers/gpu/drm/i915/display/intel_display_types.h | 1 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c        | 9 +++++++++
 drivers/gpu/drm/i915/i915_reg.h                    | 3 +++
 4 files changed, 19 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index 78ce402a5cd0..027ab45d4d38 100644

drivers/gpu/drm/i915/display/intel_display.c void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc, · line 2098

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
@@ -2095,6 +2095,7 @@ void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc,
 static void i9xx_configure_cpu_transcoder(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	struct drm_i915_private *i915 = to_i915(crtc->base.dev);

struct intel_display.

drivers/gpu/drm/i915/display/intel_display.c static void i9xx_configure_cpu_transcoder(const struct intel_crtc_state *crtc_st · line 2110

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_display.c +5 -0
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
@@ -2102,6 +2103,11 @@ static void i9xx_configure_cpu_transcoder(const struct intel_crtc_state *crtc_st
 					       &crtc_state->dp_m_n);
 		intel_cpu_transcoder_set_m2_n2(crtc, cpu_transcoder,
 					       &crtc_state->dp_m2_n2);
+
+		if (DISPLAY_VER(i915) >= 20 && crtc_state->dp_m_n.min_hblank)
+			intel_de_write(i915,
+				       DP_MIN_HBLANK_CTL(i915, cpu_transcoder),
+				       crtc_state->dp_m_n.min_hblank);

Doesn't feel right programming this here. Doesn't feel right having DP checks here.

Where is this cleared?

The state readout and verification is missing.

drivers/gpu/drm/i915/display/intel_display_types.h struct intel_link_m_n { · line 1031

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 	}
 
 	intel_set_transcoder_timings(crtc_state);
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index fa03157554b2..8d18545a369f 100644
@@ -1028,6 +1028,7 @@ struct intel_link_m_n {
 	u32 data_n;
 	u32 link_m;
 	u32 link_n;
+	u32 min_hblank;

Doesn't feel right adding this here, not much to do with M/N.

drivers/gpu/drm/i915/display/intel_dp_mst.c static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state, · line 133

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
 };
 
 struct intel_csc_matrix {
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -0
index 15541932b809..c8f045142881 100644
@@ -130,6 +130,8 @@ static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
+	u8 symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;

Just use int.

Quoted 46 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +8 -0
+	u32 hblank;
 
 	/* TODO: Check WA 14013163432 to set data M/N for full BW utilization. */
 	intel_link_compute_m_n(bpp_x16, crtc_state->lane_count,
@@ -139,6 +141,13 @@ static void intel_dp_mst_compute_m_n(const struct intel_crtc_state *crtc_state,
 			       m_n);
 
 	m_n->tu = DIV_ROUND_UP_ULL(mul_u32_u32(m_n->data_m, 64), m_n->data_n);
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST & 128b/132b */
+	hblank = DIV_ROUND_UP((DIV_ROUND_UP(adjusted_mode->htotal - adjusted_mode->hdisplay, 4) * bpp_x16), symbol_size);
+	if (intel_dp_is_uhbr(crtc_state))
+		m_n->min_hblank = hblank > 5 ? hblank : 5;
+	else
+		m_n->min_hblank = hblank > 3 ? hblank : 3;
 }
 
 static int intel_dp_mst_calc_pbn(int pixel_clock, int bpp_x16, int bw_overhead)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 41f4350a7c6c..65133efe728c 100644
@@ -1109,6 +1109,7 @@
 #define _BCLRPAT_A		0x60020
 #define _TRANS_VSYNCSHIFT_A	0x60028
 #define _TRANS_MULT_A		0x6002c
+#define _DP_MIN_HBLANK_CTL_A	0x600ac
 
 /* Pipe/transcoder B timing regs */
 #define _TRANS_HTOTAL_B		0x61000
@@ -1121,6 +1122,7 @@
 #define _BCLRPAT_B		0x61020
 #define _TRANS_VSYNCSHIFT_B	0x61028
 #define _TRANS_MULT_B		0x6102c
+#define _DP_MIN_HBLANK_CTL_B	0x610ac
 
 /* DSI 0 timing regs */
 #define _TRANS_HTOTAL_DSI0	0x6b000
@@ -1146,6 +1148,7 @@
 #define TRANS_VSYNCSHIFT(dev_priv, trans)	_MMIO_TRANS2(dev_priv, (trans), _TRANS_VSYNCSHIFT_A)
 #define PIPESRC(dev_priv, pipe)		_MMIO_TRANS2(dev_priv, (pipe), _PIPEASRC)
 #define TRANS_MULT(dev_priv, trans)	_MMIO_TRANS2(dev_priv, (trans), _TRANS_MULT_A)
+#define DP_MIN_HBLANK_CTL(dev_priv, trans)	_MMIO_TRANS2(dev_priv, (trans), _DP_MIN_HBLANK_CTL_A)
 
 /* VGA port control */
 #define ADPA			_MMIO(0x61100)
Signature · 1 line
Jani Nikula, Intel