public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org, k.debski@samsung.com
Subject: Re: [PATCH v2 1/1] v4l: Document timestamp behaviour to correspond to reality
Date: Sat, 08 Jun 2013 18:43:10 +0200	[thread overview]
Message-ID: <1732074.vUfkmKHbt9@avalon> (raw)
In-Reply-To: <20130608163142.GI3103@valkosipuli.retiisi.org.uk>

Hi Sakari,

On Saturday 08 June 2013 19:31:43 Sakari Ailus wrote:
> On Sat, Jun 08, 2013 at 08:59:43AM +0200, Laurent Pinchart wrote:
> > On Friday 07 June 2013 17:21:52 Hans Verkuil wrote:
> > > On Sat March 23 2013 23:04:34 Sakari Ailus wrote:
> > > > Document that monotonic timestamps are taken after the corresponding
> > > > frame has been received, not when the reception has begun. This
> > > > corresponds to the reality of current drivers: the timestamp is
> > > > naturally taken when the hardware triggers an interrupt to tell the
> > > > driver to handle the received frame.
> > > > 
> > > > Remove the note on timestamp accurary as it is fairly subjective what
> > > > is actually an unstable timestamp.
> > > > 
> > > > Also remove explanation that output buffer timestamps can be used to
> > > > delay outputting a frame.
> > > > 
> > > > Remove the footnote saying we always use realtime clock.
> > > > 
> > > > Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> > > 
> > > Sorry for the delay, for some reason this patch wasn't picked up by
> > > patchwork.
> > > 
> > > > ---
> > > > Hi all,
> > > > 
> > > > This is the second version of the patch fixing timestamp behaviour
> > > > documentation. I've tried to address the comments I've received albeit
> > > > I don't think there was a definitive conclusion on all the trails of
> > > > discussion. What has changed since v1 is:
> > > > 
> > > > - Removed discussion on timestamp stability.
> > > > 
> > > > - Removed notes that timestamps on output buffers define when frames
> > > >   will be displayed. It appears no driver has ever implemented this,
> > > >   or at least does not implement this now.
> > > > 
> > > > - Monotonic time is not affected by harms that the wall clock time is
> > > > 
> > > >   subjected to. Remove notes on that.
> > > >  
> > > >  Documentation/DocBook/media/v4l/io.xml |   47 ++++-------------------
> > > >  1 file changed, 8 insertions(+), 39 deletions(-)
> > > > 
> > > > diff --git a/Documentation/DocBook/media/v4l/io.xml
> > > > b/Documentation/DocBook/media/v4l/io.xml index e6c5855..46d5a41 100644
> > > > --- a/Documentation/DocBook/media/v4l/io.xml
> > > > +++ b/Documentation/DocBook/media/v4l/io.xml
> > 
> > [snip]
> > 
> > > > @@ -745,13 +718,9 @@ applications when an output stream.</entry>
> > > > 
> > > >  	    byte was captured, as returned by the
> > > >  	    <function>clock_gettime()</function> function for the relevant
> > > >  	    clock id; see <constant>V4L2_BUF_FLAG_TIMESTAMP_*</constant> in
> > > > 
> > > > -	    <xref linkend="buffer-flags" />. For output streams the data
> > > > -	    will not be displayed before this time, secondary to the nominal
> > > > -	    frame rate determined by the current video standard in enqueued
> > > > -	    order. Applications can for example zero this field to display
> > > > -	    frames as soon as possible. The driver stores the time at which
> > > > -	    the first data byte was actually sent out in the
> > > > -	    <structfield>timestamp</structfield> field. This permits
> > > > +	    <xref linkend="buffer-flags" />. For output streams he driver
> > > 
> > > 'he' -> 'the'
> > > 
> > > > +	   stores the time at which the first data byte was actually sent
> > > > out
> > > > +	   in the  <structfield>timestamp</structfield> field. This permits
> > > 
> > > Not true: the timestamp is taken after the whole frame was transmitted.
> > > 
> > > Note that the 'timestamp' field documentation still says that it is the
> > > timestamp of the first data byte for capture as well, that's also wrong.
> > 
> > I know we've already discussed this, but what about devices, such as
> > uvcvideo, that can provide the time stamp at which the image has been
> > captured ? I don't think it would be worth it making this configurable,
> > or even reporting the information to userspace, but shouldn't we give
> > some degree of freedom to drivers here ?
> 
> Hmm. That's a good question --- if we allow variation then we preferrably
> should also provide a way for applications to know which case is which.
> 
> Could the uvcvideo timestamps be meaningfully converted to the frame end
> time instead? I'd suppose that a frame rate dependent constant would
> suffice. However, how to calculate this I don't know.

I don't think that's a good idea. The time at which the last byte of the image 
is received is meaningless to applications. What they care about, for 
synchronization purpose, is the time at which the image has been captured.

I'm wondering if we really need to care for now. I would be enclined to leave 
it as-is until an application runs into a real issue related to timestamps.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2013-06-08 16:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 22:04 [PATCH v2 1/1] v4l: Document timestamp behaviour to correspond to reality Sakari Ailus
2013-05-10 15:25 ` Sakari Ailus
2013-06-07 15:21 ` Hans Verkuil
2013-06-07 22:47   ` Sakari Ailus
2013-06-08  6:59   ` Laurent Pinchart
2013-06-08 16:31     ` Sakari Ailus
2013-06-08 16:43       ` Laurent Pinchart [this message]
2013-06-09 22:35         ` Sakari Ailus
2013-06-10 11:29           ` Hans Verkuil
2013-06-18 19:55             ` Laurent Pinchart
2013-06-19  5:58               ` Hans Verkuil
2013-08-21 11:34             ` 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=1732074.vUfkmKHbt9@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil@xs4all.nl \
    --cc=k.debski@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --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