From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Stefan Riedmueller <s.riedmueller@phytec.de>,
Jacopo Mondi <jacopo@jmondi.org>,
Christian Hemp <c.hemp@phytec.de>, Frank Li <frank.li@nxp.com>,
Dong Aisheng <aisheng.dong@nxp.com>,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Guoniu Zhou <guoniu.zhou@nxp.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v3 2/2] media: nxp: imx8-isi: Fix scale factor calculation for hardware rounding
Date: Wed, 20 May 2026 21:37:52 +0200 [thread overview]
Message-ID: <20260520193752.GA12152@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260323-isi-v3-2-8df53b24e622@oss.nxp.com>
Hi Guoniu,
Thank you for the patch.
On Mon, Mar 23, 2026 at 04:33:31PM +0800, Guoniu Zhou wrote:
> From: Guoniu Zhou <guoniu.zhou@nxp.com>
>
> The ISI hardware rounds the actual output size up to an integer, as
> described in i.MX93 Reference Manual section 57.7.8 (Channel 0 Scale
> Factor). The scale factor must be calculated to ensure the theoretical
> output value rounds up to exactly the desired size.
>
> Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
> ---
> drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> index 37e59d687ed7..a2edac8292a7 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> @@ -112,7 +112,16 @@ static u32 mxc_isi_channel_scaling_ratio(unsigned int from, unsigned int to,
> else
> *dec = 8;
>
> - return min_t(u32, from * 0x1000 / (to * *dec), ISI_DOWNSCALE_THRESHOLD);
> + /*
> + * The ISI rounds output dimensions up to the next integer (i.MX93 RM
> + * section 57.7.8). Calculate the scale factor such that the theoretical
> + * output (input / scale_factor) rounds up to exactly the desired output.
I assume you have verified this applies to the ISI in the i.MX8 family.
> + *
> + * Example from the reference manual: Scaling 800 to 720 lines
> + * - scale = 0x11C8: 800/0x1C8 = 719.859375 -> 720 (correct)
> + * - scale = 0x11C7: 800/0x1C7 = 720.017578 -> 721 (one extra line)
I think the first paragraph is clear enough, the example is not
required.
> + */
> + return min_t(u32, DIV_ROUND_UP(from * 0x1000, to * *dec), ISI_DOWNSCALE_THRESHOLD);
Line wrap please.
return min_t(u32, DIV_ROUND_UP(from * 0x1000, to * *dec),
ISI_DOWNSCALE_THRESHOLD);
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
No need to send a new version, I'll handle those changes.
> }
>
> static void mxc_isi_channel_set_scaling(struct mxc_isi_pipe *pipe,
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2026-05-20 19:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 8:33 [PATCH v3 0/2] media: nxp: imx8-isi: Fix scaler rounding and downscaling limits Guoniu Zhou
2026-03-23 8:33 ` [PATCH v3 1/2] media: nxp: imx8-isi: Fix potential out-of-bounds issues Guoniu Zhou
2026-05-20 17:41 ` Laurent Pinchart
2026-03-23 8:33 ` [PATCH v3 2/2] media: nxp: imx8-isi: Fix scale factor calculation for hardware rounding Guoniu Zhou
2026-05-20 19:37 ` Laurent Pinchart [this message]
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=20260520193752.GA12152@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=aisheng.dong@nxp.com \
--cc=c.hemp@phytec.de \
--cc=festevam@gmail.com \
--cc=frank.li@nxp.com \
--cc=guoniu.zhou@nxp.com \
--cc=guoniu.zhou@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=jacopo@jmondi.org \
--cc=kernel@pengutronix.de \
--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 \
--cc=s.riedmueller@phytec.de \
--cc=shawnguo@kernel.org \
--cc=stable@vger.kernel.org \
/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