Rework/Correction on minimum hblank calculation
v2 cover Rework/Correction on minimum hblank calculation
---
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 | 47 ++++++++++++------------ drivers/gpu/drm/i915/display/intel_audio.c | 7 ++++ drivers/gpu/drm/i915/display/intel_display.c | 19 ++++++++++ drivers/gpu/drm/i915/display/intel_dp.c | 47 ++++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 55 ++-------------------------- drivers/gpu/drm/i915/display/intel_dp_mst.h | 3 ++ include/drm/display/drm_dp_helper.h | 3 ++ 7 files changed, 105 insertions(+), 76 deletions(-)
---
base-commit: c4fc93b0ec49f4b0105c142502b7d1d5de379950
change-id: 20250407-hblank-49b340aeba31
Best regards,
Signature · 1 line
Arun R Murthy <[email protected]>
PATCH v2 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)
--- drivers/gpu/drm/display/drm_dp_helper.c | 47 ++++++++++++++++----------------- include/drm/display/drm_dp_helper.h | 3 +++ 2 files changed, 26 insertions(+), 24 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +23 -24
@@ -4393,25 +4393,30 @@ 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) +/** +* drm_dp_link_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_symbol_cycles (int lane_count,int pixels,int bpp_x16, +int symbol_size,bool is_mst,int slice_count) { -int cycles =DIV_ROUND_UP (pixels * bpp_x16,16 * symbol_size * lane_count); +int pix = slice_count ?DIV_ROUND_UP (pixels, slice_count) : pixels; +int cycles =DIV_ROUND_UP (pix * bpp_x16,16 * symbol_size * lane_count);int align = is_mst ?4 / lane_count :1 ; +int slice_data_cycles =ALIGN (cycles, align); -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); -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 + align)) : + slice_data_cycles; } +EXPORT_SYMBOL (drm_dp_link_symbol_cycles);/** * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream
@@ -4486,15 +4491,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_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 +3 -0
@@ -972,4 +972,7 @@ 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_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
Re: [PATCH v2 1/3] drm/display/dp: Export fn to calculate link symbol cycles
Quoted 47 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)
Signed-off-by Arun R Murthy <[email protected]>--- drivers/gpu/drm/display/drm_dp_helper.c | 47 ++++++++++++++++----------------- include/drm/display/drm_dp_helper.h | 3 +++ 2 files changed, 26 insertions(+), 24 deletions(-)drivers/gpu/drm/display/drm_dp_helper.c +17
-7@@ -4393,25 +4393,30 @@ 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) +/** +* drm_dp_link_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_symbol_cycles (int lane_count,int pixels,int bpp_x16, +int symbol_size,bool is_mst,int slice_count) { -int cycles =DIV_ROUND_UP (pixels * bpp_x16,16 * symbol_size * lane_count); +int pix = slice_count ?DIV_ROUND_UP (pixels, slice_count) : pixels; +int cycles =DIV_ROUND_UP (pix * bpp_x16,16 * symbol_size * lane_count);int align = is_mst ?4 / lane_count :1 ; +int slice_data_cycles =ALIGN (cycles, align); -return ALIGN (cycles, align); -} - -static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int slice_count,
drivers/gpu/drm/display/drm_dp_helper.c EXPORT_SYMBOL(drm_panel_dp_aux_backlight); · line 4417
Quoted 10 lines
drivers/gpu/drm/display/drm_dp_helper.c +2
-8- 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); -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 + align)) : + slice_data_cycles;
I'd like to preserve in the code what the DSC EOC cycles are and the way the data symbol cycles are calculated could be kept as-is. So could you instead do the following, renaming drm_dp_link_symbol_cycles() to drm_dp_link_data_symbol_cycles()?:
-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 40 lines
drivers/gpu/drm/display/drm_dp_helper.c +4
-9} +EXPORT_SYMBOL (drm_dp_link_symbol_cycles);/** * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream @@ -4486,15 +4491,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_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 +3
-0@@ -972,4 +972,7 @@ 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_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
PATCH v2 2/3 drm/i915/display: export function to count dsc slices
In reply to Arun R MurthyExport 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
@@ -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
@@ -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
PATCH v2 3/3 drm/i915/display: move min_hblank from dp_mst.c to dp.c
In reply to Arun R MurthyMinimum 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)
--- drivers/gpu/drm/i915/display/intel_audio.c | 7 ++++ drivers/gpu/drm/i915/display/intel_display.c | 19 +++++++++++ drivers/gpu/drm/i915/display/intel_dp.c | 47 +++++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 51 +--------------------------- 4 files changed, 74 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/display/intel_audio.c +7 -0
@@ -27,9 +27,11 @@#include <drm/drm_edid.h> #include <drm/drm_eld.h> #include <drm/drm_fixed.h> +#include <drm/display/drm_dp_helper.h> #include <drm/intel/i915_component.h> #include "i915_drv.h" +#include "i915_reg.h" #include "intel_atomic.h" #include "intel_audio.h" #include "intel_audio_regs.h"
@@ -37,6 +39,8 @@#include "intel_crtc.h" #include "intel_de.h" #include "intel_display_types.h" +#include "intel_dp.h" +#include "intel_dp_mst.h" #include "intel_lpe_audio.h" /**
@@ -715,6 +719,7 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,memcpy (crtc_state->eld, connector->eld,sizeof (crtc_state->eld)); crtc_state->eld[6 ] =drm_av_sync_delay (connector, adjusted_mode) /2 ; +mutex_unlock (&connector->eld_mutex);return true;
@@ -778,6 +783,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,intel_lpe_audio_notify (display, cpu_transcoder, port, crtc_state->eld, crtc_state->port_clock,intel_crtc_has_dp_encoder (crtc_state)); + }/**
@@ -834,6 +840,7 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, }intel_lpe_audio_notify (display, cpu_transcoder, port,NULL ,0 , false); + } static void intel_acomp_get_config(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_display.c +19 -0
@@ -1782,6 +1782,7 @@ 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;/*
@@ -1797,6 +1798,9 @@ static void hsw_crtc_disable(struct intel_atomic_state *state,for_each_pipe_crtc_modeset_disable (display, pipe_crtc, old_crtc_state, i)intel_dmc_disable_pipe (display, pipe_crtc->pipe); + +if (DISPLAY_VER (display) >=30 ) +intel_de_write (display,DP_MIN_HBLANK_CTL (cpu_transcoder),0 ); }/* Prefer intel_encoder_is_combo() */
@@ -2726,6 +2730,19 @@ static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_staintel_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 +5238,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 +47 -0
59 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -50
87 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v2 3/3] drm/i915/display: move min_hblank from dp_mst.c to dp.c
Quoted 43 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_hblankcalculation for hdmi as well.v2: move from
intel_audio.ctointel_dp.c
some correction inlink_bpp_x16(Imre)Signed-off-by Arun R Murthy <[email protected]>--- drivers/gpu/drm/i915/display/intel_audio.c | 7 ++++ drivers/gpu/drm/i915/display/intel_display.c | 19 +++++++++++ drivers/gpu/drm/i915/display/intel_dp.c | 47 +++++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 51 +--------------------------- 4 files changed, 74 insertions(+), 50 deletions(-)drivers/gpu/drm/i915/display/intel_audio.c +4
-0@@ -27,9 +27,11 @@#include <drm/drm_edid.h> #include <drm/drm_eld.h> #include <drm/drm_fixed.h> +#include <drm/display/drm_dp_helper.h> #include <drm/intel/i915_component.h> #include "i915_drv.h" +#include "i915_reg.h" #include "intel_atomic.h" #include "intel_audio.h" #include "intel_audio_regs.h" @@ -37,6 +39,8 @@#include "intel_crtc.h" #include "intel_de.h" #include "intel_display_types.h" +#include "intel_dp.h" +#include "intel_dp_mst.h" #include "intel_lpe_audio.h" /**
drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 722
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_audio.c +1
-0@@ -715,6 +719,7 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,memcpy (crtc_state->eld, connector->eld,sizeof (crtc_state->eld)); crtc_state->eld[6 ] =drm_av_sync_delay (connector, adjusted_mode) /2 ; +
Extra w/s here and a few more places below.
Quoted 32 lines
drivers/gpu/drm/i915/display/intel_audio.c +2
-0mutex_unlock (&connector->eld_mutex);return true;@@ -778,6 +783,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,intel_lpe_audio_notify (display, cpu_transcoder, port, crtc_state->eld, crtc_state->port_clock,intel_crtc_has_dp_encoder (crtc_state)); + }/** @@ -834,6 +840,7 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, }intel_lpe_audio_notify (display, cpu_transcoder, port,NULL ,0 , false); + } static void intel_acomp_get_config(struct intel_encoder *encoder,drivers/gpu/drm/i915/display/intel_display.c +1
-0@@ -1782,6 +1782,7 @@ 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;/*
drivers/gpu/drm/i915/display/intel_display.c static void hsw_crtc_disable(struct intel_atomic_state *state, · line 1803
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display.c +3
-0@@ -1797,6 +1798,9 @@ static void hsw_crtc_disable(struct intel_atomic_state *state,for_each_pipe_crtc_modeset_disable (display, pipe_crtc, old_crtc_state, i)intel_dmc_disable_pipe (display, pipe_crtc->pipe); + +if (DISPLAY_VER (display) >=30 ) +intel_de_write (display,DP_MIN_HBLANK_CTL (cpu_transcoder),0 );
It's an odd place to program a transcoder register, the transcoder being disabled already. I think we could not zero the register here at all and just program it to 0 or to the computed non-zero value during enabling.
drivers/gpu/drm/i915/display/intel_display.c static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_sta · line 2734
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +2
-0}/* Prefer intel_encoder_is_combo() */ @@ -2726,6 +2730,19 @@ static void intel_set_transcoder_timings(const struct intel_crtc_state *crtc_staintel_de_write (display,TRANS_VTOTAL (display, pipe),VACTIVE (crtc_vdisplay -1 ) |VTOTAL (crtc_vtotal -1 )); + +if (DISPLAY_VER (display) >=30 && crtc_state->min_hblank) {
Following the above the register would be programmed here also if crtc_state->min_hblank is 0.
Quoted 31 lines
drivers/gpu/drm/i915/display/intel_display.c +13
-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)@@ -5221,6 +5238,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 +0
-0@@ -3103,6 +3103,51 @@ intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, } }
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3115
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +10
-0+static void intel_dp_compute_min_hblank (int link_bpp_x16, +struct intel_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{ +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 ; +int min_sym_cycles =intel_dp_is_uhbr (crtc_state) ?3 :5 ;
The clue for what 3 and 5 is still missing. In the 8b/10b case they could be related to the VB-ID, Mvid, Maud symbols, but not sure. Would be good to clarify this from the DP Standard (what symbols are sent in the Hblank period?) or asking the HW people/filing a bspec ticket.
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3121
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_dp.c +6
-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 =intel_dp_mst_dsc_get_slice_count (connector, + crtc_state);
It's better to handle the error return fromintel_dp_mst_dsc_get_slice_count().
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3124
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_dp.c +3
-0+ +if (DISPLAY_VER (display) <30 ) +return ;
MIN_HBLANK should be set only for 8b/10b MST or for 128b/132b SST/MST. Now it would be also set for 8b/10b SST.
Quoted 12 lines
drivers/gpu/drm/i915/display/intel_dp.c +12
-0+ +/* Calculate min Hblank Link Layer Symbol Cycle Count for 8b/10b MST & 128b/132b */ + hactive_sym_cycles =drm_dp_link_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;
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, · line 3146
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +10
-0+/* 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 ; + +/* Maximum value to be programmed is limited to 10 */
No need for the above comment, it's clear already from the code.
drivers/gpu/drm/i915/display/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder, · line 3250
Quoted 12 lines
drivers/gpu/drm/i915/display/intel_dp.c +5
-0+ 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,@@ -3202,6 +3247,8 @@ 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);
intel_dp_compute_conifig() is SST specific, so intel_dp_compute_min_hblank() should be also called from the MST compute config function.
Quoted 105 lines
drivers/gpu/drm/i915/display/intel_dp.c +1
-0+/* 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_mst.c +1
-50@@ -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 */ - 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,@@ -301,8 +281,6 @@ 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,@@ -998,7 +976,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" , intel_dp->mst.active_links);@@ -1009,9 +986,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 +1260,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);@@ -1301,29 +1275,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);Signature · 2 lines
-- 2.25.1
Patchwork
CI✗ CI.Patch_applied: failure for Rework/Correction on minimum hblank calculation (rev2)
In reply to Arun R Murthy== Series Details ==
== Series Details ==
Series: Rework/Correction on minimum hblank calculation (rev2)
URL : https://patchwork.freedesktop.org/series/147360/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 4e52f6bddf99 drm-tip: 2025y-04m-15d-08h-16m-46s 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".
Patchwork
CI✗ Fi.CI.BUILD: failure for Rework/Correction on minimum hblank calculation (rev2)
In reply to Arun R Murthy== Series Details ==
== Series Details ==
Series: Rework/Correction on minimum hblank calculation (rev2)
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.odrivers/gpu/drm/i915/display/intel_dp_mst.c: In function ‘mst_stream_disable’:drivers/gpu/drm/i915/display/intel_dp_mst.c:1002:31: error: unused variable ‘display’ [-Werror=unused-variable]
1002 | 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/kbuild/kernel/Makefile:2009: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Build failed, no error log produced