154027259c80cf73a91ce8bd2c05d371f337fda0
[openwrt/staging/linusw.git] /
1 From 487f3643b6031dd98ef176841e1c15889e3f3d2f Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Mon, 22 Jul 2019 22:13:30 +0800
4 Subject: [PATCH 744/782] staging: bcm2835-codec: implement
5 V4L2_CID_MIN_BUFFERS_FOR_CAPTURE
6
7 The stateful decoder specification shows an optional step for retrieving
8 the miminum number of capture buffers required for the decoder to
9 proceed. While not a required parameter, having it makes some
10 applications happy.
11
12 bcm2835-codec is a little different from other decoder implementations
13 in that there is an intermediate format conversion between the hardware
14 and V4L2 buffers. The number of capture buffers required is therefore
15 independent of the stream and DPB etc.
16
17 There are plans to remove the conversion, but it requires a fair amount
18 of rework within the firmware. Until that is done, simply return a value
19 of 1.
20
21 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
22 ---
23 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 12 ++++++++++++
24 1 file changed, 12 insertions(+)
25
26 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
27 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
28 @@ -2357,6 +2357,18 @@ static int bcm2835_codec_open(struct fil
29 }
30 ctx->fh.ctrl_handler = hdl;
31 v4l2_ctrl_handler_setup(hdl);
32 + } else if (dev->role == DECODE) {
33 + v4l2_ctrl_handler_init(hdl, 1);
34 +
35 + v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
36 + V4L2_CID_MIN_BUFFERS_FOR_CAPTURE,
37 + 1, 1, 1, 1);
38 + if (hdl->error) {
39 + rc = hdl->error;
40 + goto free_ctrl_handler;
41 + }
42 + ctx->fh.ctrl_handler = hdl;
43 + v4l2_ctrl_handler_setup(hdl);
44 }
45
46 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);