intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Ensure DSC has enough BW and stays within HW limits
Date: Mon, 06 Mar 2023 15:40:18 +0200	[thread overview]
Message-ID: <87lekat2v1.fsf@intel.com> (raw)
In-Reply-To: <20230306080401.22552-1-stanislav.lisovskiy@intel.com>

On Mon, 06 Mar 2023, Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> wrote:
> We have currently the issue with some BPPs when using DSC.
> According the HW team the reason is that single VDSC engine instance,
> has some BW limitations which have to be accounted, so whenever
> we approach around 90% of the CDCLK, second VDSC engine have to be
> used. Also that always means using 2 slices, however in our current code
> amount of slices is calculated for some reason independently of
> whether we need to enable 2nd VDSC engine or not, thus leading to
> some logical issues, when according to pixel clock needs we need to enable
> 2nd VDSC engine, however as we calculated previously that we can use
> only single slice, we can't do that and fail.
> So we need to fix that, so that amount of VDSC engines enabled should depend
> on amount of slices and amount of slices should also depend on BW requirements.
> Lastly we didn't have BPP limitation for ADLP/MTL/DG2 implemented which says
> that DSC output BPP's can only be chosen within range of 8 to 27(BSpec 49259).
> This all applied together allows to fix existing FIFO underruns, which we
> have in many DSC tests.
>
> BSpec: 49259
> HSDES: 18027167222
>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index aee93b0d810e..e3680ae95b83 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -687,6 +687,12 @@ u32 intel_dp_dsc_nearest_valid_bpp(struct drm_i915_private *i915, u32 bpp, u32 p
>  	/* From XE_LPD onwards we support from bpc upto uncompressed bpp-1 BPPs */
>  	if (DISPLAY_VER(i915) >= 13) {
>  		bits_per_pixel = min(bits_per_pixel, pipe_bpp - 1);
> +
> +		/* According to BSpec, 27 is the max DSC output bpp */
> +		bits_per_pixel = min(bits_per_pixel, (u32)27);
> +
> +		/* According to BSpec, 8 is the min DSC output bpp */
> +		bits_per_pixel = max(bits_per_pixel, (u32)8);

Please use clamp() or clamp_t() for ranges. Avoid casting the
params. The _t variants are for handling that.

>  	} else {
>  		/* Find the nearest match in the array of known BPPs from VESA */
>  		for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) {
> @@ -771,6 +777,9 @@ u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp,
>  		min_slice_count = DIV_ROUND_UP(mode_clock,
>  					       DP_DSC_MAX_ENC_THROUGHPUT_1);
>  
> +	if (mode_clock >= ((i915->display.cdclk.max_cdclk_freq * 85) / 100))
> +		min_slice_count = max(min_slice_count, (u8)2);
> +
>  	max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd);
>  	if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) {
>  		drm_dbg_kms(&i915->drm,
> @@ -1597,16 +1606,8 @@ int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>  	 * is greater than the maximum Cdclock and if slice count is even
>  	 * then we need to use 2 VDSC instances.
>  	 */
> -	if (adjusted_mode->crtc_clock > dev_priv->display.cdclk.max_cdclk_freq ||
> -	    pipe_config->bigjoiner_pipes) {
> -		if (pipe_config->dsc.slice_count > 1) {
> -			pipe_config->dsc.dsc_split = true;
> -		} else {
> -			drm_dbg_kms(&dev_priv->drm,
> -				    "Cannot split stream to use 2 VDSC instances\n");
> -			return -EINVAL;
> -		}
> -	}
> +	if (pipe_config->bigjoiner_pipes || pipe_config->dsc.slice_count > 1)
> +		pipe_config->dsc.dsc_split = true;
>  
>  	ret = intel_dp_dsc_compute_params(&dig_port->base, pipe_config);
>  	if (ret < 0) {

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2023-03-06 13:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06  8:04 [Intel-gfx] [PATCH] drm/i915: Ensure DSC has enough BW and stays within HW limits Stanislav Lisovskiy
2023-03-06  9:36 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-03-06 12:01 ` [Intel-gfx] [PATCH] " Govindapillai, Vinod
2023-03-06 13:17 ` Swati Sharma
2023-03-06 13:40 ` Jani Nikula [this message]
2023-03-08 12:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Ensure DSC has enough BW and stays within HW limits (rev3) Patchwork
2023-03-08 13:19 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-03-10  3:51 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=87lekat2v1.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    --cc=stanislav.lisovskiy@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).