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