From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
Arun R Murthy <arun.r.murthy@intel.com>,
daniel.vetter@ffwll.ch, jani.nikula@linux.intel.com,
intel-gfx@lists.freedesktop.org, airlied@linux.ie
Subject: Re: [PATCHv5] drm/i915: use waitqueue in wait for vblank
Date: Wed, 21 May 2014 11:40:21 +0300 [thread overview]
Message-ID: <20140521084021.GL27580@intel.com> (raw)
In-Reply-To: <20140521075404.GB3409@nuc-i3427.alporthouse.com>
On Wed, May 21, 2014 at 08:54:04AM +0100, Chris Wilson wrote:
> On Wed, May 21, 2014 at 01:09:58PM +0530, Arun R Murthy wrote:
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 56edff3..f97f0fe 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -1513,8 +1513,11 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
> > spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
> >
> > for_each_pipe(pipe) {
> > - if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS)
> > + if (pipe_stats[pipe] &
> > + PIPE_START_VBLANK_INTERRUPT_STATUS) {
> > drm_handle_vblank(dev, pipe);
> > + wake_up_interruptible(&dev_priv->wait_vblank);
>
> We now have intel_handle_vblank() so these chunks can be simplified.
>
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 4d4a0d9..e1eb564 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -757,12 +757,14 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
> > static void g4x_wait_for_vblank(struct drm_device *dev, int pipe)
> > {
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > - u32 frame, frame_reg = PIPE_FRMCOUNT_GM45(pipe);
> > + u32 vblank_cnt;
> >
> > - frame = I915_READ(frame_reg);
> > + vblank_cnt = drm_vblank_count(dev, pipe);
> >
> > - if (wait_for(I915_READ_NOTRACE(frame_reg) != frame, 50))
> > - DRM_DEBUG_KMS("vblank wait timed out\n");
> > + /* TODO: get the vblank time dynamically or from platform data */
> > + wait_event_interruptible_timeout(dev_priv->wait_vblank,
> > + (vblank_cnt != drm_vblank_count(dev, pipe)),
> > + msecs_to_jiffies(16));
>
> Keep the ultimate timeout at 50 until you have evidence you can reduce
> it. And then it should be 2x vrefresh interval to be safe. However, you
> are likely still hitting the timeout as the vblank irq is not guaranteed
> to be enabled here. How safe calling drm_vblank_get() is during modeset
> I defer to Ville since he has just taken a pass over the whole mess.
The plan is to make drm_vblank_get() work until drm_vblank_off() has
been called. And when enabling, drm_vblank_get() will succeed only after
drm_vblank_on() has been called. The place where those should end up is
at the start/end of intel_crtc_{disable,enable}_planes(). So you have
access to vblank irqs while planes are getting enabled/disabled, but no
further since we can't guarantee their function once we start shutting
off pipes/ports/etc.
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2014-05-21 8:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 7:39 [PATCHv5] optimize wait for vblank Arun R Murthy
2014-05-21 7:39 ` [PATCHv5] drm/i915: use waitqueue in " Arun R Murthy
2014-05-21 7:54 ` Chris Wilson
2014-05-21 8:40 ` Ville Syrjälä [this message]
2014-05-21 8:21 ` Daniel Vetter
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=20140521084021.GL27580@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=arun.r.murthy@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.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.