Re: [RFC PATCH v8 1/6] media: videobuf2: Move timestamp to vb2_buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/02/2015 05:43 AM, Junghak Sung wrote:
> Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer
> for common use, and change its type to struct timespec in order to handling
> y2038 problem. This patch also includes all device drivers' changes related to
> this restructuring.
> 
> Signed-off-by: Junghak Sung <jh1009.sung@xxxxxxxxxxx>
> Signed-off-by: Geunyoung Kim <nenggun.kim@xxxxxxxxxxx>
> Acked-by: Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx>
> Acked-by: Inki Dae <inki.dae@xxxxxxxxxxx>
> ---

<snip>

> diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
> index 51d4a17..34525dc 100644
> --- a/drivers/usb/gadget/function/uvc_queue.c
> +++ b/drivers/usb/gadget/function/uvc_queue.c
> @@ -329,7 +329,7 @@ struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue,
>  
>  	buf->buf.field = V4L2_FIELD_NONE;
>  	buf->buf.sequence = queue->sequence++;
> -	v4l2_get_timestamp(&buf->buf.timestamp);
> +	ktime_get_ts(&buf->buf.vb2_buf.timestamp);
>  
>  	vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused);
>  	vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_DONE);
> diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
> index 647ebfe..3fe6600 100644
> --- a/include/media/videobuf2-core.h
> +++ b/include/media/videobuf2-core.h
> @@ -211,6 +211,7 @@ struct vb2_queue;
>   * @num_planes:		number of planes in the buffer
>   *			on an internal driver queue
>   * @planes:		private per-plane information; do not change
> + * @timestamp:		frame timestamp
>   */
>  struct vb2_buffer {
>  	struct vb2_queue	*vb2_queue;
> @@ -219,6 +220,7 @@ struct vb2_buffer {
>  	unsigned int		memory;
>  	unsigned int		num_planes;
>  	struct vb2_plane	planes[VB2_MAX_PLANES];
> +	struct timespec		timestamp;

This should be a __u64 containing nanoseconds. That is the recommended way of
storing timestamps according to the y2038 team. The timespec struct is not
y2038 safe, whereas using __u64 is OK.

Please change!

And instead of using ktime_get_ts() in drivers use ktime_get_ns().

Regards,

	Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux