From: sashiko-bot@kernel.org
To: "Arash Golgol" <arash.golgol@gmail.com>, linux-sunxi@lists.linux.dev
Cc: media-ci@linuxtv.org
Subject: Re: [PATCH v1 RESEND 1/3] media: sun6i-csi: capture: Align size to 16 for NV12_16L16
Date: Fri, 04 Dec 2026 11:11:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-249661@kernel.org> (raw)
In-Reply-To: <20261204105114.23758-2-arash.golgol@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] media: sun6i-csi: NV12_16L16 height alignment leaves partial
chroma tiles
- [Low] media: sun6i-csi: missing Fixes trailer for NV12_16L16 alignment
fix
--
commit 4b8ff24cde9c84f3080742e2927f26041221e015
Author: Arash Golgol <arash.golgol@gmail.com>
> media: sun6i-csi: capture: Align size to 16 for NV12_16L16
>
> The NV12_16L16 format is made of 16x16 tiles, so both the width and
> the height must be a multiple of 16. The format preparation always
> aligned dimensions to 2 pixels, whatever the pixel format, which
> allowed sizes covering partial tiles.
>
> Select the alignment from the pixel format, and do so after the
> pixel format fallback so that the final format is the one used.
>
> Assisted-by: Claude:claude-sonnet-5-5
> Signed-off-by: Arash Golgol <arash.golgol@gmail.com>
[Severity: Low]
This looks like a bug fix for NV12_16L16 format alignment. Should this
include:
Fixes: 5cc7522d8965 ("media: sun6i: Add support for Allwinner CSI V3s")
> diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c
> index d90abba213098..f55edfd0b174a 100644
> --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c
> +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c
> @@ -41,6 +41,12 @@ void sun6i_csi_capture_format(struct sun6i_csi_device *csi_dev,
> *field = csi_dev->capture.format.fmt.pix.field;
> }
>
> +static unsigned int sun6i_csi_capture_format_align(u32 pixelformat)
> +{
> + /* Returns log2 of the required alignment. */
> + return pixelformat == V4L2_PIX_FMT_NV12_16L16 ? 4 : 1;
> +}
> +
> /* Format */
>
> static const struct sun6i_csi_capture_format sun6i_csi_capture_formats[] = {
> @@ -665,17 +671,19 @@ static void sun6i_csi_capture_format_prepare(struct v4l2_format *format)
> {
> struct v4l2_pix_format *pix_format = &format->fmt.pix;
> const struct v4l2_format_info *info;
> - unsigned int width, height;
> -
> - v4l_bound_align_image(&pix_format->width, SUN6I_CSI_CAPTURE_WIDTH_MIN,
> - SUN6I_CSI_CAPTURE_WIDTH_MAX, 1,
> - &pix_format->height, SUN6I_CSI_CAPTURE_HEIGHT_MIN,
> - SUN6I_CSI_CAPTURE_HEIGHT_MAX, 1, 0);
> + unsigned int width, height, align;
>
> if (!sun6i_csi_capture_format_find(pix_format->pixelformat))
> pix_format->pixelformat =
> sun6i_csi_capture_formats[0].pixelformat;
>
> + align = sun6i_csi_capture_format_align(pix_format->pixelformat);
> +
> + v4l_bound_align_image(&pix_format->width, SUN6I_CSI_CAPTURE_WIDTH_MIN,
> + SUN6I_CSI_CAPTURE_WIDTH_MAX, align,
> + &pix_format->height, SUN6I_CSI_CAPTURE_HEIGHT_MIN,
> + SUN6I_CSI_CAPTURE_HEIGHT_MAX, align, 0);
> +
> width = pix_format->width;
> height = pix_format->height;
[Severity: Medium]
Does aligning height to 16 pixels still leave partial chroma tiles for
V4L2_PIX_FMT_NV12_16L16?
V4L2_PIX_FMT_NV12_16L16 is a 4:2:0 semi-planar format where both the luma
and chroma planes use 16x16 tiles. Because the chroma plane has half as
many lines as the luma plane, one row of chroma tiles spans 32 image lines.
With 16-pixel height alignment, an odd multiple of 16 (such as 1280x720)
leaves a half-row of chroma tiles, and sun6i_csi_capture_format_prepare()
still computes sizeimage as (width * 12 / 8) * height. This leaves the
buffer short by width * 8 bytes for consumers expecting full chroma tiles.
Aligning height to 32 pixels (halign = 5), or padding the chroma plane in
sizeimage to width * ALIGN(height, 32) / 2 if 16-pixel heights must be
kept, would avoid partial chroma tiles.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204105114.23758-1-arash.golgol@gmail.com?part=1
next prev parent reply other threads:[~2026-12-04 11:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 10:51 [PATCH v1 RESEND 0/3] media: sun6i-csi: Improve capture and bridge Arash Golgol
2026-12-04 10:51 ` [PATCH v1 RESEND 1/3] media: sun6i-csi: capture: Align size to 16 for NV12_16L16 Arash Golgol
2026-12-04 11:11 ` sashiko-bot [this message]
2026-12-04 10:51 ` [PATCH v1 RESEND 2/3] media: sun6i-csi: capture: Add enum_framesizes support Arash Golgol
2026-12-04 10:51 ` [PATCH v1 RESEND 3/3] media: sun6i-csi: bridge: Remove duplicate mbus format entries Arash Golgol
2026-12-04 10:55 ` sashiko-bot
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=sashiko-outbox-249661@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arash.golgol@gmail.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/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