All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jouni Högander" <jouni.hogander@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/i915/psr: Calculate aux less wake time
Date: Thu, 15 Feb 2024 17:32:42 +0200	[thread overview]
Message-ID: <Zc4umn1QE8tVfxNl@intel.com> (raw)
In-Reply-To: <20240215104934.2395239-3-jouni.hogander@intel.com>

On Thu, Feb 15, 2024 at 12:49:30PM +0200, Jouni Högander wrote:
> Calculate aux less wake time and store it into alpm_params struct
> 
> Bspec: 71477
> 
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  .../drm/i915/display/intel_display_types.h    |  1 +
>  drivers/gpu/drm/i915/display/intel_psr.c      | 53 +++++++++++++++++++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 0d4012097db1..a531c1e5af20 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1721,6 +1721,7 @@ struct intel_psr {
>  
>  		/* LNL and beyond */
>  		u8 check_entry_lines;
> +		u8 aux_less_wake_lines;
>  	} alpm_parameters;
>  
>  	ktime_t last_entry_attempt;
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 72cadad09db5..b139db67df55 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1126,6 +1126,56 @@ static bool _compute_psr2_sdp_prior_scanline_indication(struct intel_dp *intel_d
>  	return true;
>  }
>  
> +/*
> + * AUX-Less Wake Time = CEILING( ((PHY P2 to P0) + tLFPS_Period, Max+
> + * tSilence, Max+ tPHY Establishment + tCDS) / tline)
> + * For the "PHY P2 to P0" latency see the PHY Power Control page
> + * (PHY P2 to P0) : https://gfxspecs.intel.com/Predator/Home/Index/68965
> + * : 12 us
> + * The tLFPS_Period, Max term is 800ns
> + * The tSilence, Max term is 180ns
> + * The tPHY Establishment (a.k.a. t1) term is 50us
> + * The tCDS term is 1 or 2 times t2
> + * t2 = Number ML_PHY_LOCK * tML_PHY_LOCK
> + * Number ML_PHY_LOCK = ( 7 + CEILING( 6.5us / tML_PHY_LOCK ) + 1)
> + * Rounding up the 6.5us padding to the next ML_PHY_LOCK boundary and
> + * adding the "+ 1" term ensures all ML_PHY_LOCK sequences that start
> + * within the CDS period complete within the CDS period regardless of
> + * entry into the period
> + * tML_PHY_LOCK = TPS4 Length * ( 10 / (Link Rate in MHz) )
> + * TPS4 Length = 252 Symbols
> + */
> +static int _lnl_compute_aux_less_wake_time(int port_clock)
> +{
> +	int tml_phy_lock = 1000 * 252 * (10 / port_clock);
> +	int num_ml_phy_lock = 7 + DIV_ROUND_UP(6500, tml_phy_lock) + 1;
> +
> +	return DIV_ROUND_UP(12 * 1000 + 800 + 180 + 50 * 1000 +

Would be much clearer to have a properly named variable for each magic
number. I don't really want to have to read the comment to understand
what the code is calculating.

> +			    num_ml_phy_lock * tml_phy_lock, 1000);
> +}
> +
> +static int _lnl_compute_aux_less_alpm_params(struct intel_dp *intel_dp,
> +					     struct intel_crtc_state *crtc_state)
> +{
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +	int aux_less_wake_time, aux_less_wake_lines;
> +
> +	aux_less_wake_time =
> +		_lnl_compute_aux_less_wake_time(crtc_state->port_clock / 1000);
> +	aux_less_wake_lines = intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode,
> +						       aux_less_wake_time);
> +
> +	if (aux_less_wake_lines > 32)
> +		return false;
> +
> +	if (i915->display.params.psr_safest_params)
> +		aux_less_wake_lines = 32;
> +
> +	intel_dp->psr.alpm_parameters.aux_less_wake_lines = aux_less_wake_lines;
> +
> +	return true;
> +}
> +
>  static bool _lnl_compute_alpm_params(struct intel_dp *intel_dp,
>  				     struct intel_crtc_state *crtc_state)
>  {
> @@ -1142,6 +1192,9 @@ static bool _lnl_compute_alpm_params(struct intel_dp *intel_dp,
>  	if (check_entry_lines > 15)
>  		return false;
>  
> +	if (!_lnl_compute_aux_less_alpm_params(intel_dp, crtc_state))
> +		return false;
> +
>  	if (i915->display.params.psr_safest_params)
>  		check_entry_lines = 15;
>  
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-02-15 15:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 10:49 [PATCH 0/6] ALPM AUX-Less Jouni Högander
2024-02-15 10:49 ` [PATCH 1/6] drm/display: Add missing aux less alpm wake related bits Jouni Högander
2024-02-15 10:49 ` [PATCH 2/6] drm/i915/psr: Calculate aux less wake time Jouni Högander
2024-02-15 15:32   ` Ville Syrjälä [this message]
2024-02-15 10:49 ` [PATCH 3/6] drm/i915/psr: Calculate aux less switch to active latency Jouni Högander
2024-02-15 10:49 ` [PATCH 4/6] drm/i915/psr: Silence period and lfps half cycle Jouni Högander
2024-02-16  2:47   ` kernel test robot
2024-02-19  7:03   ` Dan Carpenter
2024-02-15 10:49 ` [PATCH 5/6] drm/i915/psr: Add missing ALPM AUX-Less register defintions Jouni Högander
2024-02-15 10:49 ` [PATCH 6/6] drm/i915/psr: Enable ALPM for eDP Panel replay Jouni Högander
2024-02-15 11:40 ` ✗ Fi.CI.CHECKPATCH: warning for ALPM AUX-Less Patchwork
2024-02-15 11:40 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-02-15 11:54 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-16  8:22 ` ✓ 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=Zc4umn1QE8tVfxNl@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jouni.hogander@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.