Re: [PATCH v2] media/doc: Allow sizeimage to be set by v4l clients

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

 



On 5/14/19 2:19 PM, Nicolas Dufresne wrote:
> Le mardi 14 mai 2019 à 10:54 +0200, Hans Verkuil a écrit :
>> Hi Stanimir,
>>
>> On 4/12/19 5:59 PM, Stanimir Varbanov wrote:
>>> This changes v4l2_pix_format and v4l2_plane_pix_format sizeimage
>>> field description to allow v4l clients to set bigger image size
>>> in case of variable length compressed data.
>>
>> I've been reconsidering this change. The sizeimage value in the format
>> is the minimum size a buffer should have in order to store the data of
>> an image of the width and height as described in the format.
> 
> Should this read as the minimum size for the specific (returned by
> driver) width/height/bytesperline ?

Yes. Although for compressed formats the bytesperline value plays no role
of course.

Regards,

	Hans

> 
>>
>> But there is nothing that prevents userspace from calling VIDIOC_CREATEBUFS
>> instead of VIDIOC_REQBUFS to allocate larger buffers.
>>
>> So do we really need this change?
>>
>> The more I think about this, the more uncomfortable I become with this change.
>>
>> Regards,
>>
>> 	Hans
>>
>>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@xxxxxxxxxx>
>>> ---
>>>  Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 13 ++++++++++++-
>>>  Documentation/media/uapi/v4l/pixfmt-v4l2.rst        | 11 ++++++++++-
>>>  2 files changed, 22 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst b/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst
>>> index 5688c816e334..005428a8121e 100644
>>> --- a/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst
>>> +++ b/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst
>>> @@ -31,7 +31,18 @@ describing all planes of that format.
>>>  
>>>      * - __u32
>>>        - ``sizeimage``
>>> -      - Maximum size in bytes required for image data in this plane.
>>> +      - Maximum size in bytes required for image data in this plane,
>>> +	set by the driver. When the image consists of variable length
>>> +	compressed data this is the number of bytes required by the
>>> +	codec to support the worst-case compression scenario.
>>> +
>>> +	For uncompressed images the driver will set the value. For
>>> +	variable length compressed data clients are allowed to set
>>> +	the sizeimage field, but the driver may ignore it and set the
>>> +	value itself, or it may modify the provided value based on
>>> +	alignment requirements or minimum/maximum size requirements.
>>> +	If the client wants to leave this to the driver, then it should
>>> +	set sizeimage to 0.
>>>      * - __u32
>>>        - ``bytesperline``
>>>        - Distance in bytes between the leftmost pixels in two adjacent
>>> diff --git a/Documentation/media/uapi/v4l/pixfmt-v4l2.rst b/Documentation/media/uapi/v4l/pixfmt-v4l2.rst
>>> index 71eebfc6d853..0f7771151db9 100644
>>> --- a/Documentation/media/uapi/v4l/pixfmt-v4l2.rst
>>> +++ b/Documentation/media/uapi/v4l/pixfmt-v4l2.rst
>>> @@ -89,7 +89,16 @@ Single-planar format structure
>>>        - Size in bytes of the buffer to hold a complete image, set by the
>>>  	driver. Usually this is ``bytesperline`` times ``height``. When
>>>  	the image consists of variable length compressed data this is the
>>> -	maximum number of bytes required to hold an image.
>>> +	number of bytes required by the codec to support the worst-case
>>> +	compression scenario.
>>> +
>>> +	For uncompressed images the driver will set the value. For
>>> +	variable length compressed data clients are allowed to set
>>> +	the sizeimage field, but the driver may ignore it and set the
>>> +	value itself, or it may modify the provided value based on
>>> +	alignment requirements or minimum/maximum size requirements.
>>> +	If the client wants to leave this to the driver, then it should
>>> +	set sizeimage to 0.
>>>      * - __u32
>>>        - ``colorspace``
>>>        - Image colorspace, from enum :c:type:`v4l2_colorspace`.
>>>
> 




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux