Skip to content

Commit 8c9ca64

Browse files
6by9pelwell
authored andcommitted
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 <[email protected]>
1 parent 4d2eaa1 commit 8c9ca64

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,8 +2871,14 @@ static int bcm2835_codec_queue_setup(struct vb2_queue *vq,
28712871

28722872
if (*nbuffers < port->minimum_buffer.num)
28732873
*nbuffers = port->minimum_buffer.num;
2874-
/* Add one buffer to take an EOS */
2875-
port->current_buffer.num = *nbuffers + 1;
2874+
2875+
/*
2876+
* The VPU uses this number to allocate a pool of headers at port_enable.
2877+
* We can't increase it later, so use of CREATE_BUFS is going to result
2878+
* in bad things happening. Adopt worst-case allocation, and add one
2879+
* buffer to take an EOS
2880+
*/
2881+
port->current_buffer.num = VB2_MAX_FRAME + 1;
28762882

28772883
return 0;
28782884
}

0 commit comments

Comments
 (0)