From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Subject: Re: [PATCH 3/3] drm/i915: Improve the accuracy of get_scanout_pos on CTG+
Date: Wed, 25 Sep 2013 10:46:27 +0200 [thread overview]
Message-ID: <20130925084627.GJ12663@phenom.ffwll.local> (raw)
In-Reply-To: <20130925081130.GJ4531@intel.com>
On Wed, Sep 25, 2013 at 11:11:30AM +0300, Ville Syrjälä wrote:
> On Wed, Sep 25, 2013 at 05:12:54AM +0200, Mario Kleiner wrote:
> > This one i don't know. I think i can't follow the logic, but i don't
> > know enough about the way the intel hw counts.
> >
> > Do you mean the counter increments when the scanline is over, instead of
> > when it begins?
>
> Let me draw a picture of the scanline (not to scale):
>
> |XXXXXXXXXXXXX|-----|___________|---|
> horiz. active horiz. sync
> ^ ^
> | |
> first pixel this is where the
> of the line scanline counter increments
>
> > With this correction by +1 at the edges of vblank, the scanlines at
> > vbl_start and vbl_end would be reported twice, for two successive
> > scanline durations, that seems a bit weird and asymmetric to the rest of
> > the scanline positions. Wouldn't it make more sense to simply always add
> > 1 for a smaller overall error, given that hblank is shorter than the
> > active scanout part of a scanline?
>
> Since the counter increments too late, drm_handle_vblank()
> may get the wrong idea ie. something like this may happen:
>
> 1. vblank irq triggered
> 2. drm_handle_vblank() gets called
> 3. i915_get_crtc_scanoutpos() returns vbl_start-1 as the scanline
> 4. delta_ns calculation gets confused and tries to correct for it
>
> Now, the correction you do for delta_ns should handle this, but
> I don't like having such kludges in common code, and we can handle
> it in the driver as I've demonstrated. But yeah, I suppose it can
> make the error slightly less stable.
>
> For some other uses (atomic page flip stuff) of the scanline position,
> I definitely want this correction since I need accurate information
> whether the position has passed vblank start.
At least on modern platforms I think we should take a good look at the
timestamp registers. With those the only thing we essentially need to do
is to correct the spot where the timestamp is taken to make it suitable
for OML_sync ... But doing such a switch is something for future work ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-09-25 8:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-23 10:02 [PATCH 0/3] drm/i915: i915_get_crtc_scanoutpos improvements ville.syrjala
2013-09-23 10:02 ` [PATCH 1/3] drm/i915: Skip register reads in i915_get_crtc_scanoutpos() ville.syrjala
2013-09-23 10:30 ` Chris Wilson
2013-09-23 11:48 ` [PATCH v2 " ville.syrjala
2013-09-24 9:11 ` Daniel Vetter
2013-09-25 4:45 ` Mario Kleiner
2013-09-25 7:52 ` Daniel Vetter
2013-09-25 2:35 ` Mario Kleiner
2013-09-25 8:14 ` Ville Syrjälä
2013-09-26 16:12 ` Mario Kleiner
2013-09-23 10:02 ` [PATCH 2/3] drm/i915: Fix scanoutpos calculations ville.syrjala
2013-09-25 2:39 ` Mario Kleiner
2013-10-11 14:31 ` Mario Kleiner
2013-10-11 16:10 ` [PATCH v2 " ville.syrjala
2013-10-11 23:19 ` [PATCH " Daniel Vetter
2013-10-11 23:22 ` Mario Kleiner
2013-10-14 15:13 ` Daniel Vetter
2013-09-23 10:02 ` [PATCH 3/3] drm/i915: Improve the accuracy of get_scanout_pos on CTG+ ville.syrjala
2013-09-25 3:12 ` Mario Kleiner
2013-09-25 8:11 ` Ville Syrjälä
2013-09-25 8:46 ` Daniel Vetter [this message]
2013-09-26 17:04 ` Mario Kleiner
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=20130925084627.GJ12663@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mario.kleiner@tuebingen.mpg.de \
--cc=ville.syrjala@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox