From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Jacopo Mondi" <jacopo.mondi@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] media: rcar-vin: Return unused buffers correctly
Date: Fri, 27 Nov 2026 15:17:44 +0100 [thread overview]
Message-ID: <e44f2383-0a7b-411c-ba42-5f19156d2a08@kernel.org> (raw)
In-Reply-To: <20261121-vin-fix-vb2-v2-1-602a3d876853@ragnatech.se>
On 21/11/2026 12:54, Niklas Söderlund wrote:
> Unused VB2 buffers should be returned with state DONE not ERROR when
> stopping.
Why? With 'unused' I assume you mean buffers that have no data in them, i.e. they
have never been used to capture video.
So ERROR is correct for that. The state DONE is reserved for buffers that return
a valid payload.
It's standard behavior to return any unused queued buffers as ERROR when we stop
streaming. That prevents userspace from trying to use their contents.
Jacopo, I'm dropping this one from your PR.
Regards,
Hans
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> Changes in v2:
> - Link to v1: https://patch.msgid.link/20260828-vin-fix-vb2-v1-1-97eb1f4f75c9@ragnatech.se
> ---
> * Changes since v1
> - Fix unused buffers returned in rvin_stop_streaming() too.
> ---
> drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> index 5e515d16c164..d3d1af47f8b1 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> @@ -1434,7 +1434,7 @@ void rvin_stop_streaming(struct rvin_dev *vin)
> for (unsigned int i = 0; i < HW_BUFFER_NUM; i++) {
> if (vin->buf_hw[i].buffer)
> vb2_buffer_done(&vin->buf_hw[i].buffer->vb2_buf,
> - VB2_BUF_STATE_ERROR);
> + VB2_BUF_STATE_DONE);
> }
>
> }
> @@ -1449,7 +1449,7 @@ static void rvin_stop_streaming_vq(struct vb2_queue *vq)
> dma_free_coherent(vin->dev, vin->format.sizeimage, vin->scratch,
> vin->scratch_phys);
>
> - return_unused_buffers(vin, VB2_BUF_STATE_ERROR);
> + return_unused_buffers(vin, VB2_BUF_STATE_DONE);
> }
>
> static const struct vb2_ops rvin_qops = {
>
> ---
> base-commit: aa0f4c41d4870a18e65772a1817af16427200371
> change-id: 20260828-vin-fix-vb2-28e1bb24a618
>
> Best regards,
> --
> Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
>
>
next prev parent reply other threads:[~2026-11-27 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 11:54 Niklas Söderlund
2026-11-22 18:25 ` Jacopo Mondi
2026-11-23 7:58 ` Niklas Söderlund
2026-11-24 7:55 ` Jacopo Mondi
2026-11-27 14:17 ` Hans Verkuil [this message]
2026-11-27 14:47 ` Jacopo Mondi
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=e44f2383-0a7b-411c-ba42-5f19156d2a08@kernel.org \
--to=hverkuil+cisco@kernel.org \
--cc=geert+renesas@glider.be \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=niklas.soderlund@ragnatech.se \
/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®