summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Rodin <mrodin@de.adit-jv.com>2021-11-23 14:50:36 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-13 12:02:21 +0300
commit5f25abec8f21b7527c1223a354d23c270befddb3 (patch)
tree754d9b58666bdb04892942c7c28ba66bea500cef /drivers/media
parentbf7d5ee1ed7026b0412df26eea23d16e29fb7285 (diff)
downloadlinux-5f25abec8f21b7527c1223a354d23c270befddb3.tar.xz
media: vsp1: Fix offset calculation for plane cropping
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: e5ad37b64de9 ("[media] v4l: vsp1: Add cropping support") Signed-off-by: Michael Rodin <mrodin@de.adit-jv.com> Signed-off-by: LUU HOAI <hoai.luu.ub@renesas.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/renesas/vsp1/vsp1_rpf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
index 85587c1b6a37..75083cb234fe 100644
--- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
@@ -291,11 +291,11 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
+ crop.left * fmtinfo->bpp[0] / 8;
if (format->num_planes > 1) {
+ unsigned int bpl = format->plane_fmt[1].bytesperline;
unsigned int offset;
- offset = crop.top * format->plane_fmt[1].bytesperline
- + crop.left / fmtinfo->hsub
- * fmtinfo->bpp[1] / 8;
+ offset = crop.top / fmtinfo->vsub * bpl
+ + crop.left / fmtinfo->hsub * fmtinfo->bpp[1] / 8;
mem.addr[1] += offset;
mem.addr[2] += offset;
}