media: rcar-vin: Fix NV12 size alignment
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Sat, 11 Feb 2023 20:54:32 +0000 (21:54 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 8 May 2023 11:11:25 +0000 (12:11 +0100)
When doing format validation for NV12 the width and height should be
aligned to 32 pixels.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/renesas/rcar-vin/rcar-dma.c

index cc6b59e5621aef042db200aa4af5946c2e75d92b..23598e22adc7295f05313de6a229cac831bed0cf 100644 (file)
@@ -1320,9 +1320,15 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
                if (!vin->scaler)
                        return -EPIPE;
        } else {
-               if (fmt.format.width != vin->format.width ||
-                   fmt.format.height != vin->format.height)
-                       return -EPIPE;
+               if (vin->format.pixelformat == V4L2_PIX_FMT_NV12) {
+                       if (ALIGN(fmt.format.width, 32) != vin->format.width ||
+                           ALIGN(fmt.format.height, 32) != vin->format.height)
+                               return -EPIPE;
+               } else {
+                       if (fmt.format.width != vin->format.width ||
+                           fmt.format.height != vin->format.height)
+                               return -EPIPE;
+               }
        }
 
        if (fmt.format.code != vin->mbus_code)