From: Ezequiel Garcia <ezequiel@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Tomasz Figa <tfiga@chromium.org>,
kernel@collabora.com, Jonas Karlman <jonas@kwiboo.se>,
Heiko Stuebner <heiko@sntech.de>,
Alexandre Courbot <acourbot@chromium.org>,
Jeffrey Kardatzke <jkardatzke@chromium.org>,
gustavo.padovan@collabora.com,
Nicolas Dufresne <nicolas.dufresne@collabora.com>
Subject: Re: [PATCH v4 1/3] media: rkvdec: Fix .buf_prepare
Date: Wed, 20 May 2020 10:12:40 -0300 [thread overview]
Message-ID: <4182e7477c43e6b5d93311de4b86f8274a0913a6.camel@collabora.com> (raw)
In-Reply-To: <2c69a8d6-3402-15e8-1b19-49b8591ae1d8@xs4all.nl>
On Wed, 2020-05-20 at 15:07 +0200, Hans Verkuil wrote:
> On 18/05/2020 19:40, Ezequiel Garcia 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.
> >
> > Fix it.
> >
> > Fixes: cd33c830448ba ("media: rkvdec: Add the rkvdec driver")
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > ---
> > drivers/staging/media/rkvdec/rkvdec.c | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
> > index 225eeca73356..4df2a248ab96 100644
> > --- a/drivers/staging/media/rkvdec/rkvdec.c
> > +++ b/drivers/staging/media/rkvdec/rkvdec.c
> > @@ -456,7 +456,15 @@ static int rkvdec_buf_prepare(struct vb2_buffer *vb)
> > if (vb2_plane_size(vb, i) < sizeimage)
> > return -EINVAL;
> > }
> > - vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage);
> > +
> > + /*
> > + * Buffer's bytesused is written by the driver for CAPTURE buffers,
> > + * or if the application passed zero bytesused on an OUTPUT buffer.
> > + */
> > + if (!V4L2_TYPE_IS_OUTPUT(vq->type) ||
> > + (V4L2_TYPE_IS_OUTPUT(vq->type) && !vb2_get_plane_payload(vb, 0)))
> > + vb2_set_plane_payload(vb, 0,
> > + f->fmt.pix_mp.plane_fmt[0].sizeimage);
>
> This should just be:
>
> if (!V4L2_TYPE_IS_OUTPUT(vq->type))
> vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage);
>
> If the application passes 0 as bytesused, then 1) a warning will be generated
> by the v4l2 core and 2) the v4l2 core will set bytesused to the length of the
> buffer. See vb2_fill_vb2_v4l2_buffer() in videobuf2-v4l2.c.
>
> Some old drivers explicitly allow bytesused to be 0 for an output queue to
> signal end-of-stream, but that's only supported if the allow_zero_bytesused
> flag is set in the vb2_queue, and that shall not be used for new drivers
> since it is deprecated functionality.
>
Ah, good catch. I'll get you a v5.
Thanks,
Ezequiel
next prev parent reply other threads:[~2020-05-20 13:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 17:40 [PATCH v4 0/3] media: rkvdec: Add a VP9 backend Ezequiel Garcia
2020-05-18 17:40 ` [PATCH v4 1/3] media: rkvdec: Fix .buf_prepare Ezequiel Garcia
2020-05-20 13:07 ` Hans Verkuil
2020-05-20 13:12 ` Ezequiel Garcia [this message]
2020-05-18 17:40 ` [PATCH v4 2/3] media: uapi: Add VP9 stateless decoder controls Ezequiel Garcia
2020-05-20 13:26 ` Hans Verkuil
2020-09-10 6:04 ` Alexandre Courbot
2020-09-10 8:43 ` Alexandre Courbot
2021-02-24 21:07 ` Nicolas Dufresne
2021-02-28 6:13 ` Alexandre Courbot
2021-03-01 18:43 ` Nicolas Dufresne
2021-03-02 3:48 ` Alexandre Courbot
2020-05-18 17:40 ` [PATCH 3/3] media: rkvdec: Add the VP9 backend Ezequiel Garcia
2020-05-18 17:53 ` Ezequiel Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4182e7477c43e6b5d93311de4b86f8274a0913a6.camel@collabora.com \
--to=ezequiel@collabora.com \
--cc=acourbot@chromium.org \
--cc=gustavo.padovan@collabora.com \
--cc=heiko@sntech.de \
--cc=hverkuil@xs4all.nl \
--cc=jkardatzke@chromium.org \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=nicolas.dufresne@collabora.com \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®