Thread (6 messages) 6 messages, 2 authors, 2026-03-20

RE: [PATCH v2 2/2] media: nxp: imx8-isi: Prioritize pending buffers over discard buffers

From: G.N. Zhou (OSS) <hidden>
Date: 2026-03-20 06:33:24
Also in: imx, linux-media, lkml

Hi Laurent,

Thanks for your review.
-----Original Message-----
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Sent: Friday, March 20, 2026 5:59 AM
To: G.N. Zhou (OSS) <redacted>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>; Frank Li
[off-list ref]; Sascha Hauer [off-list ref]; Pengutronix
Kernel Team [off-list ref]; Fabio Estevam
[off-list ref]; Stefan Riedmüller [off-list ref];
Jacopo Mondi [off-list ref]; c.hemp@phytec.de; linux-
media@vger.kernel.org; imx@lists.linux.dev; linux-arm-
kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Alexi Birlinger
[off-list ref]; Aisheng Dong [off-list ref]; G.N.
Zhou [off-list ref]
Subject: Re: [PATCH v2 2/2] media: nxp: imx8-isi: Prioritize pending buffers over
discard buffers

Hi Guoniu,

Thank you for the patch.

On Thu, Mar 12, 2026 at 11:12:35AM +0800, Guoniu Zhou wrote:
quoted
From: Guoniu Zhou <redacted>

Change the buffer selection logic to use pending buffers first (up to
the number available), and only use discard buffers to fill remaining
slots when insufficient pending buffers are queued. Ensure user
buffers are utilized as soon as possible, improving efficiency and
reducing the number of discarded frames at stream start.
The commit message should explain *why* the change is good. How does this
improve the behaviour ?
Will add the info in next version.
I'll queue 1/2 in my tree already.
quoted
Signed-off-by: Guoniu Zhou <redacted>
---
Changes in v2:
- Replace "This ensures" with "ensure"
- Put example from commit message to comment in driver suggested by Frank

https://lore.kernel.org/linux-media/20260311-isi_min_buffers-v1-0-c929
9d6e8ae6@nxp.com/T/#m2774912ed31553ef1fdcc840bd6eae53a03ecccd
---
 drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 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
1be3a728f32f89338a75ddcc4e96e7501ed954e1..77ebff03323ace50ff039c833
3d2
quoted
5a9c3dd44880 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
@@ -792,7 +792,14 @@ static void
mxc_isi_video_queue_first_buffers(struct mxc_isi_video *video)
quoted
 		struct mxc_isi_buffer *buf;
 		struct list_head *list;

-		list = i < discard ? &video->out_discard : &video->out_pending;
+		/*
+		 * Queue buffers: prioritize pending buffers, then discard
buffers
quoted
+		 * For example:
+		 * - 2 pending buffers: both slots use pending buffers
+		 * - 1 pending buffer: first slot uses pending, second uses
discard
quoted
+		 * - 0 pending buffers: both slots use discard buffers
+		 */
+		list = (i < 2 - discard) ? &video->out_pending :
+&video->out_discard;
 		buf = list_first_entry(list, struct mxc_isi_buffer, list);

 		mxc_isi_channel_set_outbuf(video->pipe, buf->dma_addrs,
buf_id);
quoted
--
Regards,

Laurent Pinchart
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help