* [PATCH v2 0/2] media: nxp: imx8-isi: Fix single frame capture and optimize buffer usage
@ 2026-03-12 3:12 Guoniu Zhou
2026-03-12 3:12 ` [PATCH v2 1/2] media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0 Guoniu Zhou
0 siblings, 1 reply; 3+ messages in thread
From: Guoniu Zhou @ 2026-03-12 3:12 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Stefan Riedmueller,
Jacopo Mondi, Christian Hemp
Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Alexi Birlinger,
Dong Aisheng, Guoniu Zhou, stable
This series fixes a hang issue when capturing single frames and improves
buffer utilization by prioritizing user buffers over discard buffers.
Patch 1 reduces min_queued_buffers to allow streaming with a single buffer,
fixing hangs in applications like libcamera's cam tool.
Patch 2 changes the buffer selection logic to use pending user buffers first,
minimizing unnecessary frame drops at stream start.
Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
Changes in v2:
- Add fix tag
- Replace "This ensures" with "ensure"
- Reduce min_queued_buffers from 2 to 0 suggested by Jacopo Mondi
- Put example from commit message to comment in driver suggested by Frank
- Detailed changes can be found in each patch's changelog
- Link to v1: https://lore.kernel.org/r/20260311-isi_min_buffers-v1-0-c9299d6e8ae6@nxp.com
---
Guoniu Zhou (2):
media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0
media: nxp: imx8-isi: Prioritize pending buffers over discard buffers
drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260310-isi_min_buffers-4b490a124223
Best regards,
--
Guoniu Zhou <guoniu.zhou@nxp.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 1/2] media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0
2026-03-12 3:12 [PATCH v2 0/2] media: nxp: imx8-isi: Fix single frame capture and optimize buffer usage Guoniu Zhou
@ 2026-03-12 3:12 ` Guoniu Zhou
2026-03-19 21:48 ` Laurent Pinchart
0 siblings, 1 reply; 3+ messages in thread
From: Guoniu Zhou @ 2026-03-12 3:12 UTC (permalink / raw)
To: Laurent Pinchart, Mauro Carvalho Chehab, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Stefan Riedmueller,
Jacopo Mondi, Christian Hemp
Cc: linux-media, imx, linux-arm-kernel, linux-kernel, Alexi Birlinger,
Dong Aisheng, Guoniu Zhou, stable
From: Guoniu Zhou <guoniu.zhou@nxp.com>
Fix a hang issue when capturing a single frame with applications like cam
in libcamera. It would hang waiting for the driver to complete the buffer,
but streaming never starts because min_queued_buffers was set to 2.
The ISI module uses a ping-pong buffer mechanism that requires two buffers
to be programmed at all times. However, when fewer than 2 user buffers are
available, the driver use internal discard buffers to fill the remaining
slot(s). Reduce minimum queued buffers from 2 to 0 allows streaming to
start without any queued buffers.
Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
---
Changes in v2:
- Reduce min_queued_buffers from 2 to 0 suggested by Jacopo Mondi
https://lore.kernel.org/linux-media/20260311-isi_min_buffers-v1-0-c9299d6e8ae6@nxp.com/T/#mcd4b7dcc218a02e2f218ba2c83b947ccefd9308b
- Add fix tag
---
drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
index 13682bf6e9f8895bb9eb1f92d5f74b0d5968544e..1be3a728f32f89338a75ddcc4e96e7501ed954e1 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
@@ -1410,7 +1410,7 @@ int mxc_isi_video_register(struct mxc_isi_pipe *pipe,
q->mem_ops = &vb2_dma_contig_memops;
q->buf_struct_size = sizeof(struct mxc_isi_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
- q->min_queued_buffers = 2;
+ q->min_queued_buffers = 0;
q->lock = &video->lock;
q->dev = pipe->isi->dev;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/2] media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0
2026-03-12 3:12 ` [PATCH v2 1/2] media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0 Guoniu Zhou
@ 2026-03-19 21:48 ` Laurent Pinchart
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2026-03-19 21:48 UTC (permalink / raw)
To: Guoniu Zhou
Cc: Mauro Carvalho Chehab, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Stefan Riedmueller,
Jacopo Mondi, Christian Hemp, linux-media, imx, linux-arm-kernel,
linux-kernel, Alexi Birlinger, Dong Aisheng, Guoniu Zhou, stable
Hi Guoniu,
Thank you for the patch.
On Thu, Mar 12, 2026 at 11:12:34AM +0800, Guoniu Zhou wrote:
> From: Guoniu Zhou <guoniu.zhou@nxp.com>
>
> Fix a hang issue when capturing a single frame with applications like cam
> in libcamera. It would hang waiting for the driver to complete the buffer,
> but streaming never starts because min_queued_buffers was set to 2.
>
> The ISI module uses a ping-pong buffer mechanism that requires two buffers
> to be programmed at all times. However, when fewer than 2 user buffers are
> available, the driver use internal discard buffers to fill the remaining
> slot(s). Reduce minimum queued buffers from 2 to 0 allows streaming to
> start without any queued buffers.
>
> Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
> ---
> Changes in v2:
> - Reduce min_queued_buffers from 2 to 0 suggested by Jacopo Mondi
> https://lore.kernel.org/linux-media/20260311-isi_min_buffers-v1-0-c9299d6e8ae6@nxp.com/T/#mcd4b7dcc218a02e2f218ba2c83b947ccefd9308b
> - Add fix tag
> ---
> drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
> index 13682bf6e9f8895bb9eb1f92d5f74b0d5968544e..1be3a728f32f89338a75ddcc4e96e7501ed954e1 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
> @@ -1410,7 +1410,7 @@ int mxc_isi_video_register(struct mxc_isi_pipe *pipe,
> q->mem_ops = &vb2_dma_contig_memops;
> q->buf_struct_size = sizeof(struct mxc_isi_buffer);
> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
> - q->min_queued_buffers = 2;
> + q->min_queued_buffers = 0;
A simple way to fix the issue, that's nice.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> q->lock = &video->lock;
> q->dev = pipe->isi->dev;
>
>
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-19 21:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 3:12 [PATCH v2 0/2] media: nxp: imx8-isi: Fix single frame capture and optimize buffer usage Guoniu Zhou
2026-03-12 3:12 ` [PATCH v2 1/2] media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0 Guoniu Zhou
2026-03-19 21:48 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox