Re: [PATCH v6 3/5] media: v4l2-common: Add kernel-doc for v4l2_fill_pixfmt_mp_aligned()
"Lad, Prabhakar" <[email protected]>
| Newsgroups | org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media |
|---|---|
| Message-ID | <CA+V-a8vePb44xDTgxjb+5-wtOiZqWt_+oREs2fikgOCZbBGaEA@mail.gmail.com> |
On Wed, Aug 19, 2026 at 11:32 AM Tommaso Merciai <[email protected]> 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. > > Reviewed-by: Jacopo Mondi <[email protected]> > Signed-off-by: Tommaso Merciai <[email protected]> > --- > v5->v6: > - No changes. > > v4->v5: > - No changes. > > v3->v4: > - Collected tag. > - Fixed function documentation. > > v2->v3: > - Moved to PATCH 3/4 > - Fixed documentation as suggested by Sven Püschel > > v1->v2: > - New patch > > include/media/v4l2-common.h | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > Reviewed-by: Lad Prabhakar <[email protected]> Cheers, Prabhakar > diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h > index 4e5c5ffaf651..33f5713734cb 100644 > --- a/include/media/v4l2-common.h > +++ b/include/media/v4l2-common.h > @@ -591,7 +591,33 @@ static inline int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, > return v4l2_fill_pixfmt_aligned(pixfmt, pixelformat, width, height, 1); > } > > -/* @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 > + * is set to the primary plane stride. 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 instead. plane_fmt[0].sizeimage covers all > + * component planes. > + * > + * For formats with multiple memory planes (mem_planes > 1), each plane's > + * bytesperline is independently rounded up to @stride_alignment, and each > + * plane's 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); > -- > 2.54.0 > >