Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: rcar-vin: Return unused buffers correctly
@ 2026-08-28 10:37 Niklas Söderlund
  2026-11-16 10:21 ` Jacopo Mondi
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Söderlund @ 2026-08-28 10:37 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab, Geert Uytterhoeven,
	Magnus Damm
  Cc: linux-media, linux-renesas-soc, linux-kernel,
	Niklas Söderlund

Unused VB2 buffers should be returned with state DONE not ERROR when
stopping.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
index 73cda0e2d45a..f3003dd61890 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
@@ -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: 4900cad020c0580dfb1be27776ff10a4ef110cfa
change-id: 20260828-vin-fix-vb2-28e1bb24a618

Best regards,
--  
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: rcar-vin: Return unused buffers correctly
  2026-08-28 10:37 [PATCH] media: rcar-vin: Return unused buffers correctly Niklas Söderlund
@ 2026-11-16 10:21 ` Jacopo Mondi
  0 siblings, 0 replies; 2+ messages in thread
From: Jacopo Mondi @ 2026-11-16 10:21 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Niklas Söderlund, Mauro Carvalho Chehab, Geert Uytterhoeven,
	Magnus Damm, linux-media, linux-renesas-soc, linux-kernel

Hi Niklas

On Fri, Aug 28, 2026 at 12:37:44PM +0200, Niklas Söderlund wrote:
> Unused VB2 buffers should be returned with state DONE not ERROR when
> stopping.

Indeed

I think this is worth a fixes tag

I'll add, if you agree:

Fixes: 63a71dd813e2 ("media: rcar-vin: Break out hardware start and stop to new methods")
Cc: stable@vger.kernel.org

Not 100% sure what commit to use in the Fixes tag as unused buffers
were returned in ERROR state before that commit, possibily from the
very first commit that introduced the driver

>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> index 73cda0e2d45a..f3003dd61890 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> @@ -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);

Does the same apply to buffers queued to the hardware and not
processed released in rvin_stop_streaming() ?

	/* Return unprocessed buffers from hardware. */
	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);
	}

(nit: there is a stray empty line after this loop, if this hunk needs
to be patches as well, it might be a good occasion to remove it as
well)

Thanks
   j


>  }
>
>  static const struct vb2_ops rvin_qops = {
>
> ---
> base-commit: 4900cad020c0580dfb1be27776ff10a4ef110cfa
> change-id: 20260828-vin-fix-vb2-28e1bb24a618
>
> Best regards,
> --
> Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-16 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 10:37 [PATCH] media: rcar-vin: Return unused buffers correctly Niklas Söderlund
2026-11-16 10:21 ` Jacopo Mondi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox