diff options
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0799-bcm2835-codec-Return-empty-buffers-to-the-VPU-instea.patch')
-rw-r--r-- | target/linux/bcm27xx/patches-5.15/950-0799-bcm2835-codec-Return-empty-buffers-to-the-VPU-instea.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0799-bcm2835-codec-Return-empty-buffers-to-the-VPU-instea.patch b/target/linux/bcm27xx/patches-5.15/950-0799-bcm2835-codec-Return-empty-buffers-to-the-VPU-instea.patch new file mode 100644 index 0000000000..ac1658f866 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.15/950-0799-bcm2835-codec-Return-empty-buffers-to-the-VPU-instea.patch @@ -0,0 +1,49 @@ +From 4fb4bf2f8e88973a4b575b537c774dd563160c5f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <dave.stevenson@raspberrypi.com> +Date: Mon, 28 Mar 2022 11:52:48 +0100 +Subject: [PATCH] bcm2835-codec: Return empty buffers to the VPU + instead of queueing to vbuf2 + +The encoder can skip frames totally should rate control overshoot +the target bitrate too far. In this situation it generates an +output buffer of length 0. +V4L2 treats a buffer of length 0 as an end of stream flag, which is +not appropriate in this case, therefore we can not return that buffer +to the client. + +The driver was returning the buffer to videobuf2 in the QUEUED state, +however that buffer was then not dequeued again, so the number of +buffers was reduced each time this happened. In the pathological +case of using GStreamer's videotestsrc in mode 1 for noise, this happens +sufficiently frequently to totally stall the pipeline. + +If the port is still enabled then return the buffer straight back to +the VPU rather than to videobuf2. + +Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> +--- + .../bcm2835-codec/bcm2835-v4l2-codec.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c ++++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c +@@ -1159,10 +1159,15 @@ static void op_buffer_cb(struct vchiq_mm + v4l2_dbg(2, debug, &ctx->dev->v4l2_dev, "%s: Empty buffer - flags %04x", + __func__, mmal_buf->mmal_flags); + if (!(mmal_buf->mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS)) { +- vb2_buffer_done(&vb2->vb2_buf, VB2_BUF_STATE_QUEUED); +- if (!port->enabled && +- atomic_read(&port->buffers_with_vpu)) +- complete(&ctx->frame_cmplt); ++ if (!port->enabled) { ++ vb2_buffer_done(&vb2->vb2_buf, VB2_BUF_STATE_QUEUED); ++ if (atomic_read(&port->buffers_with_vpu)) ++ complete(&ctx->frame_cmplt); ++ } else { ++ vchiq_mmal_submit_buffer(ctx->dev->instance, ++ &ctx->component->output[0], ++ mmal_buf); ++ } + return; + } + } |