All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: Precise vblank timestamping for VC4 kms.
Date: Thu, 23 Jun 2016 16:18:59 +0300	[thread overview]
Message-ID: <20160623131859.GH4329@intel.com> (raw)
In-Reply-To: <1466662670-9884-1-git-send-email-mario.kleiner.de@gmail.com>

On Thu, Jun 23, 2016 at 08:17:49AM +0200, Mario Kleiner wrote:
> The following patch implements precise vblank timestamping
> for RaspberryPi's VC4, at least for standard progressive
> scan display modes.
> 
> It has been tested on the HDMI output with half a dozen different
> video modes using special hardware measurement equipment to compare
> generated time stamps against reality. According to the tests it
> works well in its current form.
> 
> Due to hw limitations of the VC4, timestamps can't be scanline
> accurate when taken within vblank, as explained in the patch,
> but at least they will never be off by more than 1 vblank
> duration, and are typically still accurate to ~0.1 msecs
> for the common case when the timestamping is triggered from
> vblank interrupt.
> 
> The patch exposed some problems with how the drm core handles
> calculation of vblank timestamping constants for interlaced
> video modes in drm_calc_timestamping_constants(). Seems it cuts
> the expected frame duration framedur_ns into half for interlaced
> modes two times, so it ends up expecting a field duration half
> of what it should be and then miscalculates vblank counter increments
> as soon as vblank timestamping is supported and the core tries to
> derive vblank counts from it. To work around this bug, for the
> moment the vblank timestamping will disable itself for interlaced
> modes and only work for regular progressive scan.

The code should be correct for i915. The framedur_ns is actually the
duration of a single field (since we get a vblank interrupt for each
field). But it's going to be wrong for anyone that populates the
crtc_ timings with CRTC_INTERLACE_HALVE_V. So to fix it, you'd need
the driver to tell drm_calc_timestamping_constants() whether the
vertical timings were already halved or not.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2016-06-23 13:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23  6:17 Precise vblank timestamping for VC4 kms Mario Kleiner
2016-06-23  6:17 ` [PATCH] drm/vc4: Implement precise vblank timestamping Mario Kleiner
2016-07-08  2:31   ` Eric Anholt
2016-07-08 18:44   ` [PATCH 1/2] drm/vc4: Bind the HVS before we bind the individual CRTCs Eric Anholt
2016-07-08 18:44     ` Eric Anholt
2016-07-08 18:44     ` [PATCH 2/2] drm/vc4: Squash commit for Mario's precise vblank timestamping Eric Anholt
2016-07-08 18:44       ` Eric Anholt
2016-07-09 17:09       ` Mario Kleiner
2016-07-09 17:09         ` Mario Kleiner
2016-07-10 16:05         ` Eric Anholt
2016-07-10 16:05           ` Eric Anholt
2016-06-23  7:28 ` Precise vblank timestamping for VC4 kms Daniel Vetter
2016-06-27 10:31   ` Mario Kleiner
2016-06-23 13:18 ` Ville Syrjälä [this message]

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=20160623131859.GH4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mario.kleiner.de@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 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.