Patch "media: vsp1: Fix offset calculation for plane cropping" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    media: vsp1: Fix offset calculation for plane cropping

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-vsp1-fix-offset-calculation-for-plane-cropping.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e9a41c3addbcb3f08f22ca4b0eeec45152389d99
Author: Michael Rodin <mrodin@xxxxxxxxxxxxxx>
Date:   Tue Nov 23 12:50:36 2021 +0100

    media: vsp1: Fix offset calculation for plane cropping
    
    [ Upstream commit 5f25abec8f21b7527c1223a354d23c270befddb3 ]
    
    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@xxxxxxxxxxxxxx>
    Signed-off-by: LUU HOAI <hoai.luu.ub@xxxxxxxxxxx>
    Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
    Reviewed-by: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
index 85587c1b6a37..75083cb234fe 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/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;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux