a2f3c8471da13e6ebbf9b4e9583b6138e6f0f142
[openwrt/staging/blogic.git] /
1 From e3feb9db3003d5461be4c186c12225120af3883c Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 16 Sep 2021 16:32:53 +0100
4 Subject: [PATCH] staging: bcm2835-codec: Format changed should trigger
5 drain
6
7 When a format changed event occurs, the spec says that it
8 triggers an implicit drain, and that needs to be signalled
9 via -EPIPE.
10
11 For BCM2835, the format changed event happens at the point
12 the format change occurs, so no further buffers exist from
13 before the resolution changed point. We therefore signal the
14 last buffer immediately.
15 We don't have a V4L2 available to us at this point, so set
16 the videobuf2 queue last_buffer_dequeued flag directly.
17
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 ---
20 .../staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 5 +++++
21 1 file changed, 5 insertions(+)
22
23 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
24 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
25 @@ -1005,6 +1005,7 @@ static void handle_fmt_changed(struct bc
26 (struct mmal_msg_event_format_changed *)mmal_buf->buffer;
27 struct mmal_parameter_video_interlace_type interlace;
28 int interlace_size = sizeof(interlace);
29 + struct vb2_queue *vq;
30 int ret;
31
32 v4l2_dbg(1, debug, &ctx->dev->v4l2_dev, "%s: Format changed: buff size min %u, rec %u, buff num min %u, rec %u\n",
33 @@ -1074,6 +1075,10 @@ static void handle_fmt_changed(struct bc
34 q_data->field = V4L2_FIELD_NONE;
35 }
36
37 + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
38 + if (vq->streaming)
39 + vq->last_buffer_dequeued = true;
40 +
41 queue_res_chg_event(ctx);
42 }
43