[Intel-gfx] [PATCH] drm/i915/psr: Split sink status into a separate debugfs node

Rodrigo Vivi rodrigo.vivi at intel.com
Thu Jul 19 07:00:51 UTC 2018


On Thu, Jul 19, 2018 at 12:18:39AM -0700, Dhinakaran Pandiyan wrote:
> On Thu, 2018-07-19 at 07:18 +0100, Chris Wilson wrote:
> > Quoting Dhinakaran Pandiyan (2018-07-05 01:31:21)
> > > 
> > > This allows to read i915_edp_psr_status from tests without
> > > triggering
> > > any AUX communication. Take this opportunity to move this under the
> > > eDP-1 connector directory as the status we print is of the sink.
> > > 
> > > Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > > Cc: José Roberto de Souza <jose.souza at intel.com>
> > > Suggested-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/i915_debugfs.c | 69 +++++++++++++++++++++--
> > > --------------
> > >  1 file changed, 39 insertions(+), 30 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> > > b/drivers/gpu/drm/i915/i915_debugfs.c
> > > index f6142d78ede4..5069d5dedafe 100644
> > > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > > @@ -2592,6 +2592,41 @@ static const struct file_operations
> > > i915_guc_log_relay_fops = {
> > >         .release = i915_guc_log_relay_release,
> > >  };
> > >  
> > > +static int i915_psr_sink_status_show(struct seq_file *m, void
> > > *data)
> > > +{
> > > +       u8 val;
> > > +       static const char * const sink_status[] = {
> > > +               "inactive",
> > > +               "transition to active, capture and display",
> > > +               "active, display from RFB",
> > > +               "active, capture and display on sink device
> > > timings",
> > > +               "transition to inactive, capture and display,
> > > timing re-sync",
> > > +               "reserved",
> > > +               "reserved",
> > > +               "sink internal error",
> > > +       };
> > > +       struct drm_connector *connector = m->private;
> > > +       struct intel_dp *intel_dp =
> > > +               enc_to_intel_dp(&intel_attached_encoder(connector)-
> > > >base);
> > > +
> > > +       if (connector->status != connector_status_connected)
> > > +               return -ENODEV;
> > > +
> > > +       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PSR_STATUS, &val)
> > > == 1) {
> > > +               const char *str = "unknown";
> > > +
> > > +               val &= DP_PSR_SINK_STATE_MASK;
> > > +               if (val < ARRAY_SIZE(sink_status))
> > > +                       str = sink_status[val];
> > > +               seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val,
> > > str);
> > > +       } else {
> > > +               DRM_ERROR("dpcd read (at %u) failed\n",
> > > DP_PSR_STATUS);
> > Why is this common occurrence (any DP that doesn't support PSR) an
> > error?
> We create this file only for eDPs and I did not think dpcd_read would
> return an error if the panel did not support PSR. Do you happen to have
> any logs?
> 
> > Why report it via a backchannel when you are already directly
> > communicating with the user?!!!
> > 
> You are right, i915_dpcd_show() also has the same issue. How about
> returning the error to the user?  
> 
> @@ -2595,6 +2595,7 @@ static const struct file_operations
> i915_guc_log_relay_fops = {
>  static int i915_psr_sink_status_show(struct seq_file *m, void *data)
>  {
>         u8 val;
> +       int ret;
>         static const char * const sink_status[] = {
>                 "inactive",
>                 "transition to active, capture and display",
> @@ -2605,6 +2606,7 @@ static int i915_psr_sink_status_show(struct
> seq_file *m, void *data)
>                 "reserved",
>                 "sink internal error",
>         };
> +       const char *str = "unknown";
>         struct drm_connector *connector = m->private;
>         struct intel_dp *intel_dp =
>                 enc_to_intel_dp(&intel_attached_encoder(connector)-
> >base);
> @@ -2612,17 +2614,16 @@ static int i915_psr_sink_status_show(struct
> seq_file *m, void *data)
>         if (connector->status != connector_status_connected)
>                 return -ENODEV;
> 
> -       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PSR_STATUS, &val) ==
> 1) {
> -               const char *str = "unknown";
> +       ret = drm_dp_dpcd_readb(&intel_dp->aux, DP_PSR_STATUS, &val);
> 
> +       if (ret < 0) {
> +               return ret;
> +       } else if (ret == 1) {
>                 val &= DP_PSR_SINK_STATE_MASK;
>                 if (val < ARRAY_SIZE(sink_status))
>                         str = sink_status[val];
> -               seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val,
> str);
> -       } else {
> -               DRM_ERROR("dpcd read (at %u) failed\n", DP_PSR_STATUS);
>         }
> -
> +       seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val, str);
>         return 0;
>  }

ops, just saw this after sending the patch...
I think this should work as well.
However I believe it is better not even read the dpcd if psr is not supported.

> 
> > Please fix this mess.
> > -Chris


More information about the Intel-gfx mailing list