tn3399_openwrt/target/linux/bcm27xx/patches-5.15/950-0493-staging-bcm2835-codec-Allow-custom-specified-strides.patch
Álvaro Fernández Rojas 20ea6adbf1 bcm27xx: add support for linux v5.15
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B

Signed-off-by: Marty Jones <mj8263788@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2022-05-17 15:11:22 +02:00

40 lines
1.6 KiB
Diff

From f4d34546637944b30ef09e96aa84802d7d69e72c Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Sat, 11 Sep 2021 17:21:07 +0100
Subject: [PATCH] staging: bcm2835-codec: Allow custom specified
strides/bytesperline.
If the client provides a bytesperline value in try_fmt/s_fmt then
validate it and correct if necessary.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
.../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
@@ -1347,7 +1347,7 @@ static int vidioc_g_fmt_vid_cap(struct f
static int vidioc_try_fmt(struct bcm2835_codec_ctx *ctx, struct v4l2_format *f,
struct bcm2835_codec_fmt *fmt)
{
- unsigned int sizeimage;
+ unsigned int sizeimage, min_bytesperline;
/*
* The V4L2 specification requires the driver to correct the format
@@ -1375,8 +1375,12 @@ static int vidioc_try_fmt(struct bcm2835
f->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 16);
}
f->fmt.pix_mp.num_planes = 1;
+ min_bytesperline = get_bytesperline(f->fmt.pix_mp.width, fmt);
+ if (f->fmt.pix_mp.plane_fmt[0].bytesperline < min_bytesperline)
+ f->fmt.pix_mp.plane_fmt[0].bytesperline = min_bytesperline;
f->fmt.pix_mp.plane_fmt[0].bytesperline =
- get_bytesperline(f->fmt.pix_mp.width, fmt);
+ ALIGN(f->fmt.pix_mp.plane_fmt[0].bytesperline, fmt->bytesperline_align);
+
sizeimage = get_sizeimage(f->fmt.pix_mp.plane_fmt[0].bytesperline,
f->fmt.pix_mp.width, f->fmt.pix_mp.height,
fmt);