public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 7/9] drm/i915/tgl: DC3CO PSR2 helper
Date: Tue, 13 Aug 2019 19:05:36 +0300	[thread overview]
Message-ID: <20190813160536.GD21986@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20190809183223.12031-8-anshuman.gupta@intel.com>

On Sat, Aug 10, 2019 at 12:02:21AM +0530, Anshuman Gupta wrote:
> Add dc3co helper functions to enable/disable psr2 deep sleep.
> Disallow DC3CO state before PSR2 exit, it essentially does
> that by putting a reference to POWER_DOMAIN_VIDEO before
> PSR2 exit.
> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Animesh Manna <animesh.manna@intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 44 ++++++++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_psr.h |  2 ++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index ad7044ea1efe..42f27df8445d 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -533,6 +533,49 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
>  	I915_WRITE(EDP_PSR2_CTL, val);
>  }
>  
> +void tgl_psr2_deep_sleep_disable(struct drm_i915_private *dev_priv)
> +{
> +	u32 val;
> +	int idle_frames = 0;
> +
> +	idle_frames <<= EDP_PSR2_IDLE_FRAME_SHIFT;
> +	val = I915_READ(EDP_PSR2_CTL);
> +	val &= ~EDP_PSR2_IDLE_FRAME_MASK;
> +	val |= idle_frames;
> +	I915_WRITE(EDP_PSR2_CTL, val);

This could be factored out to a helper and reused elsewhere.

> +}
> +
> +void tgl_psr2_deep_sleep_enable(struct drm_i915_private *dev_priv)
> +{
> +	u32 val;
> +	int idle_frames;
> +
> +	/*
> +	 * Let's use 6 as the minimum to cover all known cases including the
> +	 * off-by-one issue that HW has in some cases.
> +	 */
> +	idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
> +	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
> +	idle_frames <<=  EDP_PSR2_IDLE_FRAME_SHIFT;
> +	val = I915_READ(EDP_PSR2_CTL);
> +	val &= ~EDP_PSR2_IDLE_FRAME_MASK;
> +	val |= idle_frames;
> +	I915_WRITE(EDP_PSR2_CTL, val);
> +}
> +
> +static void tgl_disallow_dc3co_on_psr2_exit(struct drm_i915_private *dev_priv)
> +{
> +	intel_wakeref_t wakeref __maybe_unused;
> +
> +	/* Before PSR2 exit disallow dc3co*/
> +	mutex_lock(&dev_priv->csr.dc5_mutex);
> +	wakeref	= fetch_and_zero(&dev_priv->csr.dc5_wakeref);
> +	if (wakeref)
> +		intel_display_power_put(dev_priv, POWER_DOMAIN_VIDEO,
> +					dev_priv->csr.dc5_wakeref);
> +	mutex_unlock(&dev_priv->csr.dc5_mutex);
> +}
> +
>  static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
>  				    struct intel_crtc_state *crtc_state)
>  {
> @@ -789,6 +832,7 @@ static void intel_psr_exit(struct drm_i915_private *dev_priv)
>  	}
>  
>  	if (dev_priv->psr.psr2_enabled) {
> +		tgl_disallow_dc3co_on_psr2_exit(dev_priv);
>  		val = I915_READ(EDP_PSR2_CTL);
>  		WARN_ON(!(val & EDP_PSR2_ENABLE));
>  		I915_WRITE(EDP_PSR2_CTL, val & ~EDP_PSR2_ENABLE);
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.h b/drivers/gpu/drm/i915/display/intel_psr.h
> index dc818826f36d..6fb4c385489c 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.h
> +++ b/drivers/gpu/drm/i915/display/intel_psr.h
> @@ -36,5 +36,7 @@ void intel_psr_short_pulse(struct intel_dp *intel_dp);
>  int intel_psr_wait_for_idle(const struct intel_crtc_state *new_crtc_state,
>  			    u32 *out_value);
>  bool intel_psr_enabled(struct intel_dp *intel_dp);
> +void tgl_psr2_deep_sleep_disable(struct drm_i915_private *dev_priv);
> +void tgl_psr2_deep_sleep_enable(struct drm_i915_private *dev_priv);
>  
>  #endif /* __INTEL_PSR_H__ */
> -- 
> 2.21.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-08-13 16:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 18:32 [PATCH v5 0/9] DC3CO Support for TGL Anshuman Gupta
2019-08-09 18:32 ` [PATCH v5 1/9] drm/i915/tgl: Add DC3CO required register and bits Anshuman Gupta
2019-08-09 18:32 ` [PATCH v5 2/9] drm/i915/tgl: Add DC3CO mask to allowed_dc_mask and gen9_dc_mask Anshuman Gupta
2019-08-09 18:32 ` [PATCH v5 3/9] drm/i915/tgl: Add power well to enable DC3CO state Anshuman Gupta
2019-08-11  7:46   ` Anshuman Gupta
2019-08-13 14:46   ` Imre Deak
2019-08-27 13:01     ` Gupta, Anshuman
2019-08-27 13:20       ` Imre Deak
2019-08-27 16:17         ` Gupta, Anshuman
2019-08-09 18:32 ` [PATCH v5 4/9] drm/i915/tgl: mutual exclusive handling for DC3CO and DC5/6 Anshuman Gupta
2019-08-13 14:52   ` Imre Deak
2019-08-09 18:32 ` [PATCH v5 5/9] drm/i915/tgl: Add helper function to prefer dc3co over dc5 Anshuman Gupta
2019-08-13 15:47   ` Imre Deak
2019-08-19 12:57     ` Gupta, Anshuman
2019-08-19 13:23       ` Imre Deak
2019-08-14  9:46   ` Imre Deak
2019-08-09 18:32 ` [PATCH v5 6/9] drm/i915/tgl: Add VIDEO power domain Anshuman Gupta
2019-08-09 18:32 ` [PATCH v5 7/9] drm/i915/tgl: DC3CO PSR2 helper Anshuman Gupta
2019-08-13 16:05   ` Imre Deak [this message]
2019-08-09 18:32 ` [PATCH v5 8/9] drm/i915/tgl: switch between dc3co and dc5 based on display idleness Anshuman Gupta
2019-08-10  6:17   ` kbuild test robot
2019-08-10  6:32   ` kbuild test robot
2019-08-09 18:32 ` [PATCH v5 9/9] drm/i915/tgl: Add DC3CO counter in i915_dmc_info Anshuman Gupta
2019-08-09 19:13 ` ✗ Fi.CI.CHECKPATCH: warning for DC3CO Support for TGL (rev2) Patchwork
2019-08-09 19:17 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-08-09 19:33 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-10 16:18 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-08-11  8:12 ` ✗ Fi.CI.CHECKPATCH: warning for DC3CO Support for TGL (rev3) Patchwork
2019-08-11  8:16 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-08-11  8:37 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-11 15:08 ` ✓ 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=20190813160536.GD21986@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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