On Tue, Apr 08, 2025 at 09:40:34AM +0530, Arun R Murthy wrote:
> Link symbol cycles are required for the calculation of the minimum
> HBlank calculation.
> 
> Signed-off-by: Arun R Murthy <arun.r.mur...@intel.com>
> ---
>  drivers/gpu/drm/display/drm_dp_helper.c | 10 ++++++----
>  include/drm/display/drm_dp_helper.h     |  5 +++++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/display/drm_dp_helper.c 
> b/drivers/gpu/drm/display/drm_dp_helper.c
> index 
> 57828f2b7b5a0582ca4a6f2a9be2d5909fe8ad24..488aaef61e3aa8b25975dfc98cbccdf5b7f083f8
>  100644
> --- a/drivers/gpu/drm/display/drm_dp_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> @@ -4393,17 +4393,18 @@ 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 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);
>  }
> +EXPORT_SYMBOL(drm_dp_link_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_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,

Could you simplify this i/f by calculating the DSC/non-DSC specific
symbol count based on whether the passed in dsc_slice_count is non-zero
or zero respectively (renaming this function to drm_dp_link_symbol_cycles() and 
the
original drm_dp_link_symbol_cycles() to stg else)?

That way you'd need to export only one function and drm_dp_bw_overhead()
would also get simplified.

> @@ -4412,6 +4413,7 @@ static int drm_dp_link_dsc_symbol_cycles(int 
> lane_count, int pixels, int slice_c
>  
>       return slice_count * (slice_data_cycles + slice_eoc_cycles);
>  }
> +EXPORT_SYMBOL(drm_dp_link_dsc_symbol_cycles);
>  
>  /**
>   * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream
> diff --git a/include/drm/display/drm_dp_helper.h 
> b/include/drm/display/drm_dp_helper.h
> index 
> d9614e2c89397536f44bb7258e894628ae1dccc9..f6bfa3b74810438b837540dccb08a987bcdb5d03
>  100644
> --- a/include/drm/display/drm_dp_helper.h
> +++ b/include/drm/display/drm_dp_helper.h
> @@ -972,4 +972,9 @@ 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 drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int 
> slice_count,
> +                               int bpp_x16, int symbol_size, bool is_mst);
> +
>  #endif /* _DRM_DP_HELPER_H_ */
> 
> -- 
> 2.25.1
> 

Reply via email to