Re: [PATCH 1/3] drm/rockchip: vop2: Use drm_format_info_min_pitch() for plane offsets
From: Chaoyi Chen
Date: Thu Oct 22 2026 - 21:12:42 EST
Hi Heiko,
On 10/22/2026 8:59 PM, Heiko Stübner wrote:
> Hi Chaoyi,
>
> Am Donnerstag, 22. Oktober 2026, 09:17:35 Mitteleuropäische Sommerzeit schrieb Chaoyi Chen:
>> From: Chaoyi Chen <chaoyi.chen@xxxxxxxxxxxxxx>
>>
>> Use the block aware helper instead of cpp[], the latter aliases
>> char_per_block and is wrong for packed 10-bit formats like NV15,
>> NV20 and NV30.
>>
>> Tested with modetest[0]:
>>
>> ```
>> modetest -s 86:3840x2160 -P \
>> 59@83:3940x2160~96,0,3840,2160+0+0@NV20 -a
>> ```
>>
>> fb size (3940x2160), src at (96, 0) with size (3840x2160),
>> dst at (0, 0) with size (3840x2160)
>>
>> [0]: https://github.com/windowsair/libdrm/tree/src-pos-support
>>
>> Assisted-by: LLM
>> Signed-off-by: Chaoyi Chen <chaoyi.chen@xxxxxxxxxxxxxx>
>> ---
>> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
>> index 4cce3e336f5b..480aa8c8a8d2 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,6 +1309,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
>> int hsub = fb->format->hsub;
>> int vsub = fb->format->vsub;
>>
>> + offset = drm_format_info_min_pitch(fb->format, 1, src->x1 >> 16) / hsub;
>> offset = (src->x1 >> 16) * fb->format->cpp[1] / hsub;
>
> missing removal of the replaced line?
>
Oh, it is. Will fix in v2.
>
> Heiko
>
>> offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
>>
>>
>
--
Best,
Chaoyi