All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Arun R Murthy <arun.r.murthy@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Cc: imre.deak@intel.com, vinod.govindapillai@intel.com,
	Arun R Murthy <arun.r.murthy@intel.com>
Subject: Re: [PATCH v7 1/2] drm/display/dp: Export fn to calculate link symbol cycles
Date: Mon, 28 Apr 2025 11:57:16 +0300	[thread overview]
Message-ID: <87ikmoy87n.fsf@intel.com> (raw)
In-Reply-To: <20250424-hblank-v7-1-8b002f1506cc@intel.com>

On Thu, 24 Apr 2025, Arun R Murthy <arun.r.murthy@intel.com> wrote:
> 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)
> v4: Expose only drm_dp_link_symbol_cycles() (Imre)
> v6: Add slice pixels which was removed unknowingly (Vinod)
>
> Reviewed-by: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> ---
>  drivers/gpu/drm/display/drm_dp_helper.c | 52 +++++++++++++++++++++------------
>  include/drm/display/drm_dp_helper.h     |  2 ++
>  2 files changed, 36 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
> index 57828f2b7b5a0582ca4a6f2a9be2d5909fe8ad24..56c7e3318f01079c3bde492a21c76ed37e9724ca 100644
> --- a/drivers/gpu/drm/display/drm_dp_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> @@ -4393,8 +4393,9 @@ 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,22 +4403,42 @@ 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)
> +/**
> + * drm_dp_link_symbol_cycles - calculate the link symbol count with/without dsc
> + * @lane_count: DP link lane count
> + * @pixels: number of pixels in a scanline
> + * @dsc_slice_count: number of slices for DSC or '0' for non-DSC
> + * @bpp_x16: bits per pixel in .4 binary fixed format
> + * @symbol_size: DP symbol size
> + * @is_mst: %true for MST and %false for SST
> + *
> + * Calculate the link symbol cycles for both DSC (@dsc_slice_count !=0) and
> + * non-DSC case (@dsc_slice_count == 0) and return the count.
> + */
> +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);
>  }
> +EXPORT_SYMBOL(drm_dp_link_symbol_cycles);
>  
>  /**
>   * drm_dp_bw_overhead - Calculate the BW overhead of a DP link stream
>   * @lane_count: DP link lane count
>   * @hactive: pixel count of the active period in one scanline of the stream
> - * @dsc_slice_count: DSC slice count if @flags/DRM_DP_LINK_BW_OVERHEAD_DSC is set
> + * @dsc_slice_count: number of slices for DSC or '0' for non-DSC
>   * @bpp_x16: bits per pixel in .4 binary fixed point
>   * @flags: DRM_DP_OVERHEAD_x flags
>   *
> @@ -4431,7 +4452,7 @@ static int drm_dp_link_dsc_symbol_cycles(int lane_count, int pixels, int slice_c
>   * as well as the stream's
>   * - @hactive timing
>   * - @bpp_x16 color depth
> - * - compression mode (@flags / %DRM_DP_OVERHEAD_DSC).
> + * - compression mode (@dsc_slice_count != 0)
>   * Note that this overhead doesn't account for the 8b/10b, 128b/132b
>   * channel coding efficiency, for that see
>   * @drm_dp_link_bw_channel_coding_efficiency().
> @@ -4486,15 +4507,10 @@ 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)

After this series, intel_dp_mst_bw_overhead() will still pass in
DRM_DP_BW_OVERHEAD_DSC in flags, but it's no longer used for anything.

Is there going to be a follow-up, or what's the idea here?


BR,
Jani.



> -		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,
> +						  dsc_slice_count,
> +						  bpp_x16, symbol_size,
> +						  is_mst);
>  
>  	return DIV_ROUND_UP_ULL(mul_u32_u32(symbol_cycles * symbol_size * lane_count,
>  					    overhead * 16),
> diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
> index d9614e2c89397536f44bb7258e894628ae1dccc9..7b19192c70313d66dce1b7ba40dd59c14f80a182 100644
> --- a/include/drm/display/drm_dp_helper.h
> +++ b/include/drm/display/drm_dp_helper.h
> @@ -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_symbol_cycles(int lane_count, int pixels, int dsc_slice_count,
> +			      int bpp_x16, int symbol_size, bool is_mst);
>  
>  #endif /* _DRM_DP_HELPER_H_ */

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2025-04-28  8:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 15:15 [PATCH v7 0/2] Rework/Correction on minimum hblank calculation Arun R Murthy
2025-04-24 15:15 ` [PATCH v7 1/2] drm/display/dp: Export fn to calculate link symbol cycles Arun R Murthy
2025-04-28  6:32   ` Govindapillai, Vinod
2025-04-28  8:57   ` Jani Nikula [this message]
2025-04-28  9:04     ` Murthy, Arun R
2025-04-28  8:58   ` Jani Nikula
2025-04-29 11:58   ` Maarten Lankhorst
2025-04-24 15:15 ` [PATCH v7 2/2] drm/i915/display: move min_hblank from dp_mst.c to dp.c Arun R Murthy
2025-04-24 16:05 ` ✗ Fi.CI.SPARSE: warning for Rework/Correction on minimum hblank calculation (rev7) Patchwork
2025-04-24 16:49 ` ✗ i915.CI.BAT: failure " Patchwork
2025-04-24 20:40 ` ✓ CI.Patch_applied: success " Patchwork
2025-04-24 20:40 ` ✓ CI.checkpatch: " Patchwork
2025-04-24 20:41 ` ✓ CI.KUnit: " Patchwork
2025-04-24 20:52 ` ✓ CI.Build: " Patchwork
2025-04-24 20:55 ` ✓ CI.Hooks: " Patchwork
2025-04-24 20:56 ` ✗ CI.checksparse: warning " Patchwork
2025-04-24 21:34 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-25 18:18 ` ✓ i915.CI.BAT: " Patchwork
2025-04-25 18:57 ` Patchwork
2025-04-25 19:19 ` ✓ Xe.CI.Full: " Patchwork
2025-04-25 23:12 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-26  0:54 ` Patchwork
2025-04-28 13:31 ` ✗ Fi.CI.SPARSE: warning for Rework/Correction on minimum hblank calculation (rev8) Patchwork
2025-04-28 13:54 ` ✓ i915.CI.BAT: success " Patchwork
2025-04-28 16:00 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-29  8:14 ` ✓ i915.CI.Full: success " Patchwork
2025-04-30 19:24   ` Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ikmoy87n.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=vinod.govindapillai@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.