staging:vc04_services: bcm2835-codec: Avoid fragmenting buffers
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Fri, 15 May 2020 12:47:13 +0000 (13:47 +0100)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:34:04 +0000 (16:34 +0100)
The firmware by default is quite happy to fragment encoded
frames as the original MMAL and IL APIs support this.
V4L2 doesn't, so we need to enable the firmware option to avoid this.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c

index 3c819e2..1c7fbba 100644 (file)
@@ -1972,6 +1972,14 @@ static int bcm2835_codec_create_component(struct bcm2835_codec_ctx *ctx)
                                              &ctx->component->control,
                                              MMAL_PARAMETER_VIDEO_ENCODE_HEADERS_WITH_FRAME,
                                              &param, sizeof(param));
+               /*
+                * Avoid fragmenting the buffers over multiple frames (unless
+                * the frame is bigger than the whole buffer)
+                */
+               vchiq_mmal_port_parameter_set(ctx->dev->instance,
+                                             &ctx->component->control,
+                                             MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
+                                             &param, sizeof(param));
        } else {
                if (ctx->q_data[V4L2_M2M_DST].sizeimage <
                        ctx->component->output[0].minimum_buffer.size)