Re: [PATCH v6 3/5] media: uvcvideo: Allow hw clock updates with buffers not full

From: Sergey Senozhatsky
Date: Thu Mar 09 2023 - 21:21:05 EST


On (23/03/09 13:55), Ricardo Ribalda wrote:
[..]
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -754,10 +754,10 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
>
> spin_lock_irqsave(&clock->lock, flags);
>
> - if (clock->count < clock->size)
> + if (clock->count < 2)
> goto done;
>
> - first = &clock->samples[clock->head];
> + first = &clock->samples[(clock->head - clock->count) % clock->size];

This looks like a significant change: `rb->head` and `rb->head - INT`
are quite different things. May I ask for some clarifications?

[..]
> + /*
> + * Have at least 1/4 of a second of timestamps before we
> + * try to do any calculation. Otherwise we do not have enough
> + * precision. This value was determined by running Android CTS
> + * on different devices.
> + */
> + if ((y2 - y1) < (256 << 16))

256 << 16 is 1/4 of a second?