All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: pawel@osciak.com, Hans Verkuil <hans.verkuil@cisco.com>
Subject: [REVIEWv2 PATCH 06/13] vb2: set timestamp when using write()
Date: Mon,  7 Apr 2014 15:11:05 +0200	[thread overview]
Message-ID: <1396876272-18222-7-git-send-email-hverkuil@xs4all.nl> (raw)
In-Reply-To: <1396876272-18222-1-git-send-email-hverkuil@xs4all.nl>

From: Hans Verkuil <hans.verkuil@cisco.com>

When using write() to write data to an output video node the vb2 core
should set timestamps if V4L2_BUF_FLAG_TIMESTAMP_COPY is set. Nobody
else is able to provide this information with the write() operation.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/v4l2-core/videobuf2-core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 2e448a7..b7de6be 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -22,6 +22,7 @@
 #include <media/v4l2-dev.h>
 #include <media/v4l2-fh.h>
 #include <media/v4l2-event.h>
+#include <media/v4l2-common.h>
 #include <media/videobuf2-core.h>
 
 static int debug;
@@ -2751,6 +2752,9 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
 {
 	struct vb2_fileio_data *fileio;
 	struct vb2_fileio_buf *buf;
+	bool set_timestamp = !read &&
+		(q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) ==
+		V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	int ret, index;
 
 	dprintk(3, "mode %s, offset %ld, count %zd, %sblocking\n",
@@ -2852,6 +2856,8 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
 		fileio->b.memory = q->memory;
 		fileio->b.index = index;
 		fileio->b.bytesused = buf->pos;
+		if (set_timestamp)
+			v4l2_get_timestamp(&fileio->b.timestamp);
 		ret = vb2_internal_qbuf(q, &fileio->b);
 		dprintk(5, "vb2_dbuf result: %d\n", ret);
 		if (ret)
-- 
1.9.1


  parent reply	other threads:[~2014-04-07 13:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-07 13:10 [REVIEWv2 PATCH 00/13] vb2: various small fixes/improvements Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 01/13] vb2: stop_streaming should return void Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 02/13] vb2: fix handling of data_offset and v4l2_plane.reserved[] Hans Verkuil
2014-04-10  0:46   ` Pawel Osciak
2014-04-10  6:40     ` Hans Verkuil
2014-04-11 12:48   ` Tomasz Stanislawski
2014-04-11 13:03     ` Hans Verkuil
2014-04-11 13:48       ` Tomasz Stanislawski
2014-04-11 14:07         ` Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 03/13] vb2: if bytesused is 0, then fill with output buffer length Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 04/13] vb2: use correct prefix Hans Verkuil
2014-04-10  0:51   ` Pawel Osciak
2014-04-10  0:52   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 05/13] vb2: move __qbuf_mmap before __qbuf_userptr Hans Verkuil
2014-04-07 13:11 ` Hans Verkuil [this message]
2014-04-10  0:55   ` [REVIEWv2 PATCH 06/13] vb2: set timestamp when using write() Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 07/13] vb2: reject output buffers with V4L2_FIELD_ALTERNATE Hans Verkuil
2014-04-10  0:57   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 08/13] vb2: simplify a confusing condition Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 09/13] vb2: add vb2_fileio_is_active and check it more often Hans Verkuil
2014-04-10  1:06   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 10/13] vb2: set v4l2_buffer.bytesused to 0 for mp buffers Hans Verkuil
2014-04-10  1:08   ` Pawel Osciak
2014-04-10  1:10     ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 11/13] vb2: allow read/write as long as the format is single planar Hans Verkuil
2014-04-07 13:11 ` [REVIEWv2 PATCH 12/13] vb2: start messages with a lower-case for consistency Hans Verkuil
2014-04-10  1:11   ` Pawel Osciak
2014-04-07 13:11 ` [REVIEWv2 PATCH 13/13] DocBook media: update bytesused field description 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=1396876272-18222-7-git-send-email-hverkuil@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=pawel@osciak.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.