From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: "Sven Püschel" <s.pueschel@pengutronix.de>
Cc: tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
biju.das.jz@bp.renesas.com,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Mehdi Djait <mehdi.djait@linux.intel.com>,
Nas Chung <nas.chung@chipsnmedia.com>,
Isaac Scott <isaac.scott@ideasonboard.com>,
Paul Cercueil <paul@crapouillou.net>,
Daniel Scally <dan.scally+renesas@ideasonboard.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
Subject: Re: [PATCH v2 2/4] media: v4l2-common: Add kernel-doc for v4l2_fill_pixfmt_mp_aligned()
Date: Fri, 3 Jul 2026 16:16:48 +0200 [thread overview]
Message-ID: <akfEUDVXIXDU2GCu@tom-desktop> (raw)
In-Reply-To: <8d336c44-1fe9-4f9e-8d00-3e1d735e40b7@pengutronix.de>
Hi Sven,
Thanks for your review.
On Fri, Jul 03, 2026 at 02:14:55PM +0200, Sven Püschel wrote:
> Hi Tommaso,
>
> thanks for adding documentation.
>
> On 7/1/26 6:49 PM, Tommaso Merciai wrote:
> > Replace the bare placeholder comment with a full kernel-doc block
> > documenting all parameters, the function behaviour for both single
> > memory plane (mem_planes == 1) and multiple memory plane (mem_planes > 1)
> > formats, and the return value.
> >
> > Signed-off-by: Tommaso Merciai<tommaso.merciai.xr@bp.renesas.com>
> > ---
> > v1->v2:
> > - New patch
> >
> > include/media/v4l2-common.h | 27 ++++++++++++++++++++++++++-
> > 1 file changed, 26 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
> > index 749fe38c134e..db59dda578f0 100644
> > --- a/include/media/v4l2-common.h
> > +++ b/include/media/v4l2-common.h
> > @@ -557,7 +557,32 @@ void v4l2_apply_frmsize_constraints(u32 *width, u32 *height,
> > int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat,
> > u32 width, u32 height);
> > -/* @stride_alignment is a power of 2 value in bytes */
> > +/**
> > + * v4l2_fill_pixfmt_mp_aligned - Fill in a &struct v4l2_pix_format_mplane with
> > + * stride alignment requirements.
> > + *
> > + * @pixfmt: pointer to the &struct v4l2_pix_format_mplane to be filled
> > + * @pixelformat: the V4L2 pixel format (V4L2_PIX_FMT_*)
> > + * @width: image width in pixels
> > + * @height: image height in pixels
> > + * @stride_alignment: stride alignment in bytes; must be a power of 2
> > + *
> > + * Fills all fields of @pixfmt for the given pixel format, dimensions, and
> > + * stride alignment.
> > + *
> > + * For formats stored in a single memory plane (mem_planes == 1), the
> > + * behaviour matches v4l2_fill_pixfmt_aligned(): plane_fmt[0].bytesperline
> Given that the v4l2_fill_pixfmt_aligned helper is added later in patch 3,
> don't you want to move this patch after adding the helper?
You are correct, thanks.
I will move this after adding the helper in v3.
> > + * is set to the primary plane stride rounded up to @stride_alignment, and
> > + * per-component alignments are scaled to keep chroma strides consistently
> > + * derivable from the luma stride. plane_fmt[0].sizeimage covers all
>
> No, it's the other way: The strides of all components are aligned to the
> @stride_alignment. To keep the chroma strides consistently derivable from
> the luma stride, strides may be aligned to a multiple of the
> @stride_alignment.
>
> (feel free to use the above if it sounds good)
Thanks for the clarification.
I will use your suggestion in v3.
Kind Regards,
Tommaso
>
> At least I read your text, as if only the y stride would be rounded up to
> the nearest alignment and for other component strides may be scaled down to
> 1/2 or 1/4 of the alignment. But most of the time the y stride will be
> scaled up (e.g. YUV420 or YUV410) and in rare cases (e.g. NV24/42) the
> component stride is scaled up.
>
> Sincerely
> Sven
>
> > + * component planes.
> > + *
> > + * For formats with multiple memory planes (mem_planes > 1), each plane's
> > + * bytesperline is independently rounded up to @stride_alignment, and
> > + * sizeimage is set to bytesperline multiplied by the plane height.
> > + *
> > + * Return: 0 on success, -EINVAL if @pixelformat is unknown.
> > + */
> > int v4l2_fill_pixfmt_mp_aligned(struct v4l2_pix_format_mplane *pixfmt,
> > u32 pixelformat, u32 width, u32 height,
> > u8 stride_alignment);
next prev parent reply other threads:[~2026-07-03 14:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 16:49 [PATCH v2 0/4] media: rzg2l-cru: Fix DMA stride alignment Tommaso Merciai
2026-07-01 16:49 ` [PATCH v2 1/4] media: v4l2-common: Convert v4l2_fill_pixfmt_mp() to static inline wrapper Tommaso Merciai
2026-07-01 16:49 ` [PATCH v2 2/4] media: v4l2-common: Add kernel-doc for v4l2_fill_pixfmt_mp_aligned() Tommaso Merciai
2026-07-03 12:14 ` Sven Püschel
2026-07-03 14:16 ` Tommaso Merciai [this message]
2026-07-01 16:50 ` [PATCH v2 3/4] media: v4l2-common: Add v4l2_fill_pixfmt_aligned() helper Tommaso Merciai
2026-07-01 16:50 ` [PATCH v2 4/4] media: rzg2l-cru: Align bytesperline to hardware DMA stride requirement 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=akfEUDVXIXDU2GCu@tom-desktop \
--to=tommaso.merciai.xr@bp.renesas.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=kernel@pengutronix.de \
--cc=laurent.pinchart@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=nas.chung@chipsnmedia.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 \
/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