From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 1/3] drm/rockchip: vop2: Use drm_format_info_min_pitch() for plane offsets
Date: Mon, 16 Nov 2026 09:04:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-216579@kernel.org> (raw)
In-Reply-To: <20261116084555.1061-2-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/rockchip: vop2: unaligned block offset for 10-bit packed
YUV in vop2_plane_atomic_update()
--
commit e065b869dbf756b6652ed995b5a03b6d5409975e
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
drm/rockchip: vop2: Use drm_format_info_min_pitch() for plane offsets
This commit replaces fb->format->cpp[] with drm_format_info_min_pitch()
when calculating plane byte offsets in vop2_plane_atomic_update() to
support block-packed 10-bit formats such as NV15, NV20, and NV30.
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index bfb3841425687..0de038acb56fc 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> @@ -1290,7 +1290,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
>
> afbc_en = drm_is_afbc(fb->modifier);
>
> - offset = (src->x1 >> 16) * fb->format->cpp[0];
> + offset = drm_format_info_min_pitch(fb->format, 0, src->x1 >> 16);
>
> /*
> * AFBC HDR_PTR must set to the zero offset of the framebuffer.
> @@ -1309,7 +1309,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
> int hsub = fb->format->hsub;
> int vsub = fb->format->vsub;
>
> - offset = (src->x1 >> 16) * fb->format->cpp[1] / hsub;
> + offset = (u32)drm_format_info_min_pitch(fb->format, 1, src->x1 >> 16) / hsub;
> offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
>
> if ((pstate->rotation & DRM_MODE_REFLECT_Y) && !afbc_en)
[Severity: Medium]
Can this compute misaligned yrgb_mst and uv_mst offsets for NV15, NV20,
and NV30 when src->x1 >> 16 is not a multiple of 4?
Those formats pack 4 luma pixels and 2 chroma pairs into 5-byte blocks
(char_per_block = { 5, 5, 0 }, block_w = { 4, 2, 0 }), but
vop2_plane_atomic_check() only requires 2-pixel alignment on src_x for YUV
formats:
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:vop2_plane_atomic_check() {
...
if (fb->format->is_yuv && src_x % 2) {
drm_dbg_kms(vop2->drm, "Invalid Source: Yuv format not support odd xpos\n");
return -EINVAL;
}
...
}
When src_x % 4 == 2 (2.5 bytes into a 5-byte block),
drm_format_info_min_pitch() rounds plane 0 up via DIV_ROUND_UP_ULL() to a
3-byte offset inside a packed 4-pixel block, while dividing plane 1's
5-byte result by hsub = 2 on NV15 and NV20 truncates uv_mst down to a
2-byte offset. This corrupts scanout and, when src_x + src_w reaches
fb->width with src_w % 4 == 2, can cause DMA to read 1 byte past the
validated framebuffer pitch on the final scanline. Should
vop2_plane_atomic_check() also require src_x to be aligned to
drm_format_info_block_width()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116084555.1061-1-kernel@airkyi.com?part=1
next prev parent reply other threads:[~2026-11-16 9:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 8:45 [PATCH v3 0/3] drm/rockchip: vop2: Add 8K support for RK3588 vop2 Chaoyi Chen
2026-11-16 8:45 ` Chaoyi Chen
2026-11-16 8:45 ` [PATCH v3 1/3] drm/rockchip: vop2: Use drm_format_info_min_pitch() for plane offsets Chaoyi Chen
2026-11-16 8:45 ` Chaoyi Chen
2026-11-16 9:04 ` sashiko-bot [this message]
2026-11-16 8:45 ` [PATCH v3 2/3] drm/rockchip: vop2: Skip UV plane setup for packed YUV formats Chaoyi Chen
2026-11-16 8:45 ` Chaoyi Chen
2026-11-16 8:45 ` [PATCH v3 3/3] drm/rockchip: vop2: Support 8K output by splicing two video ports Chaoyi Chen
2026-11-16 8:45 ` Chaoyi Chen
2026-11-16 9:24 ` 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-216579@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@airkyi.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.