Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	linux-media@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Alexi Birlinger <alexi.birlinger@nxp.com>,
	Guoniu Zhou <guoniu.zhou@nxp.com>
Subject: Re: [PATCH 2/2] media: nxp: imx8-isi: Prioritize pending buffers over discard buffers
Date: Wed, 11 Mar 2026 11:33:42 -0400	[thread overview]
Message-ID: <abGLVqeJ1C4_Fyhb@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260311-isi_min_buffers-v1-2-c9299d6e8ae6@nxp.com>

On Wed, Mar 11, 2026 at 04:02:59PM +0800, Guoniu Zhou wrote:
> From: Guoniu Zhou <guoniu.zhou@nxp.com>
>
> 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. This ensures user buffers

Nit: Ensure user ...

> are utilized as soon as possible, improving efficiency and reducing the
> number of discarded frames at stream start.
>
> For example:
> - 2 pending buffers: both slots use pending buffers
> - 1 pending buffer: first slot uses pending, second uses discard
> - 0 pending buffers: both slots use discard buffers
>
> Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
> ---
>  drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 3 ++-
>  1 file changed, 2 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 2405baf21594cd18cf2b349234313c5e103b7802..53f4f74369f7855fe6b6f372294ee569f40a8ae6 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c
> @@ -786,13 +786,14 @@ static void mxc_isi_video_queue_first_buffers(struct mxc_isi_video *video)
>  		: list_is_singular(&video->out_pending) ? 1
>  		: 0;
>
> +	/* Queue buffers: prioritize pending buffers, then discard buffers */
>  	for (i = 0; i < 2; ++i) {
>  		enum mxc_isi_buf_id buf_id = i == 0 ? MXC_ISI_BUF1
>  					   : MXC_ISI_BUF2;
>  		struct mxc_isi_buffer *buf;
>  		struct list_head *list;
>
> -		list = i < discard ? &video->out_discard : &video->out_pending;
> +		list = (i < 2 - discard) ? &video->out_pending : &video->out_discard;

Is (2 - discard) the number of pending buffers? put commit's example as
comments here.

Frank

>  		buf = list_first_entry(list, struct mxc_isi_buffer, list);
>
>  		mxc_isi_channel_set_outbuf(video->pipe, buf->dma_addrs, buf_id);
>
> --
> 2.34.1
>


  reply	other threads:[~2026-03-11 15:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11  8:02 [PATCH 0/2] media: nxp: imx8-isi: Fix single frame capture and optimize buffer usage Guoniu Zhou
2026-03-11  8:02 ` [PATCH 1/2] media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 1 Guoniu Zhou
2026-03-11 12:50   ` Jacopo Mondi
2026-03-12  2:21     ` G.N. Zhou (OSS)
2026-03-11 15:22   ` Frank Li
2026-03-12  2:22     ` G.N. Zhou (OSS)
2026-03-11  8:02 ` [PATCH 2/2] media: nxp: imx8-isi: Prioritize pending buffers over discard buffers Guoniu Zhou
2026-03-11 15:33   ` Frank Li [this message]
2026-03-12  2:29     ` G.N. Zhou (OSS)

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=abGLVqeJ1C4_Fyhb@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=alexi.birlinger@nxp.com \
    --cc=festevam@gmail.com \
    --cc=guoniu.zhou@nxp.com \
    --cc=guoniu.zhou@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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