Re: [PATCH v3 1/3] media: rkvdec: Fix .buf_prepare

From: Tomasz Figa
Date: Tue May 05 2020 - 10:05:38 EST


On Tue, May 5, 2020 at 3:59 PM Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx> wrote:
>
> On Tue, 2020-05-05 at 15:56 +0200, Tomasz Figa wrote:
> > Hi Ezequiel,
> >
> > On Tue, May 5, 2020 at 3:41 PM Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx> wrote:
> > > The driver should only set the payload on .buf_prepare
> > > if the buffer is CAPTURE type, or if an OUTPUT buffer
> > > has a zeroed payload.
> >
> > Thanks for the patch. Just one question below.
> >
> > Where does the requirement to set OUTPUT buffer bytesused to sizeimage
> > if the original bytesused is 0 come from?
> >
>
> If I'm reading english correctly, it's here:
>
> https://www.kernel.org/doc/html/latest/media/uapi/v4l/buffer.html
>
> """
> The number of bytes occupied by the data in the buffer. It depends on the negotiated data format and may change with each buffer for compressed
> variable size data like JPEG images. Drivers must set this field when type refers to a capture stream, applications when it refers to an output
> stream. If the application sets this to 0 for an output stream, then bytesused will be set to the size of the buffer (see the length field of this
> struct) by the driver. For multiplanar formats this field is ignored and the planes pointer is used instead.
> """

Okay, thanks. I wonder if this shouldn't be handled by the core,
though. Especially given that the document refers to the length field
specifically and not the sizeimage set in the format.

Best regards,
Tomasz