Re: [PATCH 6/8] usb: gadget/uvc: set sizes in queue_setup to 0 when memorytype is not MMAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

Thank you for the patch.

On Wednesday 28 May 2014 09:38:07 Michael Grzeschik wrote:
> Its not needed to set plane sizelimit if using USERPTR or DMABUF.
> The buffersize limit will be parsed in the encoder function.

I don't think this is correct. If you look at __qbuf_userptr() in videobuf2-
core.c for instance, vb2 makes sure the buffer being queued is large enough by 
validating its length against the size set in the queue_setup() handler.

        /* Check if the provided plane buffer is large enough */
        if (planes[plane].length < q->plane_sizes[plane]) {
                dprintk(1, "provided buffer size %u is less than "
                                        "setup size %u for plane %d\n",
                                        planes[plane].length,
                                        q->plane_sizes[plane], plane);
                ret = -EINVAL;
                goto err;
        }

> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/uvc_queue.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
> index 0bb5d50..698c385 100644
> --- a/drivers/usb/gadget/uvc_queue.c
> +++ b/drivers/usb/gadget/uvc_queue.c
> @@ -52,7 +52,7 @@ static int uvc_queue_setup(struct vb2_queue *vq, const
> struct v4l2_format *fmt,
> 
>  	*nplanes = 1;
> 
> -	sizes[0] = video->imagesize;
> +	sizes[0] = (vq->memory == V4L2_MEMORY_MMAP) ? video->imagesize : 0;
> 
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux