[PATCH 09/11] v4l: vb2: add prepare/finish callbacks to allocators

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Apr 6 06:35:43 PDT 2012


Hi Tomasz,

On Thursday 05 April 2012 16:00:06 Tomasz Stanislawski wrote:
> From: Marek Szyprowski <m.szyprowski at samsung.com>
> 
> This patch adds support for prepare/finish callbacks in VB2 allocators.
> These callback are used for buffer flushing.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
> ---
>  drivers/media/video/videobuf2-core.c |   11 +++++++++++
>  include/media/videobuf2-core.h       |    7 +++++++
>  2 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/videobuf2-core.c
> b/drivers/media/video/videobuf2-core.c index b37feea..abb0592 100644
> --- a/drivers/media/video/videobuf2-core.c
> +++ b/drivers/media/video/videobuf2-core.c
> @@ -834,6 +834,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum
> vb2_buffer_state state) {
>  	struct vb2_queue *q = vb->vb2_queue;
>  	unsigned long flags;
> +	int plane;

Please make plane an unsigned int, otherwise you will compare a signed and an 
unsigned int below.

> 
>  	if (vb->state != VB2_BUF_STATE_ACTIVE)
>  		return;
> @@ -844,6 +845,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum
> vb2_buffer_state state) dprintk(4, "Done processing on buffer %d, state:
> %d\n",
>  			vb->v4l2_buf.index, vb->state);
> 
> +	/* sync buffers */
> +	for (plane = 0; plane < vb->num_planes; ++plane)
> +		call_memop(q, finish, vb->planes[plane].mem_priv);
> +
>  	/* Add the buffer to the done buffers list */
>  	spin_lock_irqsave(&q->done_lock, flags);
>  	vb->state = state;
> @@ -1131,9 +1136,15 @@ err:
>  static void __enqueue_in_driver(struct vb2_buffer *vb)
>  {
>  	struct vb2_queue *q = vb->vb2_queue;
> +	int plane;

Same here.

>  	vb->state = VB2_BUF_STATE_ACTIVE;
>  	atomic_inc(&q->queued_count);
> +
> +	/* sync buffers */
> +	for (plane = 0; plane < vb->num_planes; ++plane)
> +		call_memop(q, prepare, vb->planes[plane].mem_priv);
> +
>  	q->ops->buf_queue(vb);
>  }

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list