da273ca65bd0344fe759168a5f359d5b4bb3d2b4
[openwrt/staging/dangole.git] /
1 From 39956d31d19658af7a0759e05366d4bc1c04a50a Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 15 May 2020 13:47:13 +0100
4 Subject: [PATCH] staging:vc04_services: bcm2835-codec: Avoid
5 fragmenting buffers
6
7 The firmware by default is quite happy to fragment encoded
8 frames as the original MMAL and IL APIs support this.
9 V4L2 doesn't, so we need to enable the firmware option to avoid this.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 8 ++++++++
14 1 file changed, 8 insertions(+)
15
16 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
17 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
18 @@ -1972,6 +1972,14 @@ static int bcm2835_codec_create_componen
19 &ctx->component->control,
20 MMAL_PARAMETER_VIDEO_ENCODE_HEADERS_WITH_FRAME,
21 &param, sizeof(param));
22 + /*
23 + * Avoid fragmenting the buffers over multiple frames (unless
24 + * the frame is bigger than the whole buffer)
25 + */
26 + vchiq_mmal_port_parameter_set(ctx->dev->instance,
27 + &ctx->component->control,
28 + MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
29 + &param, sizeof(param));
30 } else {
31 if (ctx->q_data[V4L2_M2M_DST].sizeimage <
32 ctx->component->output[0].minimum_buffer.size)