From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Fengguang Wu <fengguang.wu@intel.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Roland Scheidegger <rscheidegger_lists@hispeed.ch>
Subject: [PATCH 1/2] usb: gadget: uvc: Switch to monotonic clock for buffer timestamps
Date: Sun, 23 Mar 2014 16:32:33 +0100 [thread overview]
Message-ID: <1395588754-20587-2-git-send-email-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1395588754-20587-1-git-send-email-laurent.pinchart@ideasonboard.com>
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/usb/gadget/uvc_queue.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index 0bb5d50..d4561ba 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -364,6 +364,7 @@ static struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
struct uvc_buffer *buf)
{
struct uvc_buffer *nextbuf;
+ struct timespec ts;
if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
buf->length != buf->bytesused) {
@@ -379,14 +380,11 @@ static struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
else
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.
- */
+ ktime_get_ts(&ts);
+
buf->buf.v4l2_buf.sequence = queue->sequence++;
- do_gettimeofday(&buf->buf.v4l2_buf.timestamp);
+ buf->buf.v4l2_buf.timestamp.tv_sec = ts.tv_sec;
+ buf->buf.v4l2_buf.timestamp.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
vb2_set_plane_payload(&buf->buf, 0, buf->bytesused);
vb2_buffer_done(&buf->buf, VB2_BUF_STATE_DONE);
--
1.8.3.2
next prev parent reply other threads:[~2014-03-23 15:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-23 0:10 [webcam] WARNING: CPU: 0 PID: 1 at drivers/media/v4l2-core/videobuf2-core.c:2207 vb2_queue_init() Fengguang Wu
2014-03-23 15:32 ` [PATCH 0/2] Clock fixes for UVC gadget driver Laurent Pinchart
2014-03-23 15:32 ` Laurent Pinchart [this message]
2014-03-28 8:50 ` [PATCH 1/2] usb: gadget: uvc: Switch to monotonic clock for buffer timestamps Hans Verkuil
2014-03-28 11:18 ` Laurent Pinchart
2014-03-23 15:32 ` [PATCH 2/2] usb: gadget: uvc: Set the vb2 queue timestamp flags Laurent Pinchart
2014-03-28 8:51 ` Hans Verkuil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395588754-20587-2-git-send-email-laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=bigeasy@linutronix.de \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rscheidegger_lists@hispeed.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®