openwrt/target/linux/bcm27xx/patches-6.6/950-1265-vc04_services-codec-Allocate-the-max-number-of-buffe.patch
Álvaro Fernández Rojas 538a1d740c bcm27xx: update to latest RPi patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.58..rpi-6.6.y

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-10-31 13:44:23 +01: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;
}