Hi Hans,

On 09/19/2012 04:37 PM, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verk...@cisco.com>
> 
> length should be set to num_planes in __fill_v4l2_buffer(). That way the
> caller knows how many planes there are in the buffer.
> 
> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

I think this would break VIDIOC_CREATE_BUFS. We need per buffer num_planes.
Consider a use case where device is streaming with 2-planar pixel format
and we invoke VIDIOC_CREATE_BUFS with single-planar format. On a single 
queue there will be buffers with different number of planes. The number of 
planes information must be attached to a buffer, otherwise VIDIOC_QUERYBUF 
won't work.

> ---
>  drivers/media/v4l2-core/videobuf2-core.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
> b/drivers/media/v4l2-core/videobuf2-core.c
> index 929cc99..bbfe022 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -348,6 +348,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, 
> struct v4l2_buffer *b)
>                * Fill in plane-related data if userspace provided an array
>                * for it. The memory and size is verified above.
>                */
> +             b->length = q->num_planes;
>               memcpy(b->m.planes, vb->v4l2_planes,
>                       b->length * sizeof(struct v4l2_plane));
>       } else {

Regards,
Sylwester
--
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