From: "Daniel Glöckner" <daniel-gl@gmx.net>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: "Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Rémi Denis-Courmont" <remi@remlab.net>,
"Linux Media Mailing List" <linux-media@vger.kernel.org>
Subject: Re: [RFC] Monotonic clock usage in buffer timestamps
Date: Wed, 2 Nov 2011 11:58:04 +0100 [thread overview]
Message-ID: <20111102105804.GA15491@minime.bse> (raw)
In-Reply-To: <20111102101449.GC22159@valkosipuli.localdomain>
On Wed, Nov 02, 2011 at 12:14:49PM +0200, Sakari Ailus wrote:
> > How about making all drivers record monotonic timestamps and doing
> > the conversion to/from realtime timestamps in v4l2-ioctl.c's
> > __video_do_ioctl if requested? We then just need an extension of the
> > spec to switch to monotonic, which can be implemented without touching
> > a single driver.
>
> Converting between the two can be done when making the timestamp but it's
> non-trivial at other times and likely isn't supported. I could be wrong,
> though. This might lead to e.g. timestamps that are taken before switching
> to summer time and for which the conversion is done after the switch. This
> might be a theoretical possibility, but there might be also unfavourable
> interaction with the NTP.
Summertime/wintertime is purely a userspace thing. UTC as returned by
gettimeofday is unaffected by that.
NTP AFAIK adjusts the speed of the monotonic clock, so there is a constant
delta between wall clock time and clock monotonic unless there is a leap
second or someone calls settimeofday. Applications currently using the
wall clock timestamps should have trouble dealing with that as well.
> I'd probably rather just make a new timestamp in wall clock time in
> v4l2-ioctl.c if needed using do_gettimeofday().
I think that would be worse than subtracting ktime_get_monotonic_offset().
You don't know the delay between capturing a frame and calling dqbuf.
If there is a settimeofday between capturing a frame and calling dqbuf,
the wall time clock was probably wrong when the frame was captured
and subtracting the new ktime_get_monotonic_offset() yields a better
timestamp.
> Or just do the wall clock timestamps user space as they are typically
> critical in timing.
>
> How would this work for you?
As I keep the cpu busy with video encoding in the same thread, I'd expect
a high jitter from taking timestamps in userspace.
Daniel
next prev parent reply other threads:[~2011-11-02 10:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 12:24 [RFC] Monotonic clock usage in buffer timestamps Laurent Pinchart
2011-11-01 12:36 ` Rémi Denis-Courmont
2011-11-01 12:49 ` Laurent Pinchart
2011-11-02 9:10 ` Daniel Glöckner
2011-11-02 10:14 ` Sakari Ailus
2011-11-02 10:51 ` Laurent Pinchart
2011-11-02 10:58 ` Daniel Glöckner [this message]
2011-11-02 11:16 ` Rémi Denis-Courmont
2011-11-02 12:47 ` Sakari Ailus
2011-11-02 12:32 ` Sakari Ailus
2011-11-02 10:04 ` Sakari Ailus
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=20111102105804.GA15491@minime.bse \
--to=daniel-gl@gmx.net \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=remi@remlab.net \
--cc=sakari.ailus@iki.fi \
/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