All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: Precise vblank timestamping for VC4 kms.
Date: Thu, 23 Jun 2016 08:17:49 +0200	[thread overview]
Message-ID: <1466662670-9884-1-git-send-email-mario.kleiner.de@gmail.com> (raw)

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.

Eric: In the patch i need to calculate fifo_lines as the capacity
of what seems to be a multi-line fifo line buffer for composited output
scanlines between the HVS and the PV, or maybe an input fifo between
the framebuffer(s) and the HVS? The formula i currently use is ad-hoc,
found by trial and error. It works reasonably well for a range of
video modes i could test with my measurement equipment, but it would
be good to replace it by one that is actually accurately derived from
your hardware docs.

Other than that, this should be good to go.

thanks,
-mario

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-06-23  6:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23  6:17 Mario Kleiner [this message]
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ä

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=1466662670-9884-1-git-send-email-mario.kleiner.de@gmail.com \
    --to=mario.kleiner.de@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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.