From: Laurent Pinchart Date: Fri, 2 Aug 2013 00:34:52 +0000 (-0300) Subject: [media] Documentation: media: Clarify the VIDIOC_CREATE_BUFS format requirements X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c09aada7ac8a8c03970bd2fb41176647da7cef99;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git [media] Documentation: media: Clarify the VIDIOC_CREATE_BUFS format requirements The VIDIOC_CREATE_BUFS ioctl takes a format argument that must contain a valid format supported by the driver. Clarify the documentation. Signed-off-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml index cd9943672434..9b700a5f4df7 100644 --- a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml +++ b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml @@ -62,18 +62,29 @@ addition to the VIDIOC_REQBUFS ioctl, when a tighter control over buffers is required. This ioctl can be called multiple times to create buffers of different sizes. - To allocate device buffers applications initialize relevant fields of -the v4l2_create_buffers structure. They set the -type field in the -&v4l2-format; structure, embedded in this -structure, to the respective stream or buffer type. -count must be set to the number of required buffers. -memory specifies the required I/O method. The -format field shall typically be filled in using -either the VIDIOC_TRY_FMT or -VIDIOC_G_FMT ioctl(). Additionally, applications can adjust -sizeimage fields to fit their specific needs. The -reserved array must be zeroed. + To allocate the device buffers applications must initialize the +relevant fields of the v4l2_create_buffers structure. +The count field must be set to the number of +requested buffers, the memory field specifies the +requested I/O method and the reserved array must be +zeroed. + + The format field specifies the image format +that the buffers must be able to handle. The application has to fill in this +&v4l2-format;. Usually this will be done using the +VIDIOC_TRY_FMT or VIDIOC_G_FMT ioctl() +to ensure that the requested format is supported by the driver. Unsupported +formats will result in an error. + + The buffers created by this ioctl will have as minimum size the size +defined by the format.pix.sizeimage field. If the +format.pix.sizeimage field is less than the minimum +required for the given format, then sizeimage will be +increased by the driver to that minimum to allocate the buffers. If it is +larger, then the value will be used as-is. The same applies to the +sizeimage field of the +v4l2_plane_pix_format structure in the case of +multiplanar formats. When the ioctl is called with a pointer to this structure the driver will attempt to allocate up to the requested number of buffers and store the @@ -144,9 +155,9 @@ mapped I/O. EINVAL - The buffer type (type field) or the -requested I/O method (memory) is not -supported. + The buffer type (format.type field), +requested I/O method (memory) or format +(format field) is not valid.