V4L/DVB (13827): uvcvideo: Switch to a monotonic clock for V4L2 buffers timestamps
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 10 Dec 2009 01:57:48 +0000 (22:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:24 +0000 (15:10 -0300)
commit310fe52461e6244b01a04b011c2e886d6b69de16
treee75b1f25bbf77747d49f183f618ffa4831d4846b
parent0f7ff39532f1d2328e54b65ce5022c71f06e44d6
V4L/DVB (13827): uvcvideo: Switch to a monotonic clock for V4L2 buffers timestamps

The realtime clock provided by do_gettimeofday() is affected by time
jumps caused by NTP or DST. Furthermore, preliminary investigation
showed that SMP systems the realtime clock is based on the CPU TSC,
and those could get slightly out of sync, resulting in jitter in the
timestamps depending on which processor handles the USB interrupts.

Instead of the realtime clock, use a monotonic high resolution clock to
timestamp the buffer. As this could in theory introduce a regression
with some userspace applications expecting a realtime clock timestamp,
add a module parameter to switch back to the realtime clock.

Thanks to Paulo Assis for pointing out and investigating the issue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_driver.c
drivers/media/video/uvc/uvc_queue.c
drivers/media/video/uvc/uvc_video.c
drivers/media/video/uvc/uvcvideo.h