All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel@daenzer.net>
To: Andrew Lutomirski <luto@mit.edu>
Cc: dri-devel@lists.freedesktop.org,
	Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Subject: Re: [PATCH] drm: Aggressively disable vblanks
Date: Mon, 27 Dec 2010 11:52:09 +0100	[thread overview]
Message-ID: <1293447129.19556.203.camel@thor.local> (raw)
In-Reply-To: <AANLkTikhJ0MRf9tuk6zHgbiUeD3pPyy5J7ZU2Uw01ytR@mail.gmail.com>

On Son, 2010-12-26 at 09:53 -0500, Andrew Lutomirski wrote: 
> On Wed, Dec 22, 2010 at 4:06 PM, Mario Kleiner
> <mario.kleiner@tuebingen.mpg.de> wrote:
> >
> > There's a new drm module parameter for selecting the timeout: echo 50 >
> > /sys/module/drm/parameters/vblankoffdelay
> > would set the timeout to 50 msecs. A setting of zero will disable the timer,
> > so vblank irq's would stay on all the time.
> >
> > The default setting is still 5000 msecs as before, but reducing this to 100
> > msecs wouldn't be a real problem imho. At least i didn't observe any
> > miscounting during extensive testing with 100 msecs.
> >
> > The patches in drm-next fix a couple of races that i observed on intel and
> > radeon during testing and a few that i didn't see but that i could imagine
> > happening. It tries to make sure that the saved final count at vblank irq
> > disable of the software vblank_count and the gpu counter are consistent - no
> > off by one errors. They also try to detect and filter out spurious vblank
> > interrupts at vblank enable time, e.g., on the radeon.
> >
> > There's still one possible race in the disable path which i will try to fix:
> > We don't know when exactly the hardware counter increments wrt. the
> > processing of the vblank interrupt - it could increment a few
> > (dozen/hundred) microseconds before or after the irq handler runs, so if you
> > happen to query the hardware counter while the gpu is inside the vblank you
> > can't be sure if you picked up the old count or the new count for that
> > vblank.
> 
> That's disgusting.  Does this affect many GPUs?  (I can't imagine why
> any sensible implementation wouldn't guarantee that the counter
> increments just before the IRQ.)

Actually, while we want the interrupt to trigger at the beginning of
vblank (so we get a chance to do work within the vblank period), at
least on Radeons, the hardware frame counter increments at the beginning
of scanout, i.e. at the end of vblank.

At some point we tried to compensate for that by adding 1 to the
hardware frame counter while inside vblank, but IIRC that wasn't 100%
reliable either but would sometimes result in the counter being
considered too high by 1. So instead we've tried to keep the
infrastructure robust against the interrupt and hardware frame counter
increment not necessarily occurring at the same time.

(Even if both events always occurred at the same time on the GPU, we
might not be able to take advantage of that due to interrupt latencies)


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2010-12-27 10:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.28.1292917668.19577.dri-devel@lists.freedesktop.org>
2010-12-22  4:36 ` [Intel-gfx] [PATCH] drm: Aggressively disable vblanks Mario Kleiner
2010-12-22 17:23   ` Jesse Barnes
2010-12-22 21:06     ` Mario Kleiner
2010-12-26 14:53       ` Andrew Lutomirski
2010-12-26 23:58         ` Mario Kleiner
2010-12-27 11:16           ` Ville Syrjälä
2010-12-27 21:30             ` Mario Kleiner
2011-01-10  2:24           ` Andrew Lutomirski
2010-12-27 10:52         ` Michel Dänzer [this message]
2010-12-20 19:00 Andy Lutomirski
2010-12-21  3:23 ` Keith Packard
2010-12-21  3:34   ` [Intel-gfx] " Andrew Lutomirski
2010-12-21  3:47     ` Keith Packard
2010-12-21  3:55       ` Andrew Lutomirski
2010-12-21  4:03         ` 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=1293447129.19556.203.camel@thor.local \
    --to=michel@daenzer.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=luto@mit.edu \
    --cc=mario.kleiner@tuebingen.mpg.de \
    /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.