From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
To: linux-media@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org, devel@driverdev.osuosl.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Ezequiel Garcia <ezequiel@collabora.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
kernel@collabora.com, Adrian Ratiu <adrian.ratiu@collabora.com>
Subject: [RFC RESEND 1/3] media: rkvdec: Fix .buf_prepare
Date: Wed, 21 Apr 2021 12:00:33 +0200 [thread overview]
Message-ID: <20210421100035.13571-2-andrzej.p@collabora.com> (raw)
In-Reply-To: <20210421100035.13571-1-andrzej.p@collabora.com>
From: Ezequiel Garcia <ezequiel@collabora.com>
The driver should only set the payload on .buf_prepare if the
buffer is CAPTURE type. If an OUTPUT buffer has a zero bytesused
set by userspace then v4l2-core will set it to buffer length.
Fixes: cd33c830448ba ("media: rkvdec: Add the rkvdec driver")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@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 d821661d30f3..ef2166043127 100644
--- a/drivers/staging/media/rkvdec/rkvdec.c
+++ b/drivers/staging/media/rkvdec/rkvdec.c
@@ -481,7 +481,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 bytesused is written by driver for CAPTURE buffers.
+ * (if userspace passes 0 bytesused for OUTPUT buffers, v4l2-core sets
+ * it to buffer length).
+ */
+ if (!V4L2_TYPE_IS_OUTPUT(vq->type))
+ vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage);
+
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2021-04-21 10:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 10:00 [RFC RESEND 0/3] vp9 v4l2 stateless uapi Andrzej Pietrasiewicz
2021-04-21 10:00 ` Andrzej Pietrasiewicz [this message]
2021-04-21 10:00 ` [RFC RESEND 2/3] media: uapi: Add VP9 stateless decoder controls Andrzej Pietrasiewicz
2021-04-29 10:20 ` Hans Verkuil
2021-04-30 16:54 ` Andrzej Pietrasiewicz
2021-05-05 17:36 ` Nicolas Dufresne
2021-04-21 10:00 ` [RFC RESEND 3/3] media: rkvdec: Add the VP9 backend Andrzej Pietrasiewicz
2021-04-29 10:28 ` Hans Verkuil
2021-04-26 7:38 ` [RFC RESEND 0/3] vp9 v4l2 stateless uapi Hans Verkuil
2021-04-26 17:37 ` Nicolas Dufresne
2021-04-26 23:34 ` Ezequiel Garcia
2021-04-29 9:23 ` Hans Verkuil
2021-04-29 19:38 ` Nicolas Dufresne
2021-04-30 8:12 ` Hans Verkuil
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=20210421100035.13571-2-andrzej.p@collabora.com \
--to=andrzej.p@collabora.com \
--cc=adrian.ratiu@collabora.com \
--cc=devel@driverdev.osuosl.org \
--cc=ezequiel@collabora.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@collabora.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.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;
as well as URLs for NNTP newsgroup(s).