public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kamil Debski <k.debski@samsung.com>
Cc: linux-media@vger.kernel.org, jtp.park@samsung.com,
	arun.kk@samsung.com, s.nawrocki@samsung.com, sakari.ailus@iki.fi,
	hverkuil@xs4all.nl, verkuil@xs4all.nl, m.szyprowski@samsung.com,
	pawel@osciak.com, Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 2/3 v2] vb2: Add support for non monotonic timestamps
Date: Thu, 24 Jan 2013 13:49:38 +0100	[thread overview]
Message-ID: <3162932.GEG4AlBAqe@avalon> (raw)
In-Reply-To: <1359030907-9883-3-git-send-email-k.debski@samsung.com>

Hi Kamil,

Thank you for the patch.

On Thursday 24 January 2013 13:35:06 Kamil Debski wrote:
> 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.debski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/v4l2-core/videobuf2-core.c |    8 ++++++--
>  include/media/videobuf2-core.h           |    1 +
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c
> b/drivers/media/v4l2-core/videobuf2-core.c index 85e3c22..b816689 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,9 +2032,13 @@ 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;
> 
> +	/* Warn that the driver should choose an appropriate timestamp type */
> +	WARN_ON(q->timestamp_type == V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN);
> +

This will cause all the drivers that use vb2 to issue a WARN_ON, and 
timestamps reported as monotonic in v3.7 would then be reported as unknown 
again.

I can see two options to fix this, one is to default to monotonic if the 
timestamp type is unknown, the other is to patch all drivers that use vb2. The 
former is probably easier.

>  	INIT_LIST_HEAD(&q->queued_list);
>  	INIT_LIST_HEAD(&q->done_list);
>  	spin_lock_init(&q->done_lock);
> 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;

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2013-01-24 12:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 12:35 [PATCH 0/3 v2] Add proper timestamp types handling in videobuf2 Kamil Debski
2013-01-24 12:35 ` [PATCH 1/3 v2] v4l: Define video buffer flag for the COPY timestamp type Kamil Debski
2013-01-24 12:51   ` Hans Verkuil
2013-01-24 15:25     ` Kamil Debski
2013-01-24 12:35 ` [PATCH 2/3 v2] vb2: Add support for non monotonic timestamps Kamil Debski
2013-01-24 12:49   ` Laurent Pinchart [this message]
2013-01-24 12:35 ` [PATCH 3/3 v2] v4l: Set proper timestamp type in selected drivers which use videobuf2 Kamil Debski
2013-01-24 12:51   ` Laurent Pinchart
2013-01-24 15:31     ` Kamil Debski
2013-01-24 19:12       ` Sakari Ailus
2013-01-25 10:21         ` Kamil Debski

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=3162932.GEG4AlBAqe@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=arun.kk@samsung.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jtp.park@samsung.com \
    --cc=k.debski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=pawel@osciak.com \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@iki.fi \
    --cc=verkuil@xs4all.nl \
    /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