All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: "Souza, Jose" <jose.souza@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "Vivi, Rodrigo" <rodrigo.vivi@intel.com>
Subject: Re: [PATCH 2/5] drm/i915: Refactor PSR status debugfs
Date: Wed, 02 Jan 2019 11:02:42 -0800	[thread overview]
Message-ID: <d98dfc919dc2f27b374895c0dfa41d35efa541f5.camel@intel.com> (raw)
In-Reply-To: <7121064b123bb31c7728a652f8ef9dba187de193.camel@intel.com>

On Wed, 2019-01-02 at 09:09 -0800, Souza, Jose wrote:
> On Tue, 2018-12-11 at 18:54 +0000, Souza, Jose wrote:
> > On Tue, 2018-12-11 at 10:32 -0800, Dhinakaran Pandiyan wrote:
> > > On Tue, 2018-12-11 at 04:44 -0800, Souza, Jose wrote:
> > > > On Mon, 2018-12-10 at 22:51 -0800, Dhinakaran Pandiyan wrote:
> > > > > On Tue, 2018-12-04 at 15:00 -0800, José Roberto de Souza
> > > > > wrote:
> > > > > > The old debugfs fields was not following a naming partern
> > > > > > and
> > > > > > it
> > > > > > was
> > > > > > a bit confusing.
> > > > > > 
> > > > > > So it went from:
> > > > > > ~$ sudo more /sys/kernel/debug/dri/0/i915_edp_psr_status
> > > > > > Sink_Support: yes
> > > > > > PSR mode: PSR1
> > > > > > Enabled: yes
> > > > > > Busy frontbuffer bits: 0x000
> > > > > > Main link in standby mode: no
> > > > > > HW Enabled & Active bit: yes
> > > > > > Source PSR status: 0x24050006 [SRDONACK]
> > > > > > 
> > > > > > To:
> > > > > > ~$ sudo more /sys/kernel/debug/dri/0/i915_edp_psr_status
> > > > > > Sink support: yes [0x00000003]
> > > > > > Status: PSR1 enabled
> > > > > > Source PSR ctl: enabled [0x81f00e26]
> > > > > > Source PSR status: SRDENT [0x40040006]
> > > > > > Busy frontbuffer bits: 0x00000000
> > > > > > 
> > > > > > The 'Main link in standby mode' was removed as it is not
> > > > > > useful
> > > > > > but
> > > > > > if needed by someone the information is still in the
> > > > > > register
> > > > > > value
> > > > > > of 'Source PSR ctl' inside of the brackets, PSR mode and
> > > > > > Enabled
> > > > > > was
> > > > > > squashed into Status, some renames and reorders and we have
> > > > > > this
> > > > > > cleaner version. This will also make easy to parse debugfs
> > > > > > for
> > > > > > IGT
> > > > > > tests.
> > > > > > 
> > > > > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > > > Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > > > > > Suggested-by: Dhinakaran Pandiyan <
> > > > > > dhinakaran.pandiyan@intel.com>
> > > > > > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > > > > > ---
> > > > > >  drivers/gpu/drm/i915/i915_debugfs.c | 96 +++++++++++++++--
> > > > > > ----
> > > > > > ----
> > > > > > ----
> > > > > >  1 file changed, 49 insertions(+), 47 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> > > > > > b/drivers/gpu/drm/i915/i915_debugfs.c
> > > > > > index 38dcee1ca062..86303ba02666 100644
> > > > > > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > > > > > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > > > > > @@ -2665,7 +2665,8 @@
> > > > > > DEFINE_SHOW_ATTRIBUTE(i915_psr_sink_status);
> > > > > >  static void
> > > > > >  psr_source_status(struct drm_i915_private *dev_priv,
> > > > > > struct
> > > > > > seq_file
> > > > > > *m)
> > > > > >  {
> > > > > > -	u32 val, psr_status;
> > > > > > +	u32 val, status_val;
> > > > > > +	const char *status = "unknown";
> > > > > >  
> > > > > >  	if (dev_priv->psr.psr2_enabled) {
> > > > > >  		static const char * const live_status[] = {
> > > > > > @@ -2681,14 +2682,11 @@ psr_source_status(struct
> > > > > > drm_i915_private
> > > > > > *dev_priv, struct seq_file *m)
> > > > > >  			"BUF_ON",
> > > > > >  			"TG_ON"
> > > > > >  		};
> > > > > > -		psr_status = I915_READ(EDP_PSR2_STATUS);
> > > > > > -		val = (psr_status & EDP_PSR2_STATUS_STATE_MASK)
> > > > > > -			EDP_PSR2_STATUS_STATE_SHIFT;
> > > > > > -		if (val < ARRAY_SIZE(live_status)) {
> > > > > > -			seq_printf(m, "Source PSR status: 0x%x
> > > > > > [%s]\n",
> > > > > > -				   psr_status,
> > > > > > live_status[val]);
> > > > > > -			return;
> > > > > > -		}
> > > > > > +		val = I915_READ(EDP_PSR2_STATUS);
> > > > > > +		status_val = (val & EDP_PSR2_STATUS_STATE_MASK)
> > > > > > +			      EDP_PSR2_STATUS_STATE_SHIFT;
> > > > > > +		if (status_val < ARRAY_SIZE(live_status))
> > > > > > +			status = live_status[status_val];
> > > > > >  	} else {
> > > > > >  		static const char * const live_status[] = {
> > > > > >  			"IDLE",
> > > > > > @@ -2700,74 +2698,78 @@ psr_source_status(struct
> > > > > > drm_i915_private
> > > > > > *dev_priv, struct seq_file *m)
> > > > > >  			"SRDOFFACK",
> > > > > >  			"SRDENT_ON",
> > > > > >  		};
> > > > > > -		psr_status = I915_READ(EDP_PSR_STATUS);
> > > > > > -		val = (psr_status & EDP_PSR_STATUS_STATE_MASK)
> > > > > > -			EDP_PSR_STATUS_STATE_SHIFT;
> > > > > > -		if (val < ARRAY_SIZE(live_status)) {
> > > > > > -			seq_printf(m, "Source PSR status: 0x%x
> > > > > > [%s]\n",
> > > > > > -				   psr_status,
> > > > > > live_status[val]);
> > > > > > -			return;
> > > > > > -		}
> > > > > > +		val = I915_READ(EDP_PSR_STATUS);
> > > > > > +		status_val = (val & EDP_PSR_STATUS_STATE_MASK)
> > > > > > +			      EDP_PSR_STATUS_STATE_SHIFT;
> > > > > > +		if (status_val < ARRAY_SIZE(live_status))
> > > > > > +			status = live_status[status_val];
> > > > > >  	}
> > > > > >  
> > > > > > -	seq_printf(m, "Source PSR status: 0x%x [%s]\n",
> > > > > > psr_status,
> > > > > > "unknown");
> > > > > > +	seq_printf(m, "Source PSR status: %s [0x%08x]\n",
> > > > > > status, val);
> > > > > >  }
> > > > > >  
> > > > > >  static int i915_edp_psr_status(struct seq_file *m, void
> > > > > > *data)
> > > > > >  {
> > > > > >  	struct drm_i915_private *dev_priv = node_to_i915(m-
> > > > > > > private);
> > > > > > 
> > > > > > -	u32 psrperf = 0;
> > > > > > -	bool enabled = false;
> > > > > > -	bool sink_support;
> > > > > > +	struct i915_psr *psr = &dev_priv->psr;
> > > > > > +	const char *status;
> > > > > > +	bool enabled;
> > > > > > +	u32 val;
> > > > > >  
> > > > > >  	if (!HAS_PSR(dev_priv))
> > > > > >  		return -ENODEV;
> > > > > >  
> > > > > > -	sink_support = dev_priv->psr.sink_support;
> > > > > > -	seq_printf(m, "Sink_Support: %s\n",
> > > > > > yesno(sink_support));
> > > > > > -	if (!sink_support)
> > > > > > +	seq_printf(m, "Sink support: %s", yesno(psr-
> > > > > > > sink_support));
> > > > > > 
> > > > > > +	if (!psr->sink_support) {
> > > > > > +		seq_puts(m, "\n");
> > > > > >  		return 0;
> > > > > > +	}
> > > > > >  
> > > > > >  	intel_runtime_pm_get(dev_priv);
> > > > > > +	mutex_lock(&psr->lock);
> > > > > >  
> > > > > > -	mutex_lock(&dev_priv->psr.lock);
> > > > > > -	seq_printf(m, "PSR mode: %s\n",
> > > > > > -		   dev_priv->psr.psr2_enabled ? "PSR2" :
> > > > > > "PSR1");
> > > > > > -	seq_printf(m, "Enabled: %s\n", yesno(dev_priv-
> > > > > > > psr.enabled));
> > > > > > 
> > > > > > -	seq_printf(m, "Busy frontbuffer bits: 0x%03x\n",
> > > > > > -		   dev_priv->psr.busy_frontbuffer_bits);
> > > > > > +	seq_printf(m, " [0x%08x]\n", psr->dp->psr_dpcd[0]);
> > > > > 
> > > > > This can be moved closer to where "Sink support" is printed.
> > > > > Also,  the
> > > > > extra zeroes that get printed due to "%08x" look odd, please
> > > > > consider
> > > > > changing it to "%02x".
> > > > 
> > > > Done
> > > > 
> > > > > >  
> > > > > > -	if (dev_priv->psr.psr2_enabled)
> > > > > > -		enabled = I915_READ(EDP_PSR2_CTL) &
> > > > > > EDP_PSR2_ENABLE;
> > > > > > +	if (psr->enabled)
> > > > > > +		status = psr->psr2_enabled ? "PSR2 enabled" :
> > > > > > "PSR1
> > > > > > enabled";
> > > > > >  	else
> > > > > > -		enabled = I915_READ(EDP_PSR_CTL) &
> > > > > > EDP_PSR_ENABLE;
> > > > > > +		status = "disabled";
> > > > > > +	seq_printf(m, "Status: %s\n", status);
> > > > > 
> > > > > Can we just use the ctl field and get rid of this? This
> > > > > status
> > > > > and
> > > > > and
> > > > > the one below can be confusing to those not familiar with the
> > > > > code
> > > > > base.
> > > > > 
> > > > > We should be able to parse all the information we need from
> > > > > two
> > > > > lines
> > > > > Source PSR ctl:		[PSR1,PSR2] enabled <reg value>
> > > > > Source PSR status:	<state> <reg value>
> > > > 
> > > > I'm fine in having just one but when there is frontbuffer
> > > > modifications
> > > > Status is kept as enabled and Source PSR ctl and Source PSR
> > > > status
> > > > are
> > > > set to idle states, 
> > > 
> > > That is a good point -  psr_invalidate() would disable the
> > > feature
> > > in 
> > > hardware but the driver state is enabled. I guess, you could
> > > change
> > > "Status" to "PSR mode"/"Feature state". 
> > > ...
> > > PSR mode:		{PSR1 enabled, PSR2 enabled, disabled}
> > > Source PSR ctl:		{enabled, disabled} ...
> > > Source PSR status:	...
> > > ...
> > > 
> > > Is this better?
> > > 
> > 
> > Yeah looks good to me.
> > 
> > > Also, it might be worth printing the "PSR mode:" line even when
> > > there
> > > is no sink_support. It's an useful piece of debug information and
> > > doesn't access the hardware.
> 
> About this one, to read psr->enable and psr->psr2_enabled we take PSR
> mutex and it is only initialized if sink support PSR.
> If that information is useful when doing IGT changes I will send it
> in
> a separate patch, sounds good?

Yeah, that's fine.

-DK

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

  reply	other threads:[~2019-01-02 19:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 23:00 [PATCH 1/5] drm/i915/psr: Allow PSR2 to be enabled when debugfs asks José Roberto de Souza
2018-12-04 23:00 ` [PATCH 2/5] drm/i915: Refactor PSR status debugfs José Roberto de Souza
2018-12-11  6:51   ` Dhinakaran Pandiyan
2018-12-11 12:44     ` Souza, Jose
2018-12-11 18:32       ` Dhinakaran Pandiyan
2018-12-11 18:54         ` Souza, Jose
2019-01-02 17:09           ` Souza, Jose
2019-01-02 19:02             ` Dhinakaran Pandiyan [this message]
2018-12-04 23:00 ` [PATCH 3/5] drm/i915/psr: Do not print last attempted entry or exit in PSR debugfs while in PSR2 José Roberto de Souza
2018-12-11  7:03   ` Dhinakaran Pandiyan
2018-12-11 14:01     ` Souza, Jose
2018-12-04 23:00 ` [PATCH 4/5] drm/i915: Add PSR2 selective update status registers and bits definitions José Roberto de Souza
2018-12-11  7:51   ` Dhinakaran Pandiyan
2018-12-11 14:20     ` Souza, Jose
2018-12-04 23:00 ` [PATCH 5/5] drm/i915/debugfs: Print PSR selective update status register values José Roberto de Souza
2018-12-11 22:20   ` Dhinakaran Pandiyan
2018-12-13 18:06     ` Souza, Jose
2018-12-04 23:10 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/i915/psr: Allow PSR2 to be enabled when debugfs asks Patchwork
2018-12-04 23:27 ` ✓ Fi.CI.BAT: success " Patchwork
2018-12-05 11:38 ` ✓ Fi.CI.IGT: " Patchwork
2018-12-11  3:52 ` [PATCH 1/5] " Dhinakaran Pandiyan
2018-12-11 12:29   ` Souza, Jose

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=d98dfc919dc2f27b374895c0dfa41d35efa541f5.camel@intel.com \
    --to=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jose.souza@intel.com \
    --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 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.