Not all drivers use monotonic timestamps. This patch adds a way to set the
timestamp type per every queue.

Signed-off-by: Kamil Debski <k.deb...@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/media/v4l2-core/videobuf2-core.c |    5 +++--
 include/media/videobuf2-core.h           |    1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 85e3c22..c02472c 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -403,7 +403,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, 
struct v4l2_buffer *b)
         * Clear any buffer state related flags.
         */
        b->flags &= ~V4L2_BUFFER_MASK_FLAGS;
-       b->flags |= V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+       b->flags |= q->timestamp_type;
 
        switch (vb->state) {
        case VB2_BUF_STATE_QUEUED:
@@ -2032,7 +2032,8 @@ int vb2_queue_init(struct vb2_queue *q)
            WARN_ON(!q->type)             ||
            WARN_ON(!q->io_modes)         ||
            WARN_ON(!q->ops->queue_setup) ||
-           WARN_ON(!q->ops->buf_queue))
+           WARN_ON(!q->ops->buf_queue)   ||
+           WARN_ON(q->timestamp_type & ~V4L2_BUF_FLAG_TIMESTAMP_MASK))
                return -EINVAL;
 
        INIT_LIST_HEAD(&q->queued_list);
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 9cfd4ee..7ce4656 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -326,6 +326,7 @@ struct vb2_queue {
        const struct vb2_mem_ops        *mem_ops;
        void                            *drv_priv;
        unsigned int                    buf_struct_size;
+       u32                             timestamp_type;
 
 /* private: internal use only */
        enum v4l2_memory                memory;
-- 
1.7.9.5

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

Reply via email to