Files
openwrt-master/target/linux/bcm27xx/patches-6.6/950-1265-vc04_services-codec-Allocate-the-max-number-of-buffe.patch
domenico c06fb25d1f
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Initial commit
2025-06-24 14:35:53 +02:00

36 lines
1.4 KiB
Diff

From 8c9ca647449ba9df7e3b300c480242f9b5bdd867 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 10 Sep 2024 16:58:56 +0100
Subject: [PATCH 1265/1350] vc04_services: codec: Allocate the max number of
buffers on the VPU
The VPU's API can't match the use of VIDIOC_CREATE_BUFS to add buffers
to the internal pool whilst a port is enabled, therefore allocate
the maximum number of buffers possible in V4L2 to avoid the issue.
As these are only buffer headers, the overhead is relatively small.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
.../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
@@ -2871,8 +2871,14 @@ static int bcm2835_codec_queue_setup(str
if (*nbuffers < port->minimum_buffer.num)
*nbuffers = port->minimum_buffer.num;
- /* Add one buffer to take an EOS */
- port->current_buffer.num = *nbuffers + 1;
+
+ /*
+ * The VPU uses this number to allocate a pool of headers at port_enable.
+ * We can't increase it later, so use of CREATE_BUFS is going to result
+ * in bad things happening. Adopt worst-case allocation, and add one
+ * buffer to take an EOS
+ */
+ port->current_buffer.num = VB2_MAX_FRAME + 1;
return 0;
}