From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Cc: tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
biju.das.jz@bp.renesas.com, jacopo.mondi@ideasonboard.com,
"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Hans Verkuil" <hverkuil+cisco@kernel.org>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Sven Püschel" <s.pueschel@pengutronix.de>,
"Mehdi Djait" <mehdi.djait@linux.intel.com>,
"Paul Cercueil" <paul@crapouillou.net>,
"Isaac Scott" <isaac.scott@ideasonboard.com>,
"Daniel Scally" <dan.scally+renesas@ideasonboard.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] media: rzg2l-cru: Align bytesperline to hardware DMA stride requirement
Date: Wed, 24 Jun 2026 22:53:34 +0300 [thread overview]
Message-ID: <20260624195334.GI851255@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260624104153.798953-3-tommaso.merciai.xr@bp.renesas.com>
On Wed, Jun 24, 2026 at 12:41:31PM +0200, Tommaso Merciai wrote:
> The RZ/G3E CRU programs the line stride via the AMnIS register, whose
> IS field encodes the value in units of 128 bytes. If bytesperline is
> not a multiple of 128, the division truncates and the hardware uses a
> wrong stride, causing horizontal banding.
>
> commit ace92ccef0c9 ("media: platform: rzg2l-cru: Use v4l2_fill_pixfmt()")
s/commit/Commit/
> replaced the open-coded aligned calculation with v4l2_fill_pixfmt(),
> which sets no alignment, reintroducing the issue.
I wonder how I missed that. Sorry.
> Switch to v4l2_fill_pixfmt_aligned() with RZG2L_CRU_STRIDE_ALIGN when
> info->has_stride is set. RZ/G2L has no AMnIS register and keeps using
> v4l2_fill_pixfmt() unchanged.
>
> Fixes: ace92ccef0c9 ("media: platform: rzg2l-cru: Use v4l2_fill_pixfmt()")
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index 69346a585f9f..478264f26466 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -860,7 +860,8 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
> v4l_bound_align_image(&pix->width, 320, info->max_width, 1,
> &pix->height, 240, info->max_height, 0, 0);
>
> - v4l2_fill_pixfmt(pix, pix->pixelformat, pix->width, pix->height);
> + v4l2_fill_pixfmt_aligned(pix, pix->pixelformat, pix->width, pix->height,
> + info->has_stride ? RZG2L_CRU_STRIDE_ALIGN : 1);
The documentation states that, for RGB888, the stride has to be a
multiple of 384 (3*128). Shouldn't you take that into account here ?
Also, for semi-planar YUV 4:2:0, the hardware seems to use a stride
equal to AMnIS*2, which leaves blank lines after every U/V line. That's
something userspace doesn't expect.
>
> dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n",
> pix->width, pix->height, pix->bytesperline, pix->sizeimage);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-06-24 19:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 10:41 [PATCH 0/2] media: rzg2l-cru: Fix DMA stride alignment Tommaso Merciai
2026-06-24 10:41 ` [PATCH 1/2] media: v4l2-common: add v4l2_fill_pixfmt_aligned() helper Tommaso Merciai
2026-06-24 19:28 ` Laurent Pinchart
2026-06-25 8:12 ` Tommaso Merciai
2026-06-25 8:51 ` Laurent Pinchart
2026-06-24 10:41 ` [PATCH 2/2] media: rzg2l-cru: Align bytesperline to hardware DMA stride requirement Tommaso Merciai
2026-06-24 19:53 ` Laurent Pinchart [this message]
2026-06-25 11:01 ` Tommaso Merciai
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=20260624195334.GI851255@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=dan.scally+renesas@ideasonboard.com \
--cc=hverkuil+cisco@kernel.org \
--cc=isaac.scott@ideasonboard.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@linux.intel.com \
--cc=nicolas.dufresne@collabora.com \
--cc=paul@crapouillou.net \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=s.pueschel@pengutronix.de \
--cc=sakari.ailus@linux.intel.com \
--cc=tomm.merciai@gmail.com \
--cc=tommaso.merciai.xr@bp.renesas.com \
/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