bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0385-staging-bcm2835-codec-Pass-corrupt-frame-flag.patch
1 From 4cbf4590272002606374d4fcd31f99be85869a13 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 9 Dec 2020 18:53:56 +0000
4 Subject: [PATCH] staging/bcm2835-codec: Pass corrupt frame flag.
5
6 MMAL has the flag MMAL_BUFFER_HEADER_FLAG_CORRUPTED but that
7 wasn't being passed through, so add it.
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
10 ---
11 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 6 +++++-
12 1 file changed, 5 insertions(+), 1 deletion(-)
13
14 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
15 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
16 @@ -1019,6 +1019,7 @@ static void op_buffer_cb(struct vchiq_mm
17 struct mmal_buffer *mmal_buf)
18 {
19 struct bcm2835_codec_ctx *ctx = port->cb_ctx;
20 + enum vb2_buffer_state buf_state = VB2_BUF_STATE_DONE;
21 struct m2m_mmal_buffer *buf;
22 struct vb2_v4l2_buffer *vb2;
23
24 @@ -1075,6 +1076,9 @@ static void op_buffer_cb(struct vchiq_mm
25 vb2->flags |= V4L2_BUF_FLAG_LAST;
26 }
27
28 + if (mmal_buf->mmal_flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED)
29 + buf_state = VB2_BUF_STATE_ERROR;
30 +
31 /* vb2 timestamps in nsecs, mmal in usecs */
32 vb2->vb2_buf.timestamp = mmal_buf->pts * 1000;
33
34 @@ -1082,7 +1086,7 @@ static void op_buffer_cb(struct vchiq_mm
35 if (mmal_buf->mmal_flags & MMAL_BUFFER_HEADER_FLAG_KEYFRAME)
36 vb2->flags |= V4L2_BUF_FLAG_KEYFRAME;
37
38 - vb2_buffer_done(&vb2->vb2_buf, VB2_BUF_STATE_DONE);
39 + vb2_buffer_done(&vb2->vb2_buf, buf_state);
40 ctx->num_op_buffers++;
41
42 v4l2_dbg(2, debug, &ctx->dev->v4l2_dev, "%s: done %d output buffers\n",