Skip to contentSkip to conversation

Rework/Correction on minimum hblank calculation

PATCH Superseded Arun R Murthy 5 participants 15 messages Apr 17, 2025 – Apr 22, 2025

Subsystems (4)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover Rework/Correction on minimum hblank calculation

---
Changes in v3:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Arun R Murthy (3):
drm/display/dp: Export fn to calculate link symbol cycles drm/i915/display: export function to count dsc slices drm/i915/display: move min_hblank from dp_mst.c to dp.c

 drivers/gpu/drm/display/drm_dp_helper.c      | 53 ++++++++++++-----------
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++
 drivers/gpu/drm/i915/display/intel_dp.c      | 64 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.h      |  4 ++
 drivers/gpu/drm/i915/display/intel_dp_mst.c  | 56 ++----------------------
 drivers/gpu/drm/i915/display/intel_dp_mst.h  |  3 ++
 include/drm/display/drm_dp_helper.h          |  2 +
 7 files changed, 122 insertions(+), 78 deletions(-)

---
base-commit: c4fc93b0ec49f4b0105c142502b7d1d5de379950
change-id: 20250407-hblank-49b340aeba31

Best regards,

Signature · 1 line
Arun R Murthy <[email protected]>
#1 lore raw

PATCH v3 1/3 drm/display/dp: Export fn to calculate link symbol cycles

Unify the function to calculate the link symbol cycles for both dsc and non-dsc case and export the function so that it can be used in the respective platform display drivers for other calculations.

v2: unify the fn for both dsc and non-dsc case (Imre)
v3: rename drm_dp_link_symbol_cycles to drm_dp_link_data_symbol_cycles
retain slice_eoc_cycles as is (Imre)

---
 drivers/gpu/drm/display/drm_dp_helper.c | 53 +++++++++++++++++----------------
 include/drm/display/drm_dp_helper.h     |  2 ++
 2 files changed, 29 insertions(+), 26 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +27 -26
index 57828f2b7b5a0582ca4a6f2a9be2d5909fe8ad24..5ce8ccc3310fb71b39ea5f74c4022474c180f727 100644
@@ -4392,26 +4392,33 @@ EXPORT_SYMBOL(drm_panel_dp_aux_backlight);
 
 #endif
 
-/* See DP Standard v2.1 2.6.4.4.1.1, 2.8.4.4, 2.8.7 */
-static int drm_dp_link_symbol_cycles(int lane_count, int pixels, int bpp_x16,
-				     int symbol_size, bool is_mst)
-{
-	int cycles = DIV_ROUND_UP(pixels * bpp_x16, 16 * symbol_size * lane_count);
-	int align = is_mst ? 4 / lane_count : 1;
-
-	return ALIGN(cycles, align);
-}
-
-static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int slice_count,
-					 int bpp_x16, int symbol_size, bool is_mst)
-{
-	int slice_pixels = DIV_ROUND_UP(pixels, slice_count);
-	int slice_data_cycles = drm_dp_link_symbol_cycles(lane_count, slice_pixels,
-							  bpp_x16, symbol_size, is_mst);
+/**
+ * drm_dp_link_data_symbol_cycles - calculate the link symbol count
+ * @lane_coount: DP link lane count
+ * @pixels: horizontal active pixels
+ * @bpp_x16: bits per pixel in .4 binary fixed format
+ * @symbol_size: DP symbol size
+ * @is_mst: is mst or sst
+ * @slice_count: number of slices
+ *
+ * Calculate the link symbol cycles for both dsc and non dsc case and
+ * return the count.
+ */
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count)
+{
+	int slice_pixels = slice_count ? DIV_ROUND_UP(pixels, slice_count) :
+					 pixels;
+	int cycles = DIV_ROUND_UP(slice_pixels * bpp_x16,
+				  (6 * symbol_size * lane_count));
+	int slice_data_cycles = ALIGN(cycles, is_mst ? (4 / lane_count) : 1);
 	int slice_eoc_cycles = is_mst ? 4 / lane_count : 1;
 
-	return slice_count * (slice_data_cycles + slice_eoc_cycles);
+	return slice_count ? (slice_count *
+			      (slice_data_cycles + slice_eoc_cycles)) :
+			      slice_data_cycles;
 }
+EXPORT_SYMBOL(drm_dp_link_data_symbol_cycles);
 
 /**
  * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream
@@ -4486,15 +4493,9 @@ int drm_dp_bw_overhead(int lane_count, int hactive,
 	WARN_ON((flags & DRM_DP_BW_OVERHEAD_UHBR) &&
 		(flags & DRM_DP_BW_OVERHEAD_FEC));
 
-	if (flags & DRM_DP_BW_OVERHEAD_DSC)
-		symbol_cycles = drm_dp_link_dsc_symbol_cycles(lane_count, hactive,
-							      dsc_slice_count,
-							      bpp_x16, symbol_size,
-							      is_mst);
-	else
-		symbol_cycles = drm_dp_link_symbol_cycles(lane_count, hactive,
-							  bpp_x16, symbol_size,
-							  is_mst);
+	symbol_cycles = drm_dp_link_data_symbol_cycles(lane_count, hactive,
+						       bpp_x16, symbol_size,
+						       is_mst, dsc_slice_count);
 
 	return DIV_ROUND_UP_ULL(mul_u32_u32(symbol_cycles * symbol_size * lane_count,
 					    overhead * 16),
include/drm/display/drm_dp_helper.h +2 -0
index d9614e2c89397536f44bb7258e894628ae1dccc9..98bbbe98e5bc0ce0f9cdf513b2c5ea90bb5caffb 100644
@@ -971,5 +971,7 @@ int drm_dp_bw_channel_coding_efficiency(bool is_uhbr);
 int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes);
 
 ssize_t drm_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc, struct dp_sdp *sdp);
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count);
 
 #endif /* _DRM_DP_HELPER_H_ */
Signature · 1 line
2.25.1
#2 lore raw

RE: [PATCH v3 1/3] drm/display/dp: Export fn to calculate link symbol cycles

Quoted 53 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Arun R Murthy
Sent: Thursday, April 17, 2025 4:22 PM
To: [email protected]; [email protected]; intel- [email protected]
Cc: Govindapillai, Vinod <[email protected]>; Deak, Imre <[email protected]>; Murthy, Arun R <[email protected]>
Subject: [PATCH v3 1/3] drm/display/dp: Export fn to calculate link symbol cycles

Unify the function to calculate the link symbol cycles for both dsc and non-dsc case and export the function so that it can be used in the respective platform display drivers for other calculations.

v2: unify the fn for both dsc and non-dsc case (Imre)
v3: rename drm_dp_link_symbol_cycles to drm_dp_link_data_symbol_cycles
retain slice_eoc_cycles as is (Imre)

---
 drivers/gpu/drm/display/drm_dp_helper.c | 53 +++++++++++++++++--------------
--
 include/drm/display/drm_dp_helper.h     |  2 ++
 2 files changed, 29 insertions(+), 26 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +0 -0

index 57828f2b7b5a0582ca4a6f2a9be2d5909fe8ad24..5ce8ccc3310fb71b39ea5f74c4 022474c180f727 100644

drivers/gpu/drm/display/drm_dp_helper.c +0 -11
@@ -4392,26 +4392,33 @@ EXPORT_SYMBOL(drm_panel_dp_aux_backlight);
 
 #endif
 
-/* See DP Standard v2.1 2.6.4.4.1.1, 2.8.4.4, 2.8.7 */ -static int
 drm_dp_link_symbol_cycles(int lane_count, int pixels, int bpp_x16,
-				     int symbol_size, bool is_mst)
-{
-	int cycles = DIV_ROUND_UP(pixels * bpp_x16, 16 * symbol_size *
 lane_count);
-	int align = is_mst ? 4 / lane_count : 1;
-
-	return ALIGN(cycles, align);
-}
-
-static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int
 slice_count,
-					 int bpp_x16, int symbol_size, bool

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4403

Quoted 10 lines
drivers/gpu/drm/display/drm_dp_helper.c +3 -4
 is_mst)
-{
-	int slice_pixels = DIV_ROUND_UP(pixels, slice_count);
-	int slice_data_cycles = drm_dp_link_symbol_cycles(lane_count,
 slice_pixels,
-							  bpp_x16,
 symbol_size, is_mst);
+/**
+ * drm_dp_link_data_symbol_cycles - calculate the link symbol count
+ * @lane_coount: DP link lane count

Typo "lane_count"

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4405

Quoted 8 lines
drivers/gpu/drm/display/drm_dp_helper.c +8 -0
+ * @pixels: horizontal active pixels
+ * @bpp_x16: bits per pixel in .4 binary fixed format
+ * @symbol_size: DP symbol size
+ * @is_mst: is mst or sst
+ * @slice_count: number of slices
+ *
+ * Calculate the link symbol cycles for both dsc and non dsc case and
+ * return the count.

Lets add the DP spec to be referred seems like it was missed

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4413

Quoted 8 lines
drivers/gpu/drm/display/drm_dp_helper.c +7 -0
+ */
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count)
 {
+	int slice_pixels = slice_count ? DIV_ROUND_UP(pixels, slice_count) :
+					 pixels;
+	int cycles = DIV_ROUND_UP(slice_pixels * bpp_x16,
+				  (6 * symbol_size * lane_count));

Shouldn't this be 16
Also one thing I see which was there previously to while calculating is we ignore the two ceils Inside the function and merge it into a single div_round_up which may bring as slight variation in calculation For example for non dsc case
Spec says
HACT_LL_SYM_CYC_CNT
= CEIL(CEIL(HACT_WIDTH / 4) × PIX_BPP / SYMBOL_SIZE)
HACT_ML_SYM_CYC_CNT
= HACT_LL_SYM_CYC_CNT × 4 / PHY_LANE_CNT

But we do
DIV_ROUND_UP(slice_pixels * bpp_x16, (6 * symbol_size * lane_count));

Which translates to
CEIL( (HACT_WIDTH* BPP*4)/(16 *SYMBOL_SIZE *LANECOUNT))

Which does not seem to match the calculation exactly as what was said in the spec Lets have an intermediate ll_symbol_cycle variable too should make the calculations More clearer and precise according to me.

Also for dsc case lets have chunk size instead of reusing slice pixels.

Regards,
Suraj Kandpal

Quoted 56 lines
drivers/gpu/drm/display/drm_dp_helper.c +5 -4
+	int slice_data_cycles = ALIGN(cycles, is_mst ? (4 / lane_count) : 1);
 	int slice_eoc_cycles = is_mst ? 4 / lane_count : 1;
 
-	return slice_count * (slice_data_cycles + slice_eoc_cycles);
+	return slice_count ? (slice_count *
+			      (slice_data_cycles + slice_eoc_cycles)) :
+			      slice_data_cycles;
 }
+EXPORT_SYMBOL(drm_dp_link_data_symbol_cycles);
 
 /**
  * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream @@
-4486,15 +4493,9 @@ int drm_dp_bw_overhead(int lane_count, int hactive,
 	WARN_ON((flags & DRM_DP_BW_OVERHEAD_UHBR) &&
 		(flags & DRM_DP_BW_OVERHEAD_FEC));
 
-	if (flags & DRM_DP_BW_OVERHEAD_DSC)
-		symbol_cycles = drm_dp_link_dsc_symbol_cycles(lane_count,

hactive,

drivers/gpu/drm/display/drm_dp_helper.c +0 -2
-							      dsc_slice_count,
-							      bpp_x16,

symbol_size,

drivers/gpu/drm/display/drm_dp_helper.c +0 -3
-							      is_mst);
-	else
-		symbol_cycles = drm_dp_link_symbol_cycles(lane_count,

hactive,

drivers/gpu/drm/display/drm_dp_helper.c +0 -1
-							  bpp_x16,

symbol_size,

drivers/gpu/drm/display/drm_dp_helper.c +1 -1
-							  is_mst);
+	symbol_cycles = drm_dp_link_data_symbol_cycles(lane_count,

hactive,

drivers/gpu/drm/display/drm_dp_helper.c +2 -0
+						       bpp_x16, symbol_size,
+						       is_mst, dsc_slice_count);
 
 	return DIV_ROUND_UP_ULL(mul_u32_u32(symbol_cycles *

symbol_size * lane_count,

drivers/gpu/drm/display/drm_dp_helper.c +0 -0
 					    overhead * 16),
include/drm/display/drm_dp_helper.h +0 -0

index d9614e2c89397536f44bb7258e894628ae1dccc9..98bbbe98e5bc0ce0f9cdf513b 2c5ea90bb5caffb 100644

include/drm/display/drm_dp_helper.h +2 -0
@@ -971,5 +971,7 @@ int drm_dp_bw_channel_coding_efficiency(bool
 is_uhbr);  int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes);
 
 ssize_t drm_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc, struct
 dp_sdp *sdp);
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count);
 

#endif /* _DRM_DP_HELPER_H_ */

--
2.25.1

#3 lore raw

Re: [PATCH v3 1/3] drm/display/dp: Export fn to calculate link symbol cycles

Quoted 96 lines · Suraj
Quoted 53 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Arun R Murthy
Sent: Thursday, April 17, 2025 4:22 PM
To: [email protected]; [email protected]; intel- [email protected]
Cc: Govindapillai, Vinod <[email protected]>; Deak, Imre <[email protected]>; Murthy, Arun R <[email protected]>
Subject: [PATCH v3 1/3] drm/display/dp: Export fn to calculate link symbol cycles

Unify the function to calculate the link symbol cycles for both dsc and non-dsc case and export the function so that it can be used in the respective platform display drivers for other calculations.

v2: unify the fn for both dsc and non-dsc case (Imre)
v3: rename drm_dp_link_symbol_cycles to drm_dp_link_data_symbol_cycles
retain slice_eoc_cycles as is (Imre)

---
 drivers/gpu/drm/display/drm_dp_helper.c | 53 +++++++++++++++++--------------
--
 include/drm/display/drm_dp_helper.h     |  2 ++
 2 files changed, 29 insertions(+), 26 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +0 -0

index 57828f2b7b5a0582ca4a6f2a9be2d5909fe8ad24..5ce8ccc3310fb71b39ea5f74c4 022474c180f727 100644

drivers/gpu/drm/display/drm_dp_helper.c +0 -11
@@ -4392,26 +4392,33 @@ EXPORT_SYMBOL(drm_panel_dp_aux_backlight);
 
 #endif
 
-/* See DP Standard v2.1 2.6.4.4.1.1, 2.8.4.4, 2.8.7 */ -static int
 drm_dp_link_symbol_cycles(int lane_count, int pixels, int bpp_x16,
-				     int symbol_size, bool is_mst)
-{
-	int cycles = DIV_ROUND_UP(pixels * bpp_x16, 16 * symbol_size *
 lane_count);
-	int align = is_mst ? 4 / lane_count : 1;
-
-	return ALIGN(cycles, align);
-}
-
-static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int
 slice_count,
-					 int bpp_x16, int symbol_size, bool

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4403

Quoted 10 lines
drivers/gpu/drm/display/drm_dp_helper.c +3 -4
 is_mst)
-{
-	int slice_pixels = DIV_ROUND_UP(pixels, slice_count);
-	int slice_data_cycles = drm_dp_link_symbol_cycles(lane_count,
 slice_pixels,
-							  bpp_x16,
 symbol_size, is_mst);
+/**
+ * drm_dp_link_data_symbol_cycles - calculate the link symbol count
+ * @lane_coount: DP link lane count

Typo "lane_count"

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4405

Quoted 8 lines
drivers/gpu/drm/display/drm_dp_helper.c +8 -0
+ * @pixels: horizontal active pixels
+ * @bpp_x16: bits per pixel in .4 binary fixed format
+ * @symbol_size: DP symbol size
+ * @is_mst: is mst or sst
+ * @slice_count: number of slices
+ *
+ * Calculate the link symbol cycles for both dsc and non dsc case and
+ * return the count.

Lets add the DP spec to be referred seems like it was missed

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4413

Quoted 8 lines
drivers/gpu/drm/display/drm_dp_helper.c +7 -0
+ */
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count)
 {
+	int slice_pixels = slice_count ? DIV_ROUND_UP(pixels, slice_count) :
+					 pixels;
+	int cycles = DIV_ROUND_UP(slice_pixels * bpp_x16,
+				  (6 * symbol_size * lane_count));

Shouldn't this be 16
Also one thing I see which was there previously to while calculating is we ignore the two ceils Inside the function and merge it into a single div_round_up which may bring as slight variation in calculation For example for non dsc case
Spec says
HACT_LL_SYM_CYC_CNT
= CEIL(CEIL(HACT_WIDTH / 4) × PIX_BPP / SYMBOL_SIZE)
HACT_ML_SYM_CYC_CNT
= HACT_LL_SYM_CYC_CNT × 4 / PHY_LANE_CNT

Quoted 2 lines

But we do
DIV_ROUND_UP(slice_pixels * bpp_x16, (6 * symbol_size * lane_count));

and we align this to 4 / lane_count. So the code does what the DP standard describes.

Quoted 8 lines

Which translates to
CEIL( (HACT_WIDTH* BPP*4)/(16 *SYMBOL_SIZE *LANECOUNT))

Which does not seem to match the calculation exactly as what was said in the spec Lets have an intermediate ll_symbol_cycle variable too should make the calculations More clearer and precise according to me.

Also for dsc case lets have chunk size instead of reusing slice pixels.

Let's not add now other changes besides the original request of one thing, that is to make drm_dp_link_symbol_cycles() handle both the DSC and non-DSC cases without changing the calculation, see [1]. That corresponds to the diff I added in [2].

[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]

Quoted 60 lines

Regards,
Suraj Kandpal

Quoted 56 lines
drivers/gpu/drm/display/drm_dp_helper.c +5 -4
+	int slice_data_cycles = ALIGN(cycles, is_mst ? (4 / lane_count) : 1);
 	int slice_eoc_cycles = is_mst ? 4 / lane_count : 1;
 
-	return slice_count * (slice_data_cycles + slice_eoc_cycles);
+	return slice_count ? (slice_count *
+			      (slice_data_cycles + slice_eoc_cycles)) :
+			      slice_data_cycles;
 }
+EXPORT_SYMBOL(drm_dp_link_data_symbol_cycles);
 
 /**
  * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream @@
-4486,15 +4493,9 @@ int drm_dp_bw_overhead(int lane_count, int hactive,
 	WARN_ON((flags & DRM_DP_BW_OVERHEAD_UHBR) &&
 		(flags & DRM_DP_BW_OVERHEAD_FEC));
 
-	if (flags & DRM_DP_BW_OVERHEAD_DSC)
-		symbol_cycles = drm_dp_link_dsc_symbol_cycles(lane_count,

hactive,

drivers/gpu/drm/display/drm_dp_helper.c +0 -2
-							      dsc_slice_count,
-							      bpp_x16,

symbol_size,

drivers/gpu/drm/display/drm_dp_helper.c +0 -3
-							      is_mst);
-	else
-		symbol_cycles = drm_dp_link_symbol_cycles(lane_count,

hactive,

drivers/gpu/drm/display/drm_dp_helper.c +0 -1
-							  bpp_x16,

symbol_size,

drivers/gpu/drm/display/drm_dp_helper.c +1 -1
-							  is_mst);
+	symbol_cycles = drm_dp_link_data_symbol_cycles(lane_count,

hactive,

drivers/gpu/drm/display/drm_dp_helper.c +2 -0
+						       bpp_x16, symbol_size,
+						       is_mst, dsc_slice_count);
 
 	return DIV_ROUND_UP_ULL(mul_u32_u32(symbol_cycles *

symbol_size * lane_count,

drivers/gpu/drm/display/drm_dp_helper.c +0 -0
 					    overhead * 16),
include/drm/display/drm_dp_helper.h +0 -0

index d9614e2c89397536f44bb7258e894628ae1dccc9..98bbbe98e5bc0ce0f9cdf513b 2c5ea90bb5caffb 100644

include/drm/display/drm_dp_helper.h +2 -0
@@ -971,5 +971,7 @@ int drm_dp_bw_channel_coding_efficiency(bool
 is_uhbr);  int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes);
 
 ssize_t drm_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc, struct
 dp_sdp *sdp);
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count);
 

#endif /* _DRM_DP_HELPER_H_ */

--
2.25.1

#4 lore raw

Re: [PATCH v3 1/3] drm/display/dp: Export fn to calculate link symbol cycles

In reply to Arun R Murthy
Quoted 55 lines · Arun R Murthy

Unify the function to calculate the link symbol cycles for both dsc and non-dsc case and export the function so that it can be used in the respective platform display drivers for other calculations.

v2: unify the fn for both dsc and non-dsc case (Imre)
v3: rename drm_dp_link_symbol_cycles to drm_dp_link_data_symbol_cycles
retain slice_eoc_cycles as is (Imre)

---
 drivers/gpu/drm/display/drm_dp_helper.c | 53 +++++++++++++++++----------------
 include/drm/display/drm_dp_helper.h     |  2 ++
 2 files changed, 29 insertions(+), 26 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +17 -16
index 57828f2b7b5a0582ca4a6f2a9be2d5909fe8ad24..5ce8ccc3310fb71b39ea5f74c4022474c180f727 100644
@@ -4392,26 +4392,33 @@ EXPORT_SYMBOL(drm_panel_dp_aux_backlight);
 
 #endif
 
-/* See DP Standard v2.1 2.6.4.4.1.1, 2.8.4.4, 2.8.7 */
-static int drm_dp_link_symbol_cycles(int lane_count, int pixels, int bpp_x16,
-				     int symbol_size, bool is_mst)
-{
-	int cycles = DIV_ROUND_UP(pixels * bpp_x16, 16 * symbol_size * lane_count);
-	int align = is_mst ? 4 / lane_count : 1;
-
-	return ALIGN(cycles, align);
-}
-
-static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int slice_count,
-					 int bpp_x16, int symbol_size, bool is_mst)
-{
-	int slice_pixels = DIV_ROUND_UP(pixels, slice_count);
-	int slice_data_cycles = drm_dp_link_symbol_cycles(lane_count, slice_pixels,
-							  bpp_x16, symbol_size, is_mst);
+/**
+ * drm_dp_link_data_symbol_cycles - calculate the link symbol count
+ * @lane_coount: DP link lane count
+ * @pixels: horizontal active pixels
+ * @bpp_x16: bits per pixel in .4 binary fixed format
+ * @symbol_size: DP symbol size
+ * @is_mst: is mst or sst
+ * @slice_count: number of slices
+ *
+ * Calculate the link symbol cycles for both dsc and non dsc case and
+ * return the count.
+ */
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count)
+{
+	int slice_pixels = slice_count ? DIV_ROUND_UP(pixels, slice_count) :
+					 pixels;

drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4420

Quoted 10 lines
drivers/gpu/drm/display/drm_dp_helper.c +6 -1
+	int cycles = DIV_ROUND_UP(slice_pixels * bpp_x16,
+				  (6 * symbol_size * lane_count));
+	int slice_data_cycles = ALIGN(cycles, is_mst ? (4 / lane_count) : 1);
 	int slice_eoc_cycles = is_mst ? 4 / lane_count : 1;
 
-	return slice_count * (slice_data_cycles + slice_eoc_cycles);
+	return slice_count ? (slice_count *
+			      (slice_data_cycles + slice_eoc_cycles)) :
+			      slice_data_cycles;
 }

This is not what I meant. Please keep the two functions separate, don't merge them and don't introduce changes unrelated to what was requested. The following is needed here:

drivers/gpu/drm/display/drm_dp_helper.c +11 -7
@@ -4393,8 +4393,8 @@ EXPORT_SYMBOL(drm_panel_dp_aux_backlight);
 #endif
 
 /* See DP Standard v2.1 2.6.4.4.1.1, 2.8.4.4, 2.8.7 */
-static int drm_dp_link_symbol_cycles(int lane_count, int pixels, int bpp_x16,
-                                    int symbol_size, bool is_mst)
+static int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+                                         int symbol_size, bool is_mst)
 {
        int cycles = DIV_ROUND_UP(pixels * bpp_x16, 16 * symbol_size * lane_count);
        int align = is_mst ? 4 / lane_count : 1;
@@ -4402,13 +4402,17 @@ static int drm_dp_link_symbol_cycles(int lane_count, int pixels, int bpp_x16,
        return ALIGN(cycles, align);
 }
 
-static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int slice_count,
-                                        int bpp_x16, int symbol_size, bool is_mst)
+int drm_dp_link_symbol_cycles(int lane_count, int pixels, int dsc_slice_count,
+                             int bpp_x16, int symbol_size, bool is_mst)
 {
+       int slice_count = dsc_slice_count ? : 1;
        int slice_pixels = DIV_ROUND_UP(pixels, slice_count);
-       int slice_data_cycles = drm_dp_link_symbol_cycles(lane_count, slice_pixels,
-                                                         bpp_x16, symbol_size, is_mst);
-       int slice_eoc_cycles = is_mst ? 4 / lane_count : 1;
+       int slice_data_cycles = drm_dp_link_data_symbol_cycles(lane_count, slice_pixels,
+                                                              bpp_x16, symbol_size, is_mst);
+       int slice_eoc_cycles = 0;
+
+       if (dsc_slice_count)
+               slice_eoc_cycles = is_mst ? 4 / lane_count : 1;
 
        return slice_count * (slice_data_cycles + slice_eoc_cycles);
 }
Quoted 39 lines
drivers/gpu/drm/display/drm_dp_helper.c +4 -9
+EXPORT_SYMBOL(drm_dp_link_data_symbol_cycles);
 
 /**
  * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream
@@ -4486,15 +4493,9 @@ int drm_dp_bw_overhead(int lane_count, int hactive,
 	WARN_ON((flags & DRM_DP_BW_OVERHEAD_UHBR) &&
 		(flags & DRM_DP_BW_OVERHEAD_FEC));
 
-	if (flags & DRM_DP_BW_OVERHEAD_DSC)
-		symbol_cycles = drm_dp_link_dsc_symbol_cycles(lane_count, hactive,
-							      dsc_slice_count,
-							      bpp_x16, symbol_size,
-							      is_mst);
-	else
-		symbol_cycles = drm_dp_link_symbol_cycles(lane_count, hactive,
-							  bpp_x16, symbol_size,
-							  is_mst);
+	symbol_cycles = drm_dp_link_data_symbol_cycles(lane_count, hactive,
+						       bpp_x16, symbol_size,
+						       is_mst, dsc_slice_count);
 
 	return DIV_ROUND_UP_ULL(mul_u32_u32(symbol_cycles * symbol_size * lane_count,
 					    overhead * 16),
include/drm/display/drm_dp_helper.h +2 -0
index d9614e2c89397536f44bb7258e894628ae1dccc9..98bbbe98e5bc0ce0f9cdf513b2c5ea90bb5caffb 100644
@@ -971,5 +971,7 @@ int drm_dp_bw_channel_coding_efficiency(bool is_uhbr);
 int drm_dp_max_dprx_data_rate(int max_link_rate, int max_lanes);
 
 ssize_t drm_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc, struct dp_sdp *sdp);
+int drm_dp_link_data_symbol_cycles(int lane_count, int pixels, int bpp_x16,
+				   int symbol_size, bool is_mst, int slice_count);
 
 #endif /* _DRM_DP_HELPER_H_ */
Signature · 2 lines
-- 
2.25.1
#5 lore raw

PATCH v3 2/3 drm/i915/display: export function to count dsc slices

In reply to Arun R Murthy

Export the function to calculate dsc slice count. This will be used in minimum hblank calculation.

---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 4 ++--
 drivers/gpu/drm/i915/display/intel_dp_mst.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_mst.c +2 -2
index d2988b9a6e7bd55d2ea4d34230c4d017e1f4cc93..af98a0d0e8376a79ce1ab6ff3c4f6af30f4d3e73 100644
@@ -198,8 +198,8 @@ static int intel_dp_mst_calc_pbn(int pixel_clock, int bpp_x16, int bw_overhead)
 	return DIV_ROUND_UP(effective_data_rate * 64, 54 * 1000);
 }
 
-static int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,
-					    const struct intel_crtc_state *crtc_state)
+int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,
+				     const struct intel_crtc_state *crtc_state)
 {
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
drivers/gpu/drm/i915/display/intel_dp_mst.h +3 -0
index c1bbfeb02ca9e7afb96156f58143275225245956..b3d5b347c4b5258cefb0e559a5cb8d0d769111cc 100644
@@ -12,6 +12,7 @@ struct drm_connector_state;
 struct intel_atomic_state;
 struct intel_crtc;
 struct intel_crtc_state;
+struct intel_connector;
 struct intel_digital_port;
 struct intel_dp;
 struct intel_link_bw_limits;
@@ -35,5 +36,7 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
 				   struct intel_crtc_state *crtc_state,
 				   struct drm_connector_state *conn_state,
 				   int min_bpp_x16, int max_bpp_x16, int bpp_step_x16, bool dsc);
+int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,
+				     const struct intel_crtc_state *crtc_state);
 
 #endif /* __INTEL_DP_MST_H__ */
Signature · 1 line
2.25.1
#6 lore raw

PATCH v3 3/3 drm/i915/display: move min_hblank from dp_mst.c to dp.c

In reply to Arun R Murthy

Minimum HBlank is programmed to address jitter for high resolutions with high refresh rates that have small Hblank, specifically where Hblank is smaller than one MTP.

TODO: Add the min_hblank calculation for hdmi as well.

v2: move from intel_audio.c to intel_dp.c
some correction in link_bpp_x16 (Imre)
v3: min_hblank for 8b/10b MST and 128b/132b SST/MST
handle error for intel_dp_mst_dsc_get_slice_count reset min_hblank before disabling transcoder (Imre)

---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++
 drivers/gpu/drm/i915/display/intel_dp.c      | 64 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.h      |  4 ++
 drivers/gpu/drm/i915/display/intel_dp_mst.c  | 52 +---------------------
 4 files changed, 88 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +18 -0
index dc7517da2ed5c75fb1715d43e6bfc792a8420f30..ad41382981299dffab5cc592b43cdab7eebb7b5b 100644
@@ -1782,8 +1782,11 @@ static void hsw_crtc_disable(struct intel_atomic_state *state,
 	const struct intel_crtc_state *old_crtc_state =
 		intel_atomic_get_old_crtc_state(state, crtc);
 	struct intel_crtc *pipe_crtc;
+	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
 	int i;
 
+	if (DISPLAY_VER(display) >= 30)
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder), 0);
 	/*
 	 * FIXME collapse everything to one hook.
 	 * Need care with mst->ddi interactions.
@@ -2726,6 +2729,19 @@ static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_sta
 		intel_de_write(display, TRANS_VTOTAL(display, pipe),
 			       VACTIVE(crtc_vdisplay - 1) |
 			       VTOTAL(crtc_vtotal - 1));
+
+	if (DISPLAY_VER(display) >= 30 && crtc_state->min_hblank) {
+		/*
+		 * Address issues for resolutions with high refresh rate that
+		 * have small Hblank, specifically where Hblank is smaller than
+		 * one MTP. Simulations indicate this will address the
+		 * jitter issues that currently causes BS to be immediately
+		 * followed by BE which DPRX devices are unable to handle.
+		 * https://groups.vesa.org/wg/DP/document/20494
+		 */
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),
+			       crtc_state->min_hblank);
+	}
 }
 
 static void intel_set_transcoder_timings_lrr(const struct intel_crtc_state *crtc_state)
@@ -5221,6 +5237,8 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	PIPE_CONF_CHECK_I(lane_count);
 	PIPE_CONF_CHECK_X(lane_lat_optim_mask);
 
+	PIPE_CONF_CHECK_I(min_hblank);
+
 	if (HAS_DOUBLE_BUFFERED_M_N(display)) {
 		if (!fastset || !pipe_config->update_m_n)
 			PIPE_CONF_CHECK_M_N(dp_m_n);
drivers/gpu/drm/i915/display/intel_dp.c +64 -0

76 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_dp.h +4 -0
index 9189db4c25946a0f082223ce059c242e80cc32dc..43624aead998a8a330a244bb9c85f026e203171b 100644
@@ -208,5 +208,9 @@ bool intel_dp_has_connector(struct intel_dp *intel_dp,
 			    const struct drm_connector_state *conn_state);
 int intel_dp_dsc_max_src_input_bpc(struct intel_display *display);
 int intel_dp_dsc_min_src_input_bpc(void);
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc);
 
 #endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_dp_mst.c +2 -50

92 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Hi Arun

I was trying to use this series for the underrun issue! But this patch didnt apply cleanly! And had some compilation issues because of an unused variable!
Also I did not get expected traces on min hblank! Not sure if there was any issue on my conflicts resolution to get this applied on my branch.

Anyway pls have a look at few comments..

Quoted 32 lines · Arun R Murthy

Minimum HBlank is programmed to address jitter for high resolutions with high refresh rates that have small Hblank, specifically where Hblank is smaller than one MTP.

TODO: Add the min_hblank calculation for hdmi as well.

v2: move from intel_audio.c to intel_dp.c
    some correction in link_bpp_x16 (Imre)
v3: min_hblank for 8b/10b MST and 128b/132b SST/MST handle error for intel_dp_mst_dsc_get_slice_count reset min_hblank before disabling transcoder (Imre)

---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++ drivers/gpu/drm/i915/display/intel_dp.c      | 64 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp.h      |  4 ++ drivers/gpu/drm/i915/display/intel_dp_mst.c  | 52 +---------------------

 4 files changed, 88 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index dc7517da2ed5c75fb1715d43e6bfc792a8420f30..ad41382981299dffab5cc592b43cdab7eebb7b5b 100644
@@ -1782,8 +1782,11 @@ static void hsw_crtc_disable(struct intel_atomic_state *state,

  const struct intel_crtc_state *old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc); struct intel_crtc *pipe_crtc;

drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;

  int i;

drivers/gpu/drm/i915/display/intel_display.c static void hsw_crtc_disable(struct intel_atomic_state *state, · line 1789

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+	if (DISPLAY_VER(display) >= 30)
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder), 0);

Please have a look at comments from Imre for the last revision.

drivers/gpu/drm/i915/display/intel_display.c static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_sta · line 2733

Quoted 10 lines

  /*
  * FIXME collapse everything to one hook.
  * Need care with mst->ddi interactions.

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -2726,6 +2729,19 @@ static void intel_set_transcoder_timings(const struct intel_crtc_state
 *crtc_sta
  		intel_de_write(display, TRANS_VTOTAL(display, pipe),

         VACTIVE(crtc_vdisplay - 1) | VTOTAL(crtc_vtotal - 1));

drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	if (DISPLAY_VER(display) >= 30 && crtc_state->min_hblank) {

Again pls have a look at Imre's comments in the prev version.

Update the crtc_state->min_hblank calculations so that it can have 0 for non supported cases and have a non zero for 8b/10b MST and 128b/132b and program here.

Quoted 163 lines
drivers/gpu/drm/i915/display/intel_display.c +11 -0
+		/*
+		 * Address issues for resolutions with high refresh rate that
+		 * have small Hblank, specifically where Hblank is smaller than
+		 * one MTP. Simulations indicate this will address the
+		 * jitter issues that currently causes BS to be immediately
+		 * followed by BE which DPRX devices are unable to handle.
+		 * https://groups.vesa.org/wg/DP/document/20494
+		 */
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),
+			       crtc_state->min_hblank);
+	}

 }

 static void intel_set_transcoder_timings_lrr(const struct intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -5221,6 +5237,8 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
  	PIPE_CONF_CHECK_I(lane_count);
  	PIPE_CONF_CHECK_X(lane_lat_optim_mask);

drivers/gpu/drm/i915/display/intel_display.c +2 -0
+	PIPE_CONF_CHECK_I(min_hblank);
+

  if (HAS_DOUBLE_BUFFERED_M_N(display)) { if (!fastset || !pipe_config->update_m_n) PIPE_CONF_CHECK_M_N(dp_m_n);

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
index 7b95d62730e6f0c27c07fb59f16476369c4762a4..7b114b7cc86cc78088ca27e2cb7b08b8491d8283 100644
@@ -3103,6 +3103,67 @@ intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,
  	}
  }

drivers/gpu/drm/i915/display/intel_dp.c +61 -0
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc)
+{
+	struct intel_display *display = to_intel_display(crtc_state);
+	const struct drm_display_mode *adjusted_mode =
+					&crtc_state->hw.adjusted_mode;
+	struct intel_connector *connector = to_intel_connector(conn_state->connector);
+	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
+	/*
+	 * min symbol cycles is 3(BS,VBID, BE) for 128b/132b and
+	 * 5(BS, VBID, MVID, MAUD) for 8b/10b
+	 */
+	int min_sym_cycles = intel_dp_is_uhbr(crtc_state) ? 3 : 5;
+	bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
+	int min_hblank;
+	int max_lane_count = 4;
+	int hactive_sym_cycles, htotal_sym_cycles;
+	int dsc_slices = 0;
+
+	if (DISPLAY_VER(display) < 30)
+		return;
+
+	/* MIN_HBLANK should be set only for 8b/10b MST or for 128b/132b SST/MST */
+	if (intel_dp_is_uhbr(crtc_state) || (is_mst && !intel_dp_is_uhbr(crtc_state)))
+		return;
+
+	if (is_dsc) {
+		dsc_slices = intel_dp_mst_dsc_get_slice_count(connector,
+							      crtc_state);
+		if (!dsc_slices) {
+			drm_dbg(display->drm, "failed to calculate dsc slice count\n");
+			return;
+		}
+	}
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST & 128b/132b */
+	hactive_sym_cycles = drm_dp_link_data_symbol_cycles(max_lane_count,
+							    adjusted_mode->hdisplay,
+							    link_bpp_x16,
+							    symbol_size,
+							    is_mst,
+							    dsc_slices);
+	htotal_sym_cycles = adjusted_mode->htotal *
+			    (hactive_sym_cycles / adjusted_mode->hdisplay);
+
+	min_hblank = htotal_sym_cycles - hactive_sym_cycles;
+	/* minimum Hblank calculation: https://groups.vesa.org/wg/DP/document/20494 */
+	min_hblank = max(min_hblank, min_sym_cycles);
+
+	/*
+	 * adjust the BlankingStart/BlankingEnd framing control from
+	 * the calculated value
+	 */
+	min_hblank = min_hblank - 2;
+
+	min_hblank = min(10, min_hblank);
+	crtc_state->min_hblank = min_hblank;
+}
+

 int
 intel_dp_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config,

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
@@ -3202,6 +3263,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
  				       &pipe_config->dp_m_n);
  	}

drivers/gpu/drm/i915/display/intel_dp.c +3 -0
+	intel_dp_compute_min_hblank(link_bpp_x16, pipe_config, conn_state,
+				    pipe_config->dsc.compression_enable);
+

  /* FIXME: abstract this better */
  if (pipe_config->splitter.enable) pipe_config->dp_m_n.data_m *= pipe_config->splitter.link_count;

drivers/gpu/drm/i915/display/intel_dp.h +4 -0
index 9189db4c25946a0f082223ce059c242e80cc32dc..43624aead998a8a330a244bb9c85f026e203171b 100644
@@ -208,5 +208,9 @@ bool intel_dp_has_connector(struct intel_dp *intel_dp,
  			    const struct drm_connector_state *conn_state);
  int intel_dp_dsc_max_src_input_bpc(struct intel_display *display);
  int intel_dp_dsc_min_src_input_bpc(void);
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc);


 #endif /* __INTEL_DP_H__ */

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
index af98a0d0e8376a79ce1ab6ff3c4f6af30f4d3e73..4153afa13c618bb4db6dbcdc6e59faddcbeade6b 100644
@@ -211,26 +211,6 @@ int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,
  					    num_joined_pipes);
  }

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -20
-static void intel_dp_mst_compute_min_hblank(struct intel_crtc_state *crtc_state,
-					    int bpp_x16)
-{
-	struct intel_display *display = to_intel_display(crtc_state);
-	const struct drm_display_mode *adjusted_mode =
-					&crtc_state->hw.adjusted_mode;
-	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
-	int hblank;
-
-	if (DISPLAY_VER(display) < 20)
-		return;
-
-	/* 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);
-
-	crtc_state->min_hblank = hblank;
-}
-

 int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp, struct intel_crtc_state *crtc_state, struct drm_connector_state *conn_state,

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -301,12 +281,11 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
  		local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
  							     false, dsc_slice_count,
 link_bpp_x16);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -2
-		intel_dp_mst_compute_min_hblank(crtc_state, link_bpp_x16);
-

  intel_dp_mst_compute_m_n(crtc_state, local_bw_overhead, link_bpp_x16, &crtc_state->dp_m_n);

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp, · line 288

Quoted 1 line
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -0
+		intel_dp_compute_min_hblank(link_bpp_x16, crtc_state, conn_state, dsc);

Also I wanted to check if this is the right place to call intel_dp_compute_min_hblank()? Can't this be called once we settle a link_bpp. May be from mst_stream_compute_config() before calling intel_dp_audio_compute_config(). @Imre pls comment.

Quoted 15 lines


  if (is_mst) {
  int remote_bw_overhead;

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -998,7 +977,6 @@ static void mst_stream_disable(struct intel_atomic_state *state,
  	struct intel_dp *intel_dp = to_primary_dp(encoder);

  struct intel_connector *connector = to_intel_connector(old_conn_state->connector);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -1
-	enum transcoder trans = old_crtc_state->cpu_transcoder;


  drm_dbg_kms(display->drm, "active links %d\n", intel_dp->mst.active_links);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -1009,9 +987,6 @@ static void mst_stream_disable(struct intel_atomic_state *state,
  	intel_hdcp_disable(intel_mst->connector);


  intel_dp_sink_disable_decompression(state, connector, old_crtc_state);

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct intel_atomic_state *state, · line 1014

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -3
-
-	if (DISPLAY_VER(display) >= 20)
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans), 0);

After removing this, "display" is not used anymore in this function. So need to get rid of unused local variable display as well.

BR
Vinod

Quoted 43 lines

 }

 static void mst_stream_post_disable(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
@@ -1286,7 +1261,7 @@ static void mst_stream_enable(struct intel_atomic_state *state,
  	enum transcoder trans = pipe_config->cpu_transcoder;
  	bool first_mst_stream = intel_dp->mst.active_links == 1;
  	struct intel_crtc *pipe_crtc;
-	int ret, i, min_hblank;
+	int ret, i;


  drm_WARN_ON(display->drm, pipe_config->has_pch_encoder);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -1301,29 +1276,6 @@ static void mst_stream_enable(struct intel_atomic_state *state,
  			       TRANS_DP2_VFREQ_PIXEL_CLOCK(crtc_clock_hz & 0xffffff));
  	}

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -23
-	if (DISPLAY_VER(display) >= 20) {
-		/*
-		 * adjust the BlankingStart/BlankingEnd framing control from
-		 * the calculated value
-		 */
-		min_hblank = pipe_config->min_hblank - 2;
-
-		/* Maximum value to be programmed is limited to 0x10 */
-		min_hblank = min(0x10, min_hblank);
-
-		/*
-		 * Minimum hblank accepted for 128b/132b would be 5 and for
-		 * 8b/10b would be 3 symbol count
-		 */
-		if (intel_dp_is_uhbr(pipe_config))
-			min_hblank = max(min_hblank, 5);
-		else
-			min_hblank = max(min_hblank, 3);
-
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans),
-			       min_hblank);
-	}
-

  enable_bs_jitter_was(pipe_config);

  intel_ddi_enable_transcoder_func(encoder, pipe_config);

#8 lore raw

RE: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Quoted 11 lines

-----Original Message-----
From: Govindapillai, Vinod <[email protected]>
Sent: Tuesday, April 22, 2025 4:17 AM
To: Murthy, Arun R <[email protected]>; dri- [email protected]; [email protected]; intel- [email protected]
Cc: Deak, Imre <[email protected]>
Subject: Re: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Quoted 5 lines

Hi Arun

I was trying to use this series for the underrun issue! But this patch didnt apply cleanly!
And had some compilation issues because of an unused variable!

Not sure, even CI is claiming so, but the said unused variable is used in the function for dbg print.

Quoted 1 line

Also I did not get expected traces on min hblank! Not sure if there was any

No, there are no traces/dbg prints added for this.

Quoted 44 lines

issue on my conflicts resolution to get this applied on my branch.

Anyway pls have a look at few comments..

Quoted 24 lines · Arun R Murthy

Minimum HBlank is programmed to address jitter for high resolutions with high refresh rates that have small Hblank, specifically where Hblank is smaller than one MTP.

TODO: Add the min_hblank calculation for hdmi as well.

v2: move from intel_audio.c to intel_dp.c
    some correction in link_bpp_x16 (Imre)
v3: min_hblank for 8b/10b MST and 128b/132b SST/MST handle error for intel_dp_mst_dsc_get_slice_count reset min_hblank before disabling transcoder (Imre)

---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++ drivers/gpu/drm/i915/display/intel_dp.c      | 64
++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.h      |  4 ++ drivers/gpu/drm/i915/display/intel_dp_mst.c  | 52
+---------------------

 4 files changed, 88 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
Quoted 2 lines

index

dc7517da2ed5c75fb1715d43e6bfc792a8420f30..ad41382981299dffab5cc592b 43c

drivers/gpu/drm/i915/display/intel_display.c static void hsw_crtc_disable(struct

Quoted 4 lines

dab7eebb7b5b 100644

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -1782,8 +1782,11 @@ static void hsw_crtc_disable(struct

intel_atomic_state *state,

Quoted 6 lines

  const struct intel_crtc_state *old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc); struct intel_crtc *pipe_crtc;

drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;

  int i;

Quoted 5 lines

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

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+	if (DISPLAY_VER(display) >= 30)
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),

0);

Please have a look at comments from Imre for the last revision.

In my earlier version min_hblank was being disabled after transcoder disable, here the min_hblank is being disabled before the transcoder is being disabled.

Quoted 13 lines

drivers/gpu/drm/i915/display/intel_display.c static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_sta · line 2733

Quoted 10 lines

  /*
  * FIXME collapse everything to one hook.
  * Need care with mst->ddi interactions.

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -2726,6 +2729,19 @@ static void intel_set_transcoder_timings(const

struct intel_crtc_state *crtc_sta
  intel_de_write(display, TRANS_VTOTAL(display, pipe), VACTIVE(crtc_vdisplay - 1) | VTOTAL(crtc_vtotal - 1));

drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	if (DISPLAY_VER(display) >= 30 && crtc_state->min_hblank) {

Again pls have a look at Imre's comments in the prev version.

Quoted 3 lines

Update the crtc_state->min_hblank calculations so that it can have 0 for non supported cases and have a non zero for 8b/10b MST and 128b/132b and program here.

No non-supported cases we don’t have the value calculated and we don’t have to write to this register for 8b/10b SST case. In supported cases 8b/10b MST and 128b/132b the value cannot be 0, if its 0 then it means the feature is disabled.

Quoted 199 lines
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_display.c +11 -0
+		/*
+		 * Address issues for resolutions with high refresh rate that
+		 * have small Hblank, specifically where Hblank is smaller than
+		 * one MTP. Simulations indicate this will address the
+		 * jitter issues that currently causes BS to be immediately
+		 * followed by BE which DPRX devices are unable to handle.
+		 * https://groups.vesa.org/wg/DP/document/20494
+		 */
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),
+			       crtc_state->min_hblank);
+	}
Quoted 4 lines

 }

 static void intel_set_transcoder_timings_lrr(const struct intel_crtc_state *crtc_state) @@ -5221,6 +5237,8 @@

intel_pipe_config_compare(const struct intel_crtc_state *current_config,

Quoted 10 lines

  PIPE_CONF_CHECK_I(lane_count);
  PIPE_CONF_CHECK_X(lane_lat_optim_mask);

drivers/gpu/drm/i915/display/intel_display.c +2 -0
+	PIPE_CONF_CHECK_I(min_hblank);
+

  if (HAS_DOUBLE_BUFFERED_M_N(display)) { if (!fastset || !pipe_config->update_m_n) PIPE_CONF_CHECK_M_N(dp_m_n);

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
Quoted 2 lines

index

7b95d62730e6f0c27c07fb59f16476369c4762a4..7b114b7cc86cc78088ca27e2c b7b

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct

Quoted 4 lines

08b8491d8283 100644

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
@@ -3103,6 +3103,67 @@ intel_dp_queue_modeset_retry_for_link(struct

intel_atomic_state *state,

Quoted 19 lines
drivers/gpu/drm/i915/display/intel_dp.c +15 -0
  	}
  }
 
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc)
+{
+	struct intel_display *display = to_intel_display(crtc_state);
+	const struct drm_display_mode *adjusted_mode =
+					&crtc_state->hw.adjusted_mode;
+	struct intel_connector *connector = to_intel_connector(conn_state-
 connector);
+	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
+	/*
+	 * min symbol cycles is 3(BS,VBID, BE) for 128b/132b and
+	 * 5(BS, VBID, MVID, MAUD) for 8b/10b
+	 */
+	int min_sym_cycles = intel_dp_is_uhbr(crtc_state) ? 3 : 5;

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +10 -0
+	bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
+	int min_hblank;
+	int max_lane_count = 4;
+	int hactive_sym_cycles, htotal_sym_cycles;
+	int dsc_slices = 0;
+
+	if (DISPLAY_VER(display) < 30)
+		return;
+
+	/* MIN_HBLANK should be set only for 8b/10b MST or for 128b/132b

SST/MST */

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct · line 3132

Quoted 1 line
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	if (intel_dp_is_uhbr(crtc_state) || (is_mst &&

!intel_dp_is_uhbr(crtc_state)))

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+		return;
+
+	if (is_dsc) {
+		dsc_slices = intel_dp_mst_dsc_get_slice_count(connector,
+							      crtc_state);
+		if (!dsc_slices) {
+			drm_dbg(display->drm, "failed to calculate dsc slice

count\n");

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp.c +5 -0
+			return;
+		}
+	}
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct · line 3145

Quoted 1 line
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	hactive_sym_cycles =

drm_dp_link_data_symbol_cycles(max_lane_count,

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.c +10 -0
+							    adjusted_mode-
 hdisplay,
+							    link_bpp_x16,
+							    symbol_size,
+							    is_mst,
+							    dsc_slices);
+	htotal_sym_cycles = adjusted_mode->htotal *
+			    (hactive_sym_cycles / adjusted_mode->hdisplay);
+
+	min_hblank = htotal_sym_cycles - hactive_sym_cycles;
+	/* minimum Hblank calculation:

https://groups.vesa.org/wg/DP/document/20494 */

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.c +11 -0
+	min_hblank = max(min_hblank, min_sym_cycles);
+
+	/*
+	 * adjust the BlankingStart/BlankingEnd framing control from
+	 * the calculated value
+	 */
+	min_hblank = min_hblank - 2;
+
+	min_hblank = min(10, min_hblank);
+	crtc_state->min_hblank = min_hblank; }
+
Quoted 3 lines

 int
 intel_dp_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, @@ -3202,6

+3263,9 @@

Quoted 13 lines

intel_dp_compute_config(struct intel_encoder *encoder, &pipe_config->dp_m_n); }

drivers/gpu/drm/i915/display/intel_dp.c +3 -0
+	intel_dp_compute_min_hblank(link_bpp_x16, pipe_config, conn_state,
+				    pipe_config->dsc.compression_enable);
+

  /* FIXME: abstract this better */
  if (pipe_config->splitter.enable) pipe_config->dp_m_n.data_m *= pipe_config- splitter.link_count;

drivers/gpu/drm/i915/display/intel_dp.h +0 -0
Quoted 2 lines

index

9189db4c25946a0f082223ce059c242e80cc32dc..43624aead998a8a330a244b b9c85

drivers/gpu/drm/i915/display/intel_dp.h bool intel_dp_has_connector(struct intel_dp

Quoted 4 lines

f026e203171b 100644

drivers/gpu/drm/i915/display/intel_dp.h +0 -0
@@ -208,5 +208,9 @@ bool intel_dp_has_connector(struct intel_dp

*intel_dp,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.h +4 -0
  			    const struct drm_connector_state *conn_state);
  int intel_dp_dsc_max_src_input_bpc(struct intel_display *display);
  int intel_dp_dsc_min_src_input_bpc(void);
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc);
 
  #endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
Quoted 2 lines

index

af98a0d0e8376a79ce1ab6ff3c4f6af30f4d3e73..4153afa13c618bb4db6dbcdc6e 59

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mst_dsc_get_slice_count(const struct

Quoted 4 lines

faddcbeade6b 100644

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -211,26 +211,6 @@ int intel_dp_mst_dsc_get_slice_count(const struct

intel_connector *connector,

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -1
  					    num_joined_pipes);
  }
 
-static void intel_dp_mst_compute_min_hblank(struct intel_crtc_state

*crtc_state,

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -12
-					    int bpp_x16)
-{
-	struct intel_display *display = to_intel_display(crtc_state);
-	const struct drm_display_mode *adjusted_mode =
-					&crtc_state->hw.adjusted_mode;
-	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
-	int hblank;
-
-	if (DISPLAY_VER(display) < 20)
-		return;
-
-	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -7
-	hblank = DIV_ROUND_UP((DIV_ROUND_UP
-			       (adjusted_mode->htotal - adjusted_mode-
 hdisplay, 4) * bpp_x16),
-			      symbol_size);
-
-	crtc_state->min_hblank = hblank;
-}
-
  int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
  				   struct intel_crtc_state *crtc_state,

     struct drm_connector_state *conn_state,

(quoted diff) +0 -0
@@ -301,12 +281,11 @@
 > int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
 >  		local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
 >  							     false,
 dsc_slice_count,
 > link_bpp_x16);

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

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -2
-		intel_dp_mst_compute_min_hblank(crtc_state, link_bpp_x16);
-

  intel_dp_mst_compute_m_n(crtc_state, local_bw_overhead, link_bpp_x16, &crtc_state->dp_m_n);

drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -0
+		intel_dp_compute_min_hblank(link_bpp_x16, crtc_state,

conn_state,

Quoted 7 lines
Quoted 1 line

+dsc);

Also I wanted to check if this is the right place to call intel_dp_compute_min_hblank()? Can't this be called once we settle a link_bpp. May be from mst_stream_compute_config() before calling intel_dp_audio_compute_config(). @Imre pls comment.

Here the calculation is done as part of the m and n calculation and this function is called from mst_stream_compute_config and is done before dp_audio_compute_config(). Let me know if any change required will do.

Quoted 16 lines

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct

Quoted 4 lines

  if (is_mst) {
  int remote_bw_overhead;

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -998,7 +977,6 @@ static void mst_stream_disable(struct

intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
  	struct intel_dp *intel_dp = to_primary_dp(encoder);

  struct intel_connector *connector = to_intel_connector(old_conn_state->connector);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -1
-	enum transcoder trans = old_crtc_state->cpu_transcoder;

  drm_dbg_kms(display->drm, "active links %d\n", intel_dp->mst.active_links);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -1009,9 +987,6 @@ static void mst_stream_disable(struct

intel_atomic_state *state,

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
  	intel_hdcp_disable(intel_mst->connector);
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct intel_atomic_state *state, · line 1014

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -3
  	intel_dp_sink_disable_decompression(state, connector,
 old_crtc_state);
-
-	if (DISPLAY_VER(display) >= 20)
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans), 0);

After removing this, "display" is not used anymore in this function. So need to get rid of unused local variable display as well.

There is a drm_dbg_kms which used the struct display. Let me try rebasing with the latest drm-tip.

Thanks and Regards,
Arun R Murthy
--------------------

Quoted 49 lines

BR
Vinod

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_enable(struct

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
  }
 

 static void mst_stream_post_disable(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -1286,7 +1261,7 @@ static void mst_stream_enable(struct

intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_enable(struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
  	enum transcoder trans = pipe_config->cpu_transcoder;
  	bool first_mst_stream = intel_dp->mst.active_links == 1;
  	struct intel_crtc *pipe_crtc;
-	int ret, i, min_hblank;
+	int ret, i;
 
  	drm_WARN_ON(display->drm, pipe_config->has_pch_encoder);
 
@@ -1301,29 +1276,6 @@ static void mst_stream_enable(struct

intel_atomic_state *state,

Quoted 1 line

         TRANS_DP2_VFREQ_PIXEL_CLOCK(crtc_clock_hz &

0xffffff));

Quoted 29 lines

  }

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -23
-	if (DISPLAY_VER(display) >= 20) {
-		/*
-		 * adjust the BlankingStart/BlankingEnd framing control from
-		 * the calculated value
-		 */
-		min_hblank = pipe_config->min_hblank - 2;
-
-		/* Maximum value to be programmed is limited to 0x10 */
-		min_hblank = min(0x10, min_hblank);
-
-		/*
-		 * Minimum hblank accepted for 128b/132b would be 5 and for
-		 * 8b/10b would be 3 symbol count
-		 */
-		if (intel_dp_is_uhbr(pipe_config))
-			min_hblank = max(min_hblank, 5);
-		else
-			min_hblank = max(min_hblank, 3);
-
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans),
-			       min_hblank);
-	}
-

  enable_bs_jitter_was(pipe_config);

  intel_ddi_enable_transcoder_func(encoder, pipe_config);

#9 lore raw

Re: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Quoted 11 lines · Arun R
Quoted 11 lines

-----Original Message-----
From: Govindapillai, Vinod <[email protected]>
Sent: Tuesday, April 22, 2025 4:17 AM
To: Murthy, Arun R <[email protected]>; dri- [email protected]; [email protected]; intel- [email protected]
Cc: Deak, Imre <[email protected]>
Subject: Re: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Quoted 7 lines
Quoted 5 lines

Hi Arun

I was trying to use this series for the underrun issue! But this patch didnt apply cleanly!
And had some compilation issues because of an unused variable!

Not sure, even CI is claiming so, but the said unused variable is used in the function for dbg print.

May be you need to rebase?

Also how do we validate this? And how can we know that we are programming the write values?

Quoted 3 lines
Quoted 2 lines

Also I did not get expected traces on min hblank! Not sure if there was any

No, there are no traces/dbg prints added for this.

I added some traces to see what is being calculated for min_hblank

Quoted 66 lines
Quoted 45 lines

issue on my conflicts resolution to get this applied on my branch.

Anyway pls have a look at few comments..

Quoted 24 lines · Arun R Murthy

Minimum HBlank is programmed to address jitter for high resolutions with high refresh rates that have small Hblank, specifically where Hblank is smaller than one MTP.

TODO: Add the min_hblank calculation for hdmi as well.

v2: move from intel_audio.c to intel_dp.c
    some correction in link_bpp_x16 (Imre)
v3: min_hblank for 8b/10b MST and 128b/132b SST/MST handle error for intel_dp_mst_dsc_get_slice_count reset min_hblank before disabling transcoder (Imre)

---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++ drivers/gpu/drm/i915/display/intel_dp.c      | 64
++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.h      |  4 ++ drivers/gpu/drm/i915/display/intel_dp_mst.c  | 52
+---------------------

 4 files changed, 88 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
Quoted 2 lines

index

dc7517da2ed5c75fb1715d43e6bfc792a8420f30..ad41382981299dffab5cc592b 43c

drivers/gpu/drm/i915/display/intel_display.c static void hsw_crtc_disable(struct

Quoted 4 lines

dab7eebb7b5b 100644

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -1782,8 +1782,11 @@ static void hsw_crtc_disable(struct

intel_atomic_state *state,

Quoted 6 lines

  const struct intel_crtc_state *old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc); struct intel_crtc *pipe_crtc;

drivers/gpu/drm/i915/display/intel_display.c +1 -0
+	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;

  int i;

Quoted 5 lines

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

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+	if (DISPLAY_VER(display) >= 30)
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),

0);

Please have a look at comments from Imre for the last revision.

In my earlier version min_hblank was being disabled after transcoder disable, here the min_hblank is being disabled before the transcoder is being disabled.

Quoted 13 lines

drivers/gpu/drm/i915/display/intel_display.c static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_sta · line 2733

Quoted 10 lines

  /*
  * FIXME collapse everything to one hook.
  * Need care with mst->ddi interactions.

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -2726,6 +2729,19 @@ static void intel_set_transcoder_timings(const

struct intel_crtc_state *crtc_sta
  intel_de_write(display, TRANS_VTOTAL(display, pipe), VACTIVE(crtc_vdisplay - 1) | VTOTAL(crtc_vtotal - 1));

drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+	if (DISPLAY_VER(display) >= 30 && crtc_state->min_hblank) {

Again pls have a look at Imre's comments in the prev version.

Quoted 6 lines
Quoted 3 lines

Update the crtc_state->min_hblank calculations so that it can have 0 for non supported cases and have a non zero for 8b/10b MST and 128b/132b and program here.

No non-supported cases we don’t have the value calculated and we don’t have to write to this register for 8b/10b SST case. In supported cases 8b/10b MST and 128b/132b the value cannot be 0, if its 0 then it means the feature is disabled.

Update crtc_state->min_hblank to 0 or non-zero in intel_dp_compute_min_hblank() based on the conditions you listed above and write the value here (If this is the right place) if (DISPLAY_VER(display) >= 30). So you don't have to explicitly set it 0 in hsw_crtc_disable(). Also pls note there aren't any direct transcoder register accesses being done in this function.

Quoted 202 lines
Quoted 202 lines
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_display.c +11 -0
+		/*
+		 * Address issues for resolutions with high refresh rate that
+		 * have small Hblank, specifically where Hblank is smaller than
+		 * one MTP. Simulations indicate this will address the
+		 * jitter issues that currently causes BS to be immediately
+		 * followed by BE which DPRX devices are unable to handle.
+		 * https://groups.vesa.org/wg/DP/document/20494
+		 */
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),
+			       crtc_state->min_hblank);
+	}
Quoted 4 lines

 }

 static void intel_set_transcoder_timings_lrr(const struct intel_crtc_state *crtc_state) @@ -5221,6 +5237,8 @@

intel_pipe_config_compare(const struct intel_crtc_state *current_config,

Quoted 10 lines

  PIPE_CONF_CHECK_I(lane_count);
  PIPE_CONF_CHECK_X(lane_lat_optim_mask);

drivers/gpu/drm/i915/display/intel_display.c +2 -0
+	PIPE_CONF_CHECK_I(min_hblank);
+

  if (HAS_DOUBLE_BUFFERED_M_N(display)) { if (!fastset || !pipe_config->update_m_n) PIPE_CONF_CHECK_M_N(dp_m_n);

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
Quoted 2 lines

index

7b95d62730e6f0c27c07fb59f16476369c4762a4..7b114b7cc86cc78088ca27e2c b7b

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct

Quoted 4 lines

08b8491d8283 100644

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
@@ -3103,6 +3103,67 @@ intel_dp_queue_modeset_retry_for_link(struct

intel_atomic_state *state,

Quoted 19 lines
drivers/gpu/drm/i915/display/intel_dp.c +15 -0
  	}
  }
 
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc)
+{
+	struct intel_display *display = to_intel_display(crtc_state);
+	const struct drm_display_mode *adjusted_mode =
+					&crtc_state->hw.adjusted_mode;
+	struct intel_connector *connector = to_intel_connector(conn_state-
 connector);
+	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
+	/*
+	 * min symbol cycles is 3(BS,VBID, BE) for 128b/132b and
+	 * 5(BS, VBID, MVID, MAUD) for 8b/10b
+	 */
+	int min_sym_cycles = intel_dp_is_uhbr(crtc_state) ? 3 : 5;

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +10 -0
+	bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
+	int min_hblank;
+	int max_lane_count = 4;
+	int hactive_sym_cycles, htotal_sym_cycles;
+	int dsc_slices = 0;
+
+	if (DISPLAY_VER(display) < 30)
+		return;
+
+	/* MIN_HBLANK should be set only for 8b/10b MST or for 128b/132b

SST/MST */

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct · line 3132

Quoted 1 line
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	if (intel_dp_is_uhbr(crtc_state) || (is_mst &&

!intel_dp_is_uhbr(crtc_state)))

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+		return;
+
+	if (is_dsc) {
+		dsc_slices = intel_dp_mst_dsc_get_slice_count(connector,
+							      crtc_state);
+		if (!dsc_slices) {
+			drm_dbg(display->drm, "failed to calculate dsc slice

count\n");

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp.c +5 -0
+			return;
+		}
+	}
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct · line 3145

Quoted 1 line
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	hactive_sym_cycles =

drm_dp_link_data_symbol_cycles(max_lane_count,

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.c +10 -0
+							    adjusted_mode-
 hdisplay,
+							    link_bpp_x16,
+							    symbol_size,
+							    is_mst,
+							    dsc_slices);
+	htotal_sym_cycles = adjusted_mode->htotal *
+			    (hactive_sym_cycles / adjusted_mode->hdisplay);
+
+	min_hblank = htotal_sym_cycles - hactive_sym_cycles;
+	/* minimum Hblank calculation:

https://groups.vesa.org/wg/DP/document/20494 */

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.c +11 -0
+	min_hblank = max(min_hblank, min_sym_cycles);
+
+	/*
+	 * adjust the BlankingStart/BlankingEnd framing control from
+	 * the calculated value
+	 */
+	min_hblank = min_hblank - 2;
+
+	min_hblank = min(10, min_hblank);
+	crtc_state->min_hblank = min_hblank; }
+
Quoted 3 lines

 int
 intel_dp_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, @@ -3202,6

+3263,9 @@

Quoted 13 lines

intel_dp_compute_config(struct intel_encoder *encoder, &pipe_config->dp_m_n); }

drivers/gpu/drm/i915/display/intel_dp.c +3 -0
+	intel_dp_compute_min_hblank(link_bpp_x16, pipe_config, conn_state,
+				    pipe_config->dsc.compression_enable);
+

  /* FIXME: abstract this better */
  if (pipe_config->splitter.enable) pipe_config->dp_m_n.data_m *= pipe_config- splitter.link_count;

drivers/gpu/drm/i915/display/intel_dp.h +0 -0
Quoted 2 lines

index

9189db4c25946a0f082223ce059c242e80cc32dc..43624aead998a8a330a244b b9c85

drivers/gpu/drm/i915/display/intel_dp.h bool intel_dp_has_connector(struct intel_dp

Quoted 4 lines

f026e203171b 100644

drivers/gpu/drm/i915/display/intel_dp.h +0 -0
@@ -208,5 +208,9 @@ bool intel_dp_has_connector(struct intel_dp

*intel_dp,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp.h +4 -0
  			    const struct drm_connector_state *conn_state);
  int intel_dp_dsc_max_src_input_bpc(struct intel_display *display);
  int intel_dp_dsc_min_src_input_bpc(void);
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc);
 
  #endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
Quoted 2 lines

index

af98a0d0e8376a79ce1ab6ff3c4f6af30f4d3e73..4153afa13c618bb4db6dbcdc6e 59

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mst_dsc_get_slice_count(const struct

Quoted 4 lines

faddcbeade6b 100644

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -211,26 +211,6 @@ int intel_dp_mst_dsc_get_slice_count(const struct

intel_connector *connector,

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -1
  					    num_joined_pipes);
  }
 
-static void intel_dp_mst_compute_min_hblank(struct intel_crtc_state

*crtc_state,

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connector,

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -12
-					    int bpp_x16)
-{
-	struct intel_display *display = to_intel_display(crtc_state);
-	const struct drm_display_mode *adjusted_mode =
-					&crtc_state->hw.adjusted_mode;
-	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
-	int hblank;
-
-	if (DISPLAY_VER(display) < 20)
-		return;
-
-	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -7
-	hblank = DIV_ROUND_UP((DIV_ROUND_UP
-			       (adjusted_mode->htotal - adjusted_mode-
 hdisplay, 4) * bpp_x16),
-			      symbol_size);
-
-	crtc_state->min_hblank = hblank;
-}
-
  int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
  				   struct intel_crtc_state *crtc_state,

     struct drm_connector_state *conn_state,

(quoted diff) +0 -0
@@ -301,12 +281,11 @@
 > int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
 >  		local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
 >  							     false,
 dsc_slice_count,
 > link_bpp_x16);

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

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -2
-		intel_dp_mst_compute_min_hblank(crtc_state, link_bpp_x16);
-

  intel_dp_mst_compute_m_n(crtc_state, local_bw_overhead, link_bpp_x16, &crtc_state->dp_m_n);

drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -0
+		intel_dp_compute_min_hblank(link_bpp_x16, crtc_state,

conn_state,

Quoted 1 line

+dsc);

Quoted 8 lines
Quoted 5 lines

Also I wanted to check if this is the right place to call intel_dp_compute_min_hblank()? Can't this be called once we settle a link_bpp. May be from mst_stream_compute_config() before calling intel_dp_audio_compute_config(). @Imre pls comment.

Here the calculation is done as part of the m and n calculation and this function is called from mst_stream_compute_config and is done before dp_audio_compute_config().
Let me know if any change required will do.

Why do we need to do this at this point where we iterate through for each bpp_x16 "for (bpp_x16 = max_bpp_x16; bpp_x16 >= min_bpp_x16; bpp_x16 -= bpp_step_x16) {" as it doesn't influence any decision on in this loop!

BR
Vinod

Quoted 81 lines
Quoted 17 lines

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct

Quoted 5 lines

  if (is_mst) {
  int remote_bw_overhead;

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -998,7 +977,6 @@ static void mst_stream_disable(struct

intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
  	struct intel_dp *intel_dp = to_primary_dp(encoder);

  struct intel_connector *connector = to_intel_connector(old_conn_state->connector);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -1
-	enum transcoder trans = old_crtc_state->cpu_transcoder;

  drm_dbg_kms(display->drm, "active links %d\n", intel_dp->mst.active_links);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -1009,9 +987,6 @@ static void mst_stream_disable(struct

intel_atomic_state *state,

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
  	intel_hdcp_disable(intel_mst->connector);
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_disable(struct intel_atomic_state *state, · line 1014

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -3
  	intel_dp_sink_disable_decompression(state, connector,
 old_crtc_state);
-
-	if (DISPLAY_VER(display) >= 20)
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans), 0);

After removing this, "display" is not used anymore in this function. So need to get rid of unused local variable display as well.

There is a drm_dbg_kms which used the struct display. Let me try rebasing with the latest drm-tip.

Thanks and Regards,
Arun R Murthy
--------------------

Quoted 49 lines

BR
Vinod

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_enable(struct

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
  }
 

 static void mst_stream_post_disable(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -1286,7 +1261,7 @@ static void mst_stream_enable(struct

intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c static void mst_stream_enable(struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
  	enum transcoder trans = pipe_config->cpu_transcoder;
  	bool first_mst_stream = intel_dp->mst.active_links == 1;
  	struct intel_crtc *pipe_crtc;
-	int ret, i, min_hblank;
+	int ret, i;
 
  	drm_WARN_ON(display->drm, pipe_config->has_pch_encoder);
 
@@ -1301,29 +1276,6 @@ static void mst_stream_enable(struct

intel_atomic_state *state,

Quoted 1 line

         TRANS_DP2_VFREQ_PIXEL_CLOCK(crtc_clock_hz &

0xffffff));

Quoted 29 lines

  }

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -23
-	if (DISPLAY_VER(display) >= 20) {
-		/*
-		 * adjust the BlankingStart/BlankingEnd framing control from
-		 * the calculated value
-		 */
-		min_hblank = pipe_config->min_hblank - 2;
-
-		/* Maximum value to be programmed is limited to 0x10 */
-		min_hblank = min(0x10, min_hblank);
-
-		/*
-		 * Minimum hblank accepted for 128b/132b would be 5 and for
-		 * 8b/10b would be 3 symbol count
-		 */
-		if (intel_dp_is_uhbr(pipe_config))
-			min_hblank = max(min_hblank, 5);
-		else
-			min_hblank = max(min_hblank, 3);
-
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans),
-			       min_hblank);
-	}
-

  enable_bs_jitter_was(pipe_config);

  intel_ddi_enable_transcoder_func(encoder, pipe_config);

#10 lore raw

Re: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Quoted 19 lines · Vinod

[...]

Quoted 10 lines
Quoted 10 lines

+3263,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,

Quoted 9 lines

         &pipe_config->dp_m_n); }

drivers/gpu/drm/i915/display/intel_dp.c +3 -0
+	intel_dp_compute_min_hblank(link_bpp_x16, pipe_config, conn_state,
+				    pipe_config->dsc.compression_enable);
+

  /* FIXME: abstract this better */
  if (pipe_config->splitter.enable) pipe_config->dp_m_n.data_m *= pipe_config->splitter.link_count;

[...]

Quoted 4 lines
Quoted 4 lines
(quoted diff) +0 -0
@@ -301,12 +281,11 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
 >  		local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
 >  							     false, dsc_slice_count, link_bpp_x16);
Quoted 1 line
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -2
-		intel_dp_mst_compute_min_hblank(crtc_state, link_bpp_x16);
-

  intel_dp_mst_compute_m_n(crtc_state, local_bw_overhead,

Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_dp_mst.c int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp, · line 288

Quoted 3 lines

  link_bpp_x16, &crtc_state->dp_m_n);

drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -0
+		intel_dp_compute_min_hblank(link_bpp_x16, crtc_state, conn_state, dsc);

Also I wanted to check if this is the right place to call intel_dp_compute_min_hblank()? Can't this be called once we settle a link_bpp. May be from mst_stream_compute_config() before calling intel_dp_audio_compute_config(). @Imre pls comment.

Yes, it would be better not to recompute the min_hblank value for each bpp. So just moving intel_dp_compute_min_hblank() before intel_vrr_compute_config() in mst_stream_compute_config(), similarly how this is done for the SST case above in intel_dp_compute_config().

Quoted 12 lines
Quoted 4 lines

Here the calculation is done as part of the m and n calculation and this function is called from mst_stream_compute_config and is done before dp_audio_compute_config(). Let me know if any change required will do.

Why do we need to do this at this point where we iterate through for each bpp_x16 "for (bpp_x16 = max_bpp_x16; bpp_x16 >= min_bpp_x16; bpp_x16 -= bpp_step_x16) {" as it doesn't influence any decision on in this loop!

BR
Vinod

#11 lore raw

RE: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

In reply to Arun R Murthy
Quoted 94 lines

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Arun R Murthy
Sent: Thursday, April 17, 2025 4:23 PM
To: [email protected]; [email protected]; intel- [email protected]
Cc: Govindapillai, Vinod <[email protected]>; Deak, Imre <[email protected]>; Murthy, Arun R <[email protected]>
Subject: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Minimum HBlank is programmed to address jitter for high resolutions with high refresh rates that have small Hblank, specifically where Hblank is smaller than one MTP.

TODO: Add the min_hblank calculation for hdmi as well.

v2: move from intel_audio.c to intel_dp.c
some correction in link_bpp_x16 (Imre)
v3: min_hblank for 8b/10b MST and 128b/132b SST/MST
handle error for intel_dp_mst_dsc_get_slice_count reset min_hblank before disabling transcoder (Imre)

---
 drivers/gpu/drm/i915/display/intel_display.c | 18 ++++++++
 drivers/gpu/drm/i915/display/intel_dp.c      | 64
++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.h      |  4 ++
 drivers/gpu/drm/i915/display/intel_dp_mst.c  | 52 +---------------------
 4 files changed, 88 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0

index dc7517da2ed5c75fb1715d43e6bfc792a8420f30..ad41382981299dffab5cc592b4 3cdab7eebb7b5b 100644

drivers/gpu/drm/i915/display/intel_display.c +3 -0
@@ -1782,8 +1782,11 @@ static void hsw_crtc_disable(struct
 intel_atomic_state *state,
 	const struct intel_crtc_state *old_crtc_state =
 		intel_atomic_get_old_crtc_state(state, crtc);
 	struct intel_crtc *pipe_crtc;
+	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
 	int i;
 
+	if (DISPLAY_VER(display) >= 30)
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),
 0);
 	/*
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 	 * FIXME collapse everything to one hook.
 	 * Need care with mst->ddi interactions.
@@ -2726,6 +2729,19 @@ static void intel_set_transcoder_timings(const

struct intel_crtc_state *crtc_sta

drivers/gpu/drm/i915/display/intel_display.c +13 -0
 		intel_de_write(display, TRANS_VTOTAL(display, pipe),
 			       VACTIVE(crtc_vdisplay - 1) |
 			       VTOTAL(crtc_vtotal - 1));
+
+	if (DISPLAY_VER(display) >= 30 && crtc_state->min_hblank) {
+		/*
+		 * Address issues for resolutions with high refresh rate that
+		 * have small Hblank, specifically where Hblank is smaller than
+		 * one MTP. Simulations indicate this will address the
+		 * jitter issues that currently causes BS to be immediately
+		 * followed by BE which DPRX devices are unable to handle.
+		 * https://groups.vesa.org/wg/DP/document/20494
+		 */
+		intel_de_write(display, DP_MIN_HBLANK_CTL(cpu_transcoder),
+			       crtc_state->min_hblank);
+	}
 }
 
 static void intel_set_transcoder_timings_lrr(const struct intel_crtc_state

*crtc_state) @@ -5221,6 +5237,8 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,

drivers/gpu/drm/i915/display/intel_display.c +2 -0
 	PIPE_CONF_CHECK_I(lane_count);
 	PIPE_CONF_CHECK_X(lane_lat_optim_mask);
 
+	PIPE_CONF_CHECK_I(min_hblank);
+
 	if (HAS_DOUBLE_BUFFERED_M_N(display)) {
 		if (!fastset || !pipe_config->update_m_n)
 			PIPE_CONF_CHECK_M_N(dp_m_n);
drivers/gpu/drm/i915/display/intel_dp.c +0 -0

index 7b95d62730e6f0c27c07fb59f16476369c4762a4..7b114b7cc86cc78088ca27e2cb 7b08b8491d8283 100644

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct · line 3112

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +6 -0
@@ -3103,6 +3103,67 @@ intel_dp_queue_modeset_retry_for_link(struct
 intel_atomic_state *state,
 	}
 }
 
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc)
+{
+	struct intel_display *display = to_intel_display(crtc_state);

Not needed.

Quoted 52 lines
drivers/gpu/drm/i915/display/intel_dp.c +19 -0
+	const struct drm_display_mode *adjusted_mode =
+					&crtc_state->hw.adjusted_mode;
+	struct intel_connector *connector = to_intel_connector(conn_state-
 >connector);
+	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
+	/*
+	 * min symbol cycles is 3(BS,VBID, BE) for 128b/132b and
+	 * 5(BS, VBID, MVID, MAUD) for 8b/10b
+	 */
+	int min_sym_cycles = intel_dp_is_uhbr(crtc_state) ? 3 : 5;
+	bool is_mst = intel_crtc_has_type(crtc_state,
 INTEL_OUTPUT_DP_MST);
+	int min_hblank;
+	int max_lane_count = 4;
+	int hactive_sym_cycles, htotal_sym_cycles;
+	int dsc_slices = 0;
+
+	if (DISPLAY_VER(display) < 30)
+		return;
+
+	/* MIN_HBLANK should be set only for 8b/10b MST or for 128b/132b

SST/MST */

drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	if (intel_dp_is_uhbr(crtc_state) || (is_mst &&

!intel_dp_is_uhbr(crtc_state)))

drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+		return;
+
+	if (is_dsc) {
+		dsc_slices = intel_dp_mst_dsc_get_slice_count(connector,
+							      crtc_state);
+		if (!dsc_slices) {
+			drm_dbg(display->drm, "failed to calculate dsc slice

count\n");

drivers/gpu/drm/i915/display/intel_dp.c +5 -0
+			return;
+		}
+	}
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	hactive_sym_cycles =

drm_dp_link_data_symbol_cycles(max_lane_count,

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

hdisplay,

drivers/gpu/drm/i915/display/intel_dp.c +9 -0
+							    link_bpp_x16,
+							    symbol_size,
+							    is_mst,
+							    dsc_slices);
+	htotal_sym_cycles = adjusted_mode->htotal *
+			    (hactive_sym_cycles / adjusted_mode->hdisplay);
+
+	min_hblank = htotal_sym_cycles - hactive_sym_cycles;
+	/* minimum Hblank calculation:

https://groups.vesa.org/wg/DP/document/20494 */

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3155

Quoted 1 line
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	min_hblank = max(min_hblank, min_sym_cycles);

From the solution I see the way to calculate min hblank as
HACT_ML_SYM_CYC_CNT = CEIL(CEIL(HACT_WIDTH / 4) × PIX_BPP / SYMBOL_SIZE) × 4 / PHY_LANE_CNT HBLNK_ML_SYM_CYC_CNT = CEIL(CEIL(HBLNK_WIDTH / 4) × PIX_BPP / SYMBOL_SIZE) × 4 / PHY_LANE_CNT HTOTAL_ML_SYM_CYC_CNT = HACT_ML_SYM_CYC_CNT+ HBLNK_ML_SYM_CYC_CNT
EFF_PIX_BPP = HTOTAL_ML_SYM_CYC_CNT × SYMBOL_SIZE × PHY_LANE_CNT / HTOTAL_WIDTH

Which is similar to how we calculate hactive_sym_cycles so lets use drm_dp_link_data_symbol_cycles and pass htotal-hdisplay to get min hblank we wont need to calculate htotal sym cycles that way too

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3163

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+	/*
+	 * adjust the BlankingStart/BlankingEnd framing control from
+	 * the calculated value
+	 */
+	min_hblank = min_hblank - 2;
+
+	min_hblank = min(10, min_hblank);

Is this 10 or 0x10 since previously 0x10 was coded in

Regards,
Suraj Kandpal

Quoted 154 lines
drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+	crtc_state->min_hblank = min_hblank;
+}
+
 int
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config, @@ -3202,6
+3263,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 				       &pipe_config->dp_m_n);
 	}
 
+	intel_dp_compute_min_hblank(link_bpp_x16, pipe_config, conn_state,
+				    pipe_config->dsc.compression_enable);
+
 	/* FIXME: abstract this better */
 	if (pipe_config->splitter.enable)
 		pipe_config->dp_m_n.data_m *= pipe_config-
Quoted 1 line

splitter.link_count; diff --git a/drivers/gpu/drm/i915/display/intel_dp.h

b/drivers/gpu/drm/i915/display/intel_dp.h
index 9189db4c25946a0f082223ce059c242e80cc32dc..43624aead998a8a330a244bb9 c85f026e203171b 100644

drivers/gpu/drm/i915/display/intel_dp.h +0 -0
@@ -208,5 +208,9 @@ bool intel_dp_has_connector(struct intel_dp *intel_dp,
 			    const struct drm_connector_state *conn_state);  int

intel_dp_dsc_max_src_input_bpc(struct intel_display *display); int intel_dp_dsc_min_src_input_bpc(void);

drivers/gpu/drm/i915/display/intel_dp.h +4 -0
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc);
 
 #endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0

index af98a0d0e8376a79ce1ab6ff3c4f6af30f4d3e73..4153afa13c618bb4db6dbcdc6e5 9faddcbeade6b 100644

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -13
@@ -211,26 +211,6 @@ int intel_dp_mst_dsc_get_slice_count(const struct
 intel_connector *connector,
 					    num_joined_pipes);
 }
 
-static void intel_dp_mst_compute_min_hblank(struct intel_crtc_state
 *crtc_state,
-					    int bpp_x16)
-{
-	struct intel_display *display = to_intel_display(crtc_state);
-	const struct drm_display_mode *adjusted_mode =
-					&crtc_state->hw.adjusted_mode;
-	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
-	int hblank;
-
-	if (DISPLAY_VER(display) < 20)
-		return;
-
-	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -2
-	hblank = DIV_ROUND_UP((DIV_ROUND_UP
-			       (adjusted_mode->htotal - adjusted_mode-
Quoted 1 line

hdisplay, 4) * bpp_x16),

drivers/gpu/drm/i915/display/intel_dp_mst.c +2 -8
-			      symbol_size);
-
-	crtc_state->min_hblank = hblank;
-}
-
 int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
 				   struct intel_crtc_state *crtc_state,
 				   struct drm_connector_state *conn_state,
@@ -301,12 +281,11 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp
 *intel_dp,
 		local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
 							     false,
 dsc_slice_count, link_bpp_x16);
 
-		intel_dp_mst_compute_min_hblank(crtc_state, link_bpp_x16);
-
 		intel_dp_mst_compute_m_n(crtc_state,
 					 local_bw_overhead,
 					 link_bpp_x16,
 					 &crtc_state->dp_m_n);
+		intel_dp_compute_min_hblank(link_bpp_x16, crtc_state,
 conn_state,
+dsc);
 
 		if (is_mst) {
 			int remote_bw_overhead;
@@ -998,7 +977,6 @@ static void mst_stream_disable(struct
 intel_atomic_state *state,
 	struct intel_dp *intel_dp = to_primary_dp(encoder);
 	struct intel_connector *connector =
 		to_intel_connector(old_conn_state->connector);
-	enum transcoder trans = old_crtc_state->cpu_transcoder;
 
 	drm_dbg_kms(display->drm, "active links %d\n",
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -3
 		    intel_dp->mst.active_links);
@@ -1009,9 +987,6 @@ static void mst_stream_disable(struct
 intel_atomic_state *state,
 	intel_hdcp_disable(intel_mst->connector);
 
 	intel_dp_sink_disable_decompression(state, connector, old_crtc_state);
-
-	if (DISPLAY_VER(display) >= 20)
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans), 0);
 }
 

static void mst_stream_post_disable(struct intel_atomic_state *state, @@ -
1286,7 +1261,7 @@ static void mst_stream_enable(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -24
 	enum transcoder trans = pipe_config->cpu_transcoder;
 	bool first_mst_stream = intel_dp->mst.active_links == 1;
 	struct intel_crtc *pipe_crtc;
-	int ret, i, min_hblank;
+	int ret, i;
 
 	drm_WARN_ON(display->drm, pipe_config->has_pch_encoder);
@@ -1301,29 +1276,6 @@ static void mst_stream_enable(struct
 intel_atomic_state *state,
 			       TRANS_DP2_VFREQ_PIXEL_CLOCK(crtc_clock_hz &
 0xffffff));
 	}
 
-	if (DISPLAY_VER(display) >= 20) {
-		/*
-		 * adjust the BlankingStart/BlankingEnd framing control from
-		 * the calculated value
-		 */
-		min_hblank = pipe_config->min_hblank - 2;
-
-		/* Maximum value to be programmed is limited to 0x10 */
-		min_hblank = min(0x10, min_hblank);
-
-		/*
-		 * Minimum hblank accepted for 128b/132b would be 5 and for
-		 * 8b/10b would be 3 symbol count
-		 */
-		if (intel_dp_is_uhbr(pipe_config))
-			min_hblank = max(min_hblank, 5);
-		else
-			min_hblank = max(min_hblank, 3);
-
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans),
-			       min_hblank);
-	}
-
 	enable_bs_jitter_was(pipe_config);

intel_ddi_enable_transcoder_func(encoder, pipe_config);

--
2.25.1

#12 lore raw

Re: [PATCH v3 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c

Quoted 10 lines · Suraj

[...]

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dp.c +5 -0
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc)
+{
 
[...]
Quoted 10 lines

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3151

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +10 -0
+
+	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST & 128b/132b */
+	hactive_sym_cycles = drm_dp_link_data_symbol_cycles(max_lane_count,
+							    adjusted_mode->hdisplay,
+							    link_bpp_x16,
+							    symbol_size,
+							    is_mst,
+							    dsc_slices);
+	htotal_sym_cycles = adjusted_mode->htotal *
+			    (hactive_sym_cycles / adjusted_mode->hdisplay);

Here the ( ) around the divisor should be dropped for the div-round-down by adjusted_mode->hdisplay to work as expected.

Quoted 12 lines

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3155

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp.c +3 -0
+
+	min_hblank = htotal_sym_cycles - hactive_sym_cycles;
+	/* minimum Hblank calculation:

https://groups.vesa.org/wg/DP/document/20494 */

drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+	min_hblank = max(min_hblank, min_sym_cycles);

From the solution I see the way to calculate min hblank as
HACT_ML_SYM_CYC_CNT = CEIL(CEIL(HACT_WIDTH / 4) × PIX_BPP / SYMBOL_SIZE) × 4 / PHY_LANE_CNT HBLNK_ML_SYM_CYC_CNT = CEIL(CEIL(HBLNK_WIDTH / 4) × PIX_BPP / SYMBOL_SIZE) × 4 / PHY_LANE_CNT HTOTAL_ML_SYM_CYC_CNT = HACT_ML_SYM_CYC_CNT+ HBLNK_ML_SYM_CYC_CNT
EFF_PIX_BPP = HTOTAL_ML_SYM_CYC_CNT × SYMBOL_SIZE × PHY_LANE_CNT / HTOTAL_WIDTH

Quoted 2 lines

Which is similar to how we calculate hactive_sym_cycles so lets use drm_dp_link_data_symbol_cycles and pass htotal-hdisplay to get min hblank we wont need to calculate htotal sym cycles that way too

That would be calculating EFF_HBLNK_ML_SYM_CYC_CNT (or the LL version of this), so a different value than MIN_HBLNK_LL_SYM_CYC_CNT. The latter is based on a rounded-down htotal_sym_cycles value, see:

MIN_HBLNK_LL_SYM_CYC_CNT_128B132B_DPTX
= MAX((FLOOR(HTOTAL_WIDTH × EFF_PIX_BPP / (4 × SYMBOL_SIZE))
– HACT_LL_SYM_CYC_CNT), 3)

Using the

EFF_PIX_BPP
= HACT_ML_SYM_CYC_CNT × SYMBOL_SIZE × PHY_LANE_CNT / HACT_WIDTH

equation in the standard, this matches the above way in the patch calculating htotal_sym_cycles, subtracting hactive_sym_cycles from it.

Quoted 168 lines

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3163

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+	/*
+	 * adjust the BlankingStart/BlankingEnd framing control from
+	 * the calculated value
+	 */
+	min_hblank = min_hblank - 2;
+
+	min_hblank = min(10, min_hblank);

Is this 10 or 0x10 since previously 0x10 was coded in

Regards,
Suraj Kandpal

Quoted 154 lines
drivers/gpu/drm/i915/display/intel_dp.c +7 -0
+	crtc_state->min_hblank = min_hblank;
+}
+
 int
 intel_dp_compute_config(struct intel_encoder *encoder,
 			struct intel_crtc_state *pipe_config, @@ -3202,6
+3263,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 				       &pipe_config->dp_m_n);
 	}
 
+	intel_dp_compute_min_hblank(link_bpp_x16, pipe_config, conn_state,
+				    pipe_config->dsc.compression_enable);
+
 	/* FIXME: abstract this better */
 	if (pipe_config->splitter.enable)
 		pipe_config->dp_m_n.data_m *= pipe_config-
Quoted 1 line

splitter.link_count; diff --git a/drivers/gpu/drm/i915/display/intel_dp.h

b/drivers/gpu/drm/i915/display/intel_dp.h
index 9189db4c25946a0f082223ce059c242e80cc32dc..43624aead998a8a330a244bb9 c85f026e203171b 100644

drivers/gpu/drm/i915/display/intel_dp.h +0 -0
@@ -208,5 +208,9 @@ bool intel_dp_has_connector(struct intel_dp *intel_dp,
 			    const struct drm_connector_state *conn_state);  int

intel_dp_dsc_max_src_input_bpc(struct intel_display *display); int intel_dp_dsc_min_src_input_bpc(void);

drivers/gpu/drm/i915/display/intel_dp.h +4 -0
+void intel_dp_compute_min_hblank(int link_bpp_x16,
+				 struct intel_crtc_state *crtc_state,
+				 struct drm_connector_state *conn_state,
+				 bool is_dsc);
 
 #endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0

index af98a0d0e8376a79ce1ab6ff3c4f6af30f4d3e73..4153afa13c618bb4db6dbcdc6e5 9faddcbeade6b 100644

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -13
@@ -211,26 +211,6 @@ int intel_dp_mst_dsc_get_slice_count(const struct
 intel_connector *connector,
 					    num_joined_pipes);
 }
 
-static void intel_dp_mst_compute_min_hblank(struct intel_crtc_state
 *crtc_state,
-					    int bpp_x16)
-{
-	struct intel_display *display = to_intel_display(crtc_state);
-	const struct drm_display_mode *adjusted_mode =
-					&crtc_state->hw.adjusted_mode;
-	int symbol_size = intel_dp_is_uhbr(crtc_state) ? 32 : 8;
-	int hblank;
-
-	if (DISPLAY_VER(display) < 20)
-		return;
-
-	/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST

& 128b/132b */

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -2
-	hblank = DIV_ROUND_UP((DIV_ROUND_UP
-			       (adjusted_mode->htotal - adjusted_mode-
Quoted 1 line

hdisplay, 4) * bpp_x16),

drivers/gpu/drm/i915/display/intel_dp_mst.c +2 -8
-			      symbol_size);
-
-	crtc_state->min_hblank = hblank;
-}
-
 int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
 				   struct intel_crtc_state *crtc_state,
 				   struct drm_connector_state *conn_state,
@@ -301,12 +281,11 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp
 *intel_dp,
 		local_bw_overhead = intel_dp_mst_bw_overhead(crtc_state,
 							     false,
 dsc_slice_count, link_bpp_x16);
 
-		intel_dp_mst_compute_min_hblank(crtc_state, link_bpp_x16);
-
 		intel_dp_mst_compute_m_n(crtc_state,
 					 local_bw_overhead,
 					 link_bpp_x16,
 					 &crtc_state->dp_m_n);
+		intel_dp_compute_min_hblank(link_bpp_x16, crtc_state,
 conn_state,
+dsc);
 
 		if (is_mst) {
 			int remote_bw_overhead;
@@ -998,7 +977,6 @@ static void mst_stream_disable(struct
 intel_atomic_state *state,
 	struct intel_dp *intel_dp = to_primary_dp(encoder);
 	struct intel_connector *connector =
 		to_intel_connector(old_conn_state->connector);
-	enum transcoder trans = old_crtc_state->cpu_transcoder;
 
 	drm_dbg_kms(display->drm, "active links %d\n",
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -3
 		    intel_dp->mst.active_links);
@@ -1009,9 +987,6 @@ static void mst_stream_disable(struct
 intel_atomic_state *state,
 	intel_hdcp_disable(intel_mst->connector);
 
 	intel_dp_sink_disable_decompression(state, connector, old_crtc_state);
-
-	if (DISPLAY_VER(display) >= 20)
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans), 0);
 }
 

static void mst_stream_post_disable(struct intel_atomic_state *state, @@ -
1286,7 +1261,7 @@ static void mst_stream_enable(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -24
 	enum transcoder trans = pipe_config->cpu_transcoder;
 	bool first_mst_stream = intel_dp->mst.active_links == 1;
 	struct intel_crtc *pipe_crtc;
-	int ret, i, min_hblank;
+	int ret, i;
 
 	drm_WARN_ON(display->drm, pipe_config->has_pch_encoder);
@@ -1301,29 +1276,6 @@ static void mst_stream_enable(struct
 intel_atomic_state *state,
 			       TRANS_DP2_VFREQ_PIXEL_CLOCK(crtc_clock_hz &
 0xffffff));
 	}
 
-	if (DISPLAY_VER(display) >= 20) {
-		/*
-		 * adjust the BlankingStart/BlankingEnd framing control from
-		 * the calculated value
-		 */
-		min_hblank = pipe_config->min_hblank - 2;
-
-		/* Maximum value to be programmed is limited to 0x10 */
-		min_hblank = min(0x10, min_hblank);
-
-		/*
-		 * Minimum hblank accepted for 128b/132b would be 5 and for
-		 * 8b/10b would be 3 symbol count
-		 */
-		if (intel_dp_is_uhbr(pipe_config))
-			min_hblank = max(min_hblank, 5);
-		else
-			min_hblank = max(min_hblank, 3);
-
-		intel_de_write(display, DP_MIN_HBLANK_CTL(trans),
-			       min_hblank);
-	}
-
 	enable_bs_jitter_was(pipe_config);

intel_ddi_enable_transcoder_func(encoder, pipe_config);

--
2.25.1

#13 lore raw

✗ Fi.CI.BUILD: failure for Rework/Correction on minimum hblank calculation (rev3)

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

== Series Details ==

Series: Rework/Correction on minimum hblank calculation (rev3)
URL : https://patchwork.freedesktop.org/series/147361/
State : failure

== Summary ==

Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] drivers/gpu/drm/i915/display/intel_dp_mst.o
drivers/gpu/drm/i915/display/intel_dp_mst.c: In function ‘mst_stream_disable’:
drivers/gpu/drm/i915/display/intel_dp_mst.c:1003:31: error: unused variable ‘display’ [-Werror=unused-variable]
1003 | struct intel_display *display = to_intel_display(state);
| ^~~~~~~
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:203: drivers/gpu/drm/i915/display/intel_dp_mst.o] Error 1 make[5]: *** [scripts/Makefile.build:461: drivers/gpu/drm/i915] Error 2
make[4]: *** [scripts/Makefile.build:461: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:461: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:461: drivers] Error 2
make[1]: *** [/home/kbuild2/kernel/Makefile:2009: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Build failed, no error log produced

#14 lore raw

✗ CI.Patch_applied: failure for Rework/Correction on minimum hblank calculation (rev3)

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

== Series Details ==

Series: Rework/Correction on minimum hblank calculation (rev3)
URL : https://patchwork.freedesktop.org/series/147360/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 830407db6fa5 drm-tip: 2025y-04m-17d-09h-30m-40s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/i915/display/intel_dp_mst.c:998
error: drivers/gpu/drm/i915/display/intel_dp_mst.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/display/dp: Export fn to calculate link symbol cycles
Applying: drm/i915/display: export function to count dsc slices
Applying: drm/i915/display: move min_hblank from dp_mst.c to dp.c
Patch failed at 0003 drm/i915/display: move min_hblank from dp_mst.c to dp.c 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".