linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <tfiga@chromium.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Alexandru Stan <amstan@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Heng-Ruey Hsu <henryhsu@chromium.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ricky Liang <jcliang@chromium.org>,
	linux-iio@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH] media: uvcvideo: Add boottime clock support
Date: Thu, 1 Nov 2018 23:30:26 +0900	[thread overview]
Message-ID: <CAAFQd5A7k2VgmawF-x=AcKhJiG-shrJiCP4Tu9054J0eE91+9w@mail.gmail.com> (raw)
In-Reply-To: <1610184.U7oo9Z4Yep@avalon>

On Thu, Nov 1, 2018 at 11:03 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Alexandru,
>
> On Thursday, 18 October 2018 20:28:06 EET Alexandru M Stan wrote:
> > On Wed, Oct 17, 2018 at 9:31 PM, Tomasz Figa wrote:
> > > On Thu, Oct 18, 2018 at 5:50 AM Laurent Pinchart wrote:
> > >> On Wednesday, 17 October 2018 11:28:52 EEST Tomasz Figa wrote:
> > >>> On Wed, Oct 17, 2018 at 5:02 PM Laurent Pinchart wrote:
> > >>>> On Wednesday, 17 October 2018 10:52:42 EEST Heng-Ruey Hsu wrote:
> > >>>>> Android requires camera timestamps to be reported with
> > >>>>> CLOCK_BOOTTIME to sync timestamp with other sensor sources.
> > >>>>
> > >>>> What's the rationale behind this, why can't CLOCK_MONOTONIC work ? If
> > >>>> the monotonic clock has shortcomings that make its use impossible for
> > >>>> proper synchronization, then we should consider switching to
> > >>>> CLOCK_BOOTTIME globally in V4L2, not in selected drivers only.
> > >>>
> > >>> CLOCK_BOOTTIME includes the time spent in suspend, while
> > >>> CLOCK_MONOTONIC doesn't. I can imagine the former being much more
> > >>> useful for anything that cares about the actual, long term, time
> > >>> tracking. Especially important since suspend is a very common event on
> > >>> Android and doesn't stop the time flow there, i.e. applications might
> > >>> wake up the device to perform various tasks at necessary times.
> > >>
> > >> Sure, but this patch mentions timestamp synchronization with other
> > >> sensors, and from that point of view, I'd like to know what is wrong with
> > >> the monotonic clock if all devices use it.
> > >
> > > AFAIK the sensors mentioned there are not camera sensors, but rather
> > > things we normally put under IIO, e.g. accelerometers, gyroscopes and
> > > so on. I'm not sure how IIO deals with timestamps, but Android seems
> > > to operate in the CLOCK_BOTTIME domain. Let me add some IIO folks.
> > >
> > > Gwendal, Alexandru, do you think you could shed some light on how we
> > > handle IIO sensors timestamps across the kernel, Chrome OS and
> > > Android?
> >
> > On our devices of interest have a specialized "sensor" that comes via
> > IIO (from the EC, cros-ec-ring driver) that can be used to more
> > accurately timestamp each frame (since it's recorded with very low
> > jitter by a realtime-ish OS). In some high level userspace thing
> > (specifically the Android Camera HAL) we try to pick the best
> > timestamp from the IIO, whatever's closest to what the V4L stuff gives
> > us.
> >
> > I guess the Android convention is for sensor timestamps to be in
> > CLOCK_BOOTTIME (maybe because it likes sleeping so much). There's
> > probably no advantage to using one over the other, but the important
> > thing is that they have to be the same, otherwise the closest match
> > logic would fail.
>
> That's my understanding too, I don't think CLOCK_BOOTTIME really brings much
> benefit in this case,

I think it does have a significant benefit. CLOCK_MONOTONIC stops when
the device is sleeping, but the sensors can still capture various
actions. We would lose the time keeping of those actions if we use
CLOCK_MONOTONIC.

> but it's important than all timestamps use the same
> clock. The question is thus which clock we should select. Mainline mostly uses
> CLOCK_MONOTONIC, and Android CLOCK_BOOTTIME. Would you like to submit patches
> to switch Android to CLOCK_MONOTONIC ? :-)

Is it Android using CLOCK_BOOTTIME or the sensors (IIO?). I have
almost zero familiarity with the IIO subsystem and was hoping someone
from there could comment on what time domain is used for those
sensors.

Best regards,
Tomasz

  reply	other threads:[~2018-11-01 23:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17  7:52 [PATCH] media: uvcvideo: Add boottime clock support Heng-Ruey Hsu
2018-10-17  8:02 ` Laurent Pinchart
2018-10-17  8:28   ` Tomasz Figa
2018-10-17 20:50     ` Laurent Pinchart
2018-10-18  4:31       ` Tomasz Figa
2018-10-18 17:28         ` Alexandru M Stan
2018-11-01 14:03           ` Laurent Pinchart
2018-11-01 14:30             ` Tomasz Figa [this message]
2018-11-01 15:03               ` Lars-Peter Clausen
2018-11-23 14:46                 ` Tomasz Figa
2019-03-06  6:09                   ` Tomasz Figa
2019-03-13  1:24                   ` Laurent Pinchart
2019-03-13  2:38                     ` Tomasz Figa
2019-08-06  4:15                       ` Tomasz Figa
2019-08-06  8:34                         ` Kieran Bingham
2019-08-07 13:38                           ` Tomasz Figa

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='CAAFQd5A7k2VgmawF-x=AcKhJiG-shrJiCP4Tu9054J0eE91+9w@mail.gmail.com' \
    --to=tfiga@chromium.org \
    --cc=amstan@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=henryhsu@chromium.org \
    --cc=jcliang@chromium.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).