提交 30398688 编写于 作者: M Michael Rodin 提交者: Zheng Zengkai

media: vsp1: Fix offset calculation for plane cropping

stable inclusion
from stable-v5.10.121
commit fc68385fcbac2838ee86562b63fcfdf86ca42627
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fc68385fcbac2838ee86562b63fcfdf86ca42627

--------------------------------

[ Upstream commit 5f25abec ]

The vertical subsampling factor is currently not considered in the
offset calculation for plane cropping done in rpf_configure_partition.
This causes a distortion (shift of the color plane) when formats with
the vsub factor larger than 1 are used (e.g. NV12, see
vsp1_video_formats in vsp1_pipe.c). This commit considers vsub factor
for all planes except plane 0 (luminance).

Drop generalization of the offset calculation to reduce the binary size.

Fixes: e5ad37b6 ("[media] v4l: vsp1: Add cropping support")
Signed-off-by: NMichael Rodin <mrodin@de.adit-jv.com>
Signed-off-by: NLUU HOAI <hoai.luu.ub@renesas.com>
Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 1188a755
...@@ -291,11 +291,11 @@ static void rpf_configure_partition(struct vsp1_entity *entity, ...@@ -291,11 +291,11 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
+ crop.left * fmtinfo->bpp[0] / 8; + crop.left * fmtinfo->bpp[0] / 8;
if (format->num_planes > 1) { if (format->num_planes > 1) {
unsigned int bpl = format->plane_fmt[1].bytesperline;
unsigned int offset; unsigned int offset;
offset = crop.top * format->plane_fmt[1].bytesperline offset = crop.top / fmtinfo->vsub * bpl
+ crop.left / fmtinfo->hsub + crop.left / fmtinfo->hsub * fmtinfo->bpp[1] / 8;
* fmtinfo->bpp[1] / 8;
mem.addr[1] += offset; mem.addr[1] += offset;
mem.addr[2] += offset; mem.addr[2] += offset;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册