Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16bf900f authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Felipe Balbi
Browse files

usb: gadget: uvc: Switch to monotonic clock for buffer timestamps



The wall time clock isn't useful for applications as it can jump around
due to time adjustement. Switch to the monotonic clock.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 79cb5b53
Loading
Loading
Loading
Loading
+2 −7
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>
#include <linux/wait.h>


#include <media/v4l2-common.h>
#include <media/videobuf2-vmalloc.h>
#include <media/videobuf2-vmalloc.h>


#include "uvc.h"
#include "uvc.h"
@@ -379,14 +380,8 @@ static struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
	else
	else
		nextbuf = NULL;
		nextbuf = NULL;


	/*
	 * FIXME: with videobuf2, the sequence number or timestamp fields
	 * are valid only for video capture devices and the UVC gadget usually
	 * is a video output device. Keeping these until the specs are clear on
	 * this aspect.
	 */
	buf->buf.v4l2_buf.sequence = queue->sequence++;
	buf->buf.v4l2_buf.sequence = queue->sequence++;
	do_gettimeofday(&buf->buf.v4l2_buf.timestamp);
	v4l2_get_timestamp(&buf->buf.v4l2_buf.timestamp);


	vb2_set_plane_payload(&buf->buf, 0, buf->bytesused);
	vb2_set_plane_payload(&buf->buf, 0, buf->bytesused);
	vb2_buffer_done(&buf->buf, VB2_BUF_STATE_DONE);
	vb2_buffer_done(&buf->buf, VB2_BUF_STATE_DONE);