1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-15 04:42:02 +00:00
openmptcprouter/root/target/linux/bcm27xx/patches-5.14/0408-bcm2835-Allow-compressed-frames-to-set-sizeimage-438.patch
Ycarus (Yannick Chabanois) 5c593832cc Add 5.14 patches for RPI
2021-10-01 16:58:58 +02:00

52 lines
2.1 KiB
Diff

From 835287f632a0c54e98c7779a4c972bcf23d22fad Mon Sep 17 00:00:00 2001
From: jc-kynesim <jc@kynesim.co.uk>
Date: Fri, 11 Jun 2021 15:14:31 +0100
Subject: [PATCH 408/552] bcm2835: Allow compressed frames to set sizeimage
(#4386)
Allow the user to set sizeimage in TRY_FMT and S_FMT if the format
flags have V4L2_FMT_FLAG_COMPRESSED set
Signed-off-by: John Cox <jc@kynesim.co.uk>
---
.../bcm2835-codec/bcm2835-v4l2-codec.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
index a97666a1a4be..c3ba5c25a2ab 100644
--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
@@ -1291,6 +1291,8 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
static int vidioc_try_fmt(struct bcm2835_codec_ctx *ctx, struct v4l2_format *f,
struct bcm2835_codec_fmt *fmt)
{
+ unsigned int sizeimage;
+
/*
* The V4L2 specification requires the driver to correct the format
* struct if any of the dimensions is unsupported
@@ -1319,9 +1321,18 @@ static int vidioc_try_fmt(struct bcm2835_codec_ctx *ctx, struct v4l2_format *f,
f->fmt.pix_mp.num_planes = 1;
f->fmt.pix_mp.plane_fmt[0].bytesperline =
get_bytesperline(f->fmt.pix_mp.width, fmt);
- f->fmt.pix_mp.plane_fmt[0].sizeimage =
- get_sizeimage(f->fmt.pix_mp.plane_fmt[0].bytesperline,
- f->fmt.pix_mp.width, f->fmt.pix_mp.height, fmt);
+ sizeimage = get_sizeimage(f->fmt.pix_mp.plane_fmt[0].bytesperline,
+ f->fmt.pix_mp.width, f->fmt.pix_mp.height,
+ fmt);
+ /*
+ * Drivers must set sizeimage for uncompressed formats
+ * Compressed formats allow the client to request an alternate
+ * size for the buffer.
+ */
+ if (!(fmt->flags & V4L2_FMT_FLAG_COMPRESSED) ||
+ f->fmt.pix_mp.plane_fmt[0].sizeimage < sizeimage)
+ f->fmt.pix_mp.plane_fmt[0].sizeimage = sizeimage;
+
memset(f->fmt.pix_mp.plane_fmt[0].reserved, 0,
sizeof(f->fmt.pix_mp.plane_fmt[0].reserved));
--
2.33.0