]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: uvcvideo: Fix hw timestamp handling for slow FPS
authorRicardo Ribalda <ribalda@chromium.org>
Mon, 10 Jun 2024 19:17:48 +0000 (19:17 +0000)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 16 Jun 2024 23:39:09 +0000 (02:39 +0300)
commit53d7995383fae089319e24636250f248b0fdb0ce
treed9e401fa025f9effd8383385fbe8c0e684937a09
parent141270bd95d48ea77adf2ea851e0621dc6725782
media: uvcvideo: Fix hw timestamp handling for slow FPS

In UVC 1.5 we get a single clock value per frame. With the current
buffer size of 32, FPS slowers than 32 might roll-over twice.

The current code cannot handle two roll-over and provide invalid
timestamps.

Revome all the samples from the circular buffer that are more than two
rollovers old, so the algorithm always provides good timestamps.

Note that we are removing values that are more than one second old,
which means that there is enough distance between the two points that
we use for the interpolation to provide good values.

Tested-by: HungNien Chen <hn.chen@sunplusit.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240610-hwtimestamp-followup-v1-1-f9eaed7be7f0@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/media/usb/uvc/uvc_video.c
drivers/media/usb/uvc/uvcvideo.h