Re: [PATCHv3 05/11] videobuf2: handle V4L2_FLAG_MEMORY_NON_CONSISTENT flag

From: Hans Verkuil
Date: Fri Feb 28 2020 - 03:49:54 EST


On 2/28/20 2:38 AM, Sergey Senozhatsky wrote:
> On (20/02/27 13:36), Hans Verkuil wrote:
>>> diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
>>> index bd08e4f77ae4..6a8a4d5de2f1 100644
>>> --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
>>> +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst
>>> @@ -121,7 +121,13 @@ than the number requested.
>>> other changes, then set ``count`` to 0, ``memory`` to
>>> ``V4L2_MEMORY_MMAP`` and ``format.type`` to the buffer type.
>>> * - __u32
>>> - - ``reserved``\ [7]
>>> + - ``flags``
>>> + - Specifies additional buffer management attributes.
>>> + See :ref:`memory-flags`. Old drivers and applications must set it to
>>> + zero.
>>
>> Drop the last sentence, it's not relevant.
>
> OK.
>
>>> +
>>> + * - __u32
>>> + - ``reserved``\ [6]
>>> - A place holder for future extensions. Drivers and applications
>>> must set the array to zero.
>>
>> Old drivers and applications still think reserved is [7] and will zero this.
>
> OK.
>
> Hmm... If those apps use hard-coded size then we might have a problem.
> If they use sizeof(reserved) then everything is OK. Shall we also have
> a union here?

No, apps will use sizeof(reserved).

Regards,

Hans

>
>>> diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst
>>> index 917df6fb6486..e52cc4401fba 100644
>>> --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst
>>> +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst
>>> @@ -112,10 +112,19 @@ aborting or finishing any DMA in progress, an implicit
>>> ``V4L2_MEMORY_MMAP`` and ``type`` set to the buffer type. This will
>>> free any previously allocated buffers, so this is typically something
>>> that will be done at the start of the application.
>>> - * - __u32
>>> + * - union
>>> + - (anonymous)
>>
>> Anonymous unions are formatted a bit differently (I made a very recent patch
>> that unified the union formatting in the v4l docs). See e.g.
>> Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst.
>
> OK, will take a look.
>
> -ss
>