intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: dhinakaran.pandiyan@intel.com, intel-gfx@lists.freedesktop.org
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH 2/2] drm/i915/psr: Add debugfs support to force toggling PSR1/2 mode.
Date: Wed, 8 Aug 2018 11:01:53 +0200	[thread overview]
Message-ID: <574acffa-2904-016c-3e6a-49afad8a6d2e@linux.intel.com> (raw)
In-Reply-To: <29f688e9b572e638431e73407c362a8103b8c4c1.camel@intel.com>

Op 08-08-18 om 03:35 schreef Dhinakaran Pandiyan:
> On Tue, 2018-07-31 at 15:35 +0200, Maarten Lankhorst wrote:
>> This will make it easier to test PSR1 on PSR2 capable eDP machines.
> Thanks for writing this patch, we can make use of this to fix failures
> on PSR2 machines in CI.
>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.h  |  2 ++
>>  drivers/gpu/drm/i915/intel_psr.c | 27 ++++++++++++++++++++++++---
>>  2 files changed, 26 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h
>> b/drivers/gpu/drm/i915/i915_drv.h
>> index ef04b6cd7863..07783b9e7960 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -617,6 +617,8 @@ struct i915_psr {
>>  #define I915_PSR_DEBUG_DEFAULT	(0 << 1)
>>  #define I915_PSR_DEBUG_DISABLE	(1 << 1)
>>  #define I915_PSR_DEBUG_ENABLE	(2 << 1)
>> +#define I915_PSR_DEBUG_FORCE_PSR1 (3 << 1)
>> +#define I915_PSR_DEBUG_FORCE_PSR2 (4 << 1)
>>  
>>  	u32 debug;
>>  	bool sink_support;
>> diff --git a/drivers/gpu/drm/i915/intel_psr.c
>> b/drivers/gpu/drm/i915/intel_psr.c
>> index 7848829094ca..4cf4ac7068d0 100644
>> --- a/drivers/gpu/drm/i915/intel_psr.c
>> +++ b/drivers/gpu/drm/i915/intel_psr.c
>> @@ -813,19 +813,38 @@ static bool __psr_wait_for_idle_locked(struct
>> drm_i915_private *dev_priv)
>>  	return err == 0 && dev_priv->psr.enabled;
>>  }
>>  
>> +static bool switching_psr(struct drm_i915_private *dev_priv,
>> +			  struct intel_crtc_state *crtc_state,
>> +			  u32 mode)
>> +{
>> +	/* Can't switch psr state anyway if PSR2 is not supported.
>> */
>> +	if (!crtc_state || !crtc_state->has_psr2)
>> +		return false;
>> +
>> +	if (dev_priv->psr.psr2_enabled && mode ==
>> I915_PSR_DEBUG_FORCE_PSR1)
>> +		return true;
>> +
>> +	if (!dev_priv->psr.psr2_enabled && mode !=
>> I915_PSR_DEBUG_FORCE_PSR1)
>> +		return true;
>> +
>> +	return false;
>> +}
>> +
>>  int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
>>  			       struct drm_modeset_acquire_ctx *ctx,
>>  			       u64 val)
>>  {
>>  	struct drm_device *dev = &dev_priv->drm;
>>  	struct drm_connector_state *conn_state;
>> +	struct intel_crtc_state *crtc_state = NULL;
>>  	struct drm_crtc *crtc;
>>  	struct intel_dp *dp;
>>  	int ret;
>>  	bool enable;
>> +	u32 mode = val & I915_PSR_DEBUG_MODE_MASK;
>>  
>>  	if (val & ~(I915_PSR_DEBUG_IRQ | I915_PSR_DEBUG_MODE_MASK)
>> ||
>> -	    (val & I915_PSR_DEBUG_MODE_MASK) >
>> I915_PSR_DEBUG_ENABLE) {
>> +	    mode > I915_PSR_DEBUG_FORCE_PSR2) {
>>  		DRM_DEBUG_KMS("Invalid debug mask %llx\n", val);
>>  		return -EINVAL;
>>  	}
>> @@ -843,7 +862,8 @@ int intel_psr_set_debugfs_mode(struct
>> drm_i915_private *dev_priv,
>>  		if (ret)
>>  			return ret;
>>  
>> -		ret = wait_for_completion_interruptible(&crtc-
>>> state->commit->hw_done);
>> +		crtc_state = to_intel_crtc_state(crtc->state);
>> +		ret = wait_for_completion_interruptible(&crtc_state-
>>> base.commit->hw_done);
>>  	} else
>>  		ret = wait_for_completion_interruptible(&conn_state-
>>> commit->hw_done);
>>  
>> @@ -856,10 +876,11 @@ int intel_psr_set_debugfs_mode(struct
>> drm_i915_private *dev_priv,
>>  
>>  	enable = psr_global_enabled(val);
>>  
>> -	if (!enable)
>> +	if (!enable || switching_psr(dev_priv, crtc_state, mode))
>>  		intel_psr_disable_locked(dev_priv->psr.dp);
>>  
>>  	dev_priv->psr.debug = val;
>> +	dev_priv->psr.psr2_enabled = mode !=
>> I915_PSR_DEBUG_FORCE_PSR1 && crtc_state->has_psr2;
> crtc_state can be NULL.
Right, will fix.
>
>>  	intel_psr_irq_control(dev_priv, dev_priv->psr.debug &
>> I915_PSR_DEBUG_IRQ);
>>  
>>  	if (dev_priv->psr.prepared && enable)
>
> If a modeset was done after writing I915_PSR_DEBUG_FORCE_PSR1, we'll
> still end up enabling PSR2. Check for debug flags in intel_psr_enable()
> ?
Hmm.. good point, will add the same check there.

~Maarten
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-08-08  9:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 11:46 [PATCH] drm/i915: Control PSR at runtime through debugfs only Maarten Lankhorst
2018-03-14 12:32 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-03-14 15:58 ` [PATCH] drm/i915: Allow control of PSR at runtime through debugfs Maarten Lankhorst
2018-03-14 16:07   ` Chris Wilson
2018-03-14 16:11     ` Maarten Lankhorst
2018-03-14 16:27 ` ✓ Fi.CI.BAT: success for drm/i915: Control PSR at runtime through debugfs only (rev2) Patchwork
2018-03-14 21:53 ` [PATCH] drm/i915: Control PSR at runtime through debugfs only Rodrigo Vivi
2018-03-15 10:28   ` [PATCH] drm/i915: Allow control of PSR at runtime through debugfs Maarten Lankhorst
2018-03-22  1:45     ` Pandiyan, Dhinakaran
2018-03-22  9:41       ` Maarten Lankhorst
2018-07-26  6:32         ` Dhinakaran Pandiyan
2018-07-26  9:06           ` [PATCH] drm/i915: Allow control of PSR at runtime through debugfs, v3 Maarten Lankhorst
2018-07-27  3:27             ` Dhinakaran Pandiyan
2018-07-27  8:41               ` Maarten Lankhorst
2018-07-28  5:23                 ` Dhinakaran Pandiyan
2018-07-30  9:40                   ` Maarten Lankhorst
2018-07-31 13:35                   ` [PATCH 1/2] drm/i915: Allow control of PSR at runtime through debugfs, v4 Maarten Lankhorst
2018-07-31 13:35                     ` [PATCH 2/2] drm/i915/psr: Add debugfs support to force toggling PSR1/2 mode Maarten Lankhorst
2018-08-08  1:35                       ` Dhinakaran Pandiyan
2018-08-08  9:01                         ` Maarten Lankhorst [this message]
2018-08-01  9:41                     ` [PATCH 1/2] drm/i915: Allow control of PSR at runtime through debugfs, v4 Maarten Lankhorst
2018-08-08  0:07                     ` Dhinakaran Pandiyan
2018-08-08  9:00                       ` Maarten Lankhorst
2018-07-26 12:54           ` [PATCH] drm/i915: Allow control of PSR at runtime through debugfs Maarten Lankhorst
2018-03-15  0:58 ` ✓ Fi.CI.IGT: success for drm/i915: Control PSR at runtime through debugfs only (rev2) Patchwork
2018-03-15 11:01 ` ✓ Fi.CI.BAT: success for drm/i915: Control PSR at runtime through debugfs only (rev3) Patchwork
2018-03-15 12:17 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-26 10:10 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Control PSR at runtime through debugfs only (rev4) Patchwork
2018-07-26 10:11 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-26 10:30 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-26 11:57 ` ✓ 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=574acffa-2904-016c-3e6a-49afad8a6d2e@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@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).