From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
"Runyan, Arthur J" <arthur.j.runyan@intel.com>,
DRI mailing list <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 3/6] drm/i915: Check PSR setup time vs. vblank length
Date: Mon, 8 Aug 2016 10:38:27 +0300 [thread overview]
Message-ID: <20160808073827.GY4329@intel.com> (raw)
In-Reply-To: <CABVU7+tRJ65QGGEjQ6vpE76tY0aw+mart65iJEW6yNm5DBcQvQ@mail.gmail.com>
On Fri, Aug 05, 2016 at 03:10:51PM -0700, Rodrigo Vivi wrote:
> This patch is blocking PSR on panels that we know that our hardware support.
How do we know that?
> I wonder if:
> 1. This restrictions was for older platforms and spec is out dated
> 2. Or Spec is not documenting the restriction properly
I doubt it. AFAICS the only way that restriction could be lifted is by
adding support for the "Frame Capture Indication" bit in the PSR DPCD
register 0x170. That would cause the panel to wait one extra frame
between receiving the PSR entry indication and capturing the last
active frame. But I see no knob in Bspec that would allow us to tell
the source to send out that one extra active frame.
But maybe I've missed something. Art?
> 3. Or we have some issue with out setup time calculation.
I don't think so. Well, unless the panel is crap and reports a
totally bogus setup time.
I did notice that my SKL RVP stops trying to do PSR with this patch.
The EDID specifies two modes: 3200x1800@60Hz with 146us vblank,
and 3200x1800@48Hz with with ~2.5ms vblank. The setup time is
declared as 330us, so with the default mode we won't use PSR. We
could use the other timings I suppose, but I'm not sure everyone
would be happy with a 48Hz refresh rate. This is really a question
policy that shouldn't be handled in the kernel. What we could do is
expose both 60Hz and 48Hz modes, and let userspace choose the
refresh rate.
> On Tue, May 31, 2016 at 8:50 AM, <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Bspec says:
> > "Restriction : SRD must not be enabled when the PSR Setup time from DPCD
> > 00071h is greater than the time for vertical blank minus one line."
> >
> > Let's check for that and disallow PSR if we exceed the limit.
> >
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_drv.h | 2 ++
> > drivers/gpu/drm/i915/intel_psr.c | 19 ++++++++++++++++++-
> > drivers/gpu/drm/i915/intel_sprite.c | 6 +++---
> > 3 files changed, 23 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 9b5f6634c558..56ae3b78e25e 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1672,6 +1672,8 @@ bool intel_sdvo_init(struct drm_device *dev,
> >
> >
> > /* intel_sprite.c */
> > +int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
> > + int usecs);
> > int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
> > int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
> > struct drm_file *file_priv);
> > diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
> > index 29a09bf6bd18..aacd8d1767f2 100644
> > --- a/drivers/gpu/drm/i915/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/intel_psr.c
> > @@ -327,6 +327,9 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > struct drm_crtc *crtc = dig_port->base.base.crtc;
> > struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > + const struct drm_display_mode *adjusted_mode =
> > + &intel_crtc->config->base.adjusted_mode;
> > + int psr_setup_time;
> >
> > lockdep_assert_held(&dev_priv->psr.lock);
> > WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
> > @@ -365,11 +368,25 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)
> > }
> >
> > if (IS_HASWELL(dev) &&
> > - intel_crtc->config->base.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) {
> > + adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
> > DRM_DEBUG_KMS("PSR condition failed: Interlaced is Enabled\n");
> > return false;
> > }
> >
> > + psr_setup_time = drm_dp_psr_setup_time(intel_dp->psr_dpcd);
> > + if (psr_setup_time < 0) {
> > + DRM_DEBUG_KMS("PSR condition failed: Invalid PSR setup time (0x%02x)\n",
> > + intel_dp->psr_dpcd[1]);
> > + return false;
> > + }
> > +
> > + if (intel_usecs_to_scanlines(adjusted_mode, psr_setup_time) >
> > + adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vdisplay - 1) {
> > + DRM_DEBUG_KMS("PSR condition failed: PSR setup time (%d us) too long\n",
> > + psr_setup_time);
> > + return false;
> > + }
> > +
> > dev_priv->psr.source_ok = true;
> > return true;
> > }
> > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> > index 324ccb06397d..293b48007006 100644
> > --- a/drivers/gpu/drm/i915/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/intel_sprite.c
> > @@ -53,8 +53,8 @@ format_is_yuv(uint32_t format)
> > }
> > }
> >
> > -static int usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
> > - int usecs)
> > +int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
> > + int usecs)
> > {
> > /* paranoia */
> > if (!adjusted_mode->crtc_htotal)
> > @@ -91,7 +91,7 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
> > vblank_start = DIV_ROUND_UP(vblank_start, 2);
> >
> > /* FIXME needs to be calibrated sensibly */
> > - min = vblank_start - usecs_to_scanlines(adjusted_mode, 100);
> > + min = vblank_start - intel_usecs_to_scanlines(adjusted_mode, 100);
> > max = vblank_start - 1;
> >
> > local_irq_disable();
> > --
> > 2.7.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
>
> --
> Rodrigo Vivi
> Blog: http://blog.vivi.eng.br
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-08-08 7:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 15:50 [PATCH 0/6] drm/i915: Remaining PSR fixes ville.syrjala
2016-05-31 15:50 ` [PATCH v2 1/6] drm/dp: Add drm_dp_psr_setup_time() ville.syrjala
2016-05-31 15:50 ` [PATCH v2 2/6] drm/dp: Add drm_dp_psr_need_train_on_exit() ville.syrjala
2016-05-31 15:50 ` [PATCH 3/6] drm/i915: Check PSR setup time vs. vblank length ville.syrjala
2016-08-05 22:10 ` [Intel-gfx] " Rodrigo Vivi
2016-08-08 7:38 ` Ville Syrjälä [this message]
2016-08-08 8:33 ` Jani Nikula
2016-08-25 21:39 ` [Intel-gfx] " Rodrigo Vivi
2016-05-31 15:50 ` [PATCH 4/6] drm/i915/psr: Skip aux handeshake if the vbt tells us to ville.syrjala
2016-05-31 15:50 ` [PATCH 5/6] drm/i915: Ask the sink whether training is required when exiting PSR main-link off mode ville.syrjala
2016-05-31 15:50 ` [PATCH 6/6] drm/i915: Move psr.link_standby setup to intel_psr_match_conditions() ville.syrjala
2016-05-31 19:07 ` [PATCH 0/6] drm/i915: Remaining PSR fixes Daniel Vetter
2016-05-31 19:16 ` Ville Syrjälä
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=20160808073827.GY4329@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=arthur.j.runyan@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rodrigo.vivi@gmail.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).