From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 10/9] drm: Add dev->vblank_disable_immediate flag
Date: Tue, 29 Jul 2014 20:31:55 +0300 [thread overview]
Message-ID: <20140729173155.GZ27580@intel.com> (raw)
In-Reply-To: <20140620004124.GG18027@intel.com>
On Thu, Jun 19, 2014 at 05:41:24PM -0700, Matt Roper wrote:
> On Mon, May 26, 2014 at 05:26:47PM +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Add a flag to drm_device which will cause the vblank code to bypass the
> > disable timer and always disable the vblank interrupt immediately when
> > the last reference is dropped.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > drivers/gpu/drm/drm_irq.c | 6 +++---
> > include/drm/drmP.h | 10 ++++++++++
> > 2 files changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> > index 20a4855..b008803 100644
> > --- a/drivers/gpu/drm/drm_irq.c
> > +++ b/drivers/gpu/drm/drm_irq.c
> > @@ -994,11 +994,11 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
> >
> > /* Last user schedules interrupt disable */
> > if (atomic_dec_and_test(&vblank->refcount)) {
> > - if (drm_vblank_offdelay > 0)
> > + if (dev->vblank_disable_immediate || drm_vblank_offdelay == 0)
> > + vblank_disable_fn((unsigned long)vblank);
> > + else if (drm_vblank_offdelay > 0)
> > mod_timer(&vblank->disable_timer,
> > jiffies + ((drm_vblank_offdelay * HZ)/1000));
> > - else if (drm_vblank_offdelay == 0)
> > - vblank_disable_fn((unsigned long)vblank);
> > }
> > }
> > EXPORT_SYMBOL(drm_vblank_put);
>
> Would it be better if we just squashed this device flag logic back into
> patch 7, but kept the drm_vblank_offdelay == 0 meaning of "never
> disable?" I can see there being people who might already use this when
> debugging new and potentially flaky hardware platforms who would be
> surprised by the change in behavior. So basically something like:
>
> if (drm_vblank_offdelay == 0)
> return
> else if (dev->vblank_disable_immediate)
> vblank_disable_fn((unsigned long)vblank);
> else
> mod_timer(...);
I'm not sure I want drm_vblank_offdelay affecting drivers that have
vblank_disable_immediate set since it's a global variable. If there
are two devices on the system where one has
vblank_disable_immediate==true and the other doesn't, the user
might want to keep vblank interrupts enabled on the crappy device
all time by frobbing drm_vblank_offdelay.
I agree that changing the meaning of drm_vblank_offdelay=0 is a bit
questionable, but reversing the meaning so that '==0' meas 'never disable'
and '<0' means 'disable immediately' seemed a bit weird for my taste. But
I suppose I could make that change if people think it's better. Or maybe
just forget about the 'disable immediately' behaviour when
vblank_disable_immediate==false?
> I'd also suggest adding a comment in drm_stub.c to indicate that
> drm_vblank_offdelay gets ignored for drivers that set
> vblank_disable_immediate.
Good idea.
>
> Other than that, patches 1-8, 10, and 11 are
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
>
> I'll finish up reviewing #9 and 12-14 tomorrow when I have some more
> time.
>
>
>
> Matt
>
>
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 979a498..0944544 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -1117,6 +1117,16 @@ struct drm_device {
> > */
> > bool vblank_disable_allowed;
> >
> > + /*
> > + * If true, vblank interrupt will be disabled immediately when the
> > + * refcount drops to zero, as opposed to via the vblank disable
> > + * timer.
> > + * This can be set to true it the hardware has a working vblank
> > + * counter and the driver uses drm_vblank_on() and drm_vblank_off()
> > + * appropriately.
> > + */
> > + bool vblank_disable_immediate;
> > +
> > /* array of size num_crtcs */
> > struct drm_vblank_crtc *vblank;
> >
> > --
> > 1.8.5.5
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Matt Roper
> Graphics Software Engineer
> IoTG Platform Enabling & Development
> Intel Corporation
> (916) 356-2795
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2014-07-29 17:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 11:46 [PATCH 0/9] drm: More vblank on/off work ville.syrjala
2014-05-26 11:46 ` [PATCH 1/9] drm: Always reject drm_vblank_get() after drm_vblank_off() ville.syrjala
2014-05-26 13:21 ` Daniel Vetter
2014-05-26 13:32 ` Ville Syrjälä
2014-05-26 13:47 ` Daniel Vetter
2014-05-26 11:46 ` [PATCH 2/9] drm/i915: Warn if drm_vblank_get() still works " ville.syrjala
2014-05-26 13:22 ` Daniel Vetter
2014-05-26 13:36 ` Ville Syrjälä
2014-05-26 13:48 ` Daniel Vetter
2014-05-26 13:49 ` [PATCH v2 " ville.syrjala
2014-05-26 13:54 ` Daniel Vetter
2014-05-26 11:46 ` [PATCH 3/9] drm: Don't clear vblank timestamps when vblank interrupt is disabled ville.syrjala
2014-05-26 13:24 ` Daniel Vetter
2014-05-26 11:46 ` [PATCH 4/9] drm: Move drm_update_vblank_count() ville.syrjala
2014-05-26 11:46 ` [PATCH 5/9] drm: Have the vblank counter account for the time between vblank irq disable and drm_vblank_off() ville.syrjala
2014-05-26 13:27 ` Daniel Vetter
2014-05-26 11:46 ` [PATCH 6/9] drm: Avoid random vblank counter jumps if the hardware counter has been reset ville.syrjala
2014-05-26 13:28 ` Daniel Vetter
2014-05-26 11:46 ` [PATCH 7/9] drm: Disable vblank interrupt immediately when drm_vblank_offdelay==0 ville.syrjala
2014-05-26 13:02 ` [Intel-gfx] " Daniel Vetter
2014-05-26 14:26 ` [PATCH 10/9] drm: Add dev->vblank_disable_immediate flag ville.syrjala
2014-05-26 14:26 ` [PATCH 11/9] drm/i915: Opt out of vblank disable timer on >gen2 ville.syrjala
2014-05-26 15:31 ` Daniel Vetter
2014-05-26 19:27 ` Daniel Vetter
2015-11-19 19:44 ` [Intel-gfx] " Paulo Zanoni
2015-11-19 20:06 ` Ville Syrjälä
2015-11-19 20:35 ` Paulo Zanoni
2015-11-19 20:53 ` Ville Syrjälä
2015-11-19 21:15 ` Ville Syrjälä
2015-11-19 21:27 ` [Intel-gfx] " Chris Wilson
2014-06-20 0:41 ` [PATCH 10/9] drm: Add dev->vblank_disable_immediate flag Matt Roper
2014-07-29 17:31 ` Ville Syrjälä [this message]
2014-07-29 17:57 ` Daniel Vetter
2014-05-26 16:06 ` [PATCH v2 1/9] drm: Always reject drm_vblank_get() after drm_vblank_off() ville.syrjala
2014-05-26 11:46 ` [PATCH 8/9] drm: Reduce the amount of dev->vblank[crtc] in the code ville.syrjala
2014-05-26 13:31 ` Daniel Vetter
2014-05-26 11:46 ` [PATCH v2 9/9] drm/i915: Leave interrupts enabled while disabling crtcs during suspend ville.syrjala
2014-05-26 15:49 ` Daniel Vetter
2014-06-20 18:10 ` Matt Roper
2014-06-02 8:15 ` [PATCH 12/9] drm: Fix deadlock between event_lock and vbl_lock/vblank_time_lock ville.syrjala
2014-06-02 8:15 ` [PATCH 13/9] drm: Fix race between drm_vblank_off() and drm_queue_vblank_event() ville.syrjala
2014-06-02 8:15 ` [PATCH 14/9] drm: Kick start vblank interrupts at drm_vblank_on() ville.syrjala
2014-06-20 18:29 ` Matt Roper
2014-06-26 16:32 ` [PATCH 0/9] drm: More vblank on/off work Jesse Barnes
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=20140729173155.GZ27580@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.d.roper@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