Skip to content

Commit

Permalink
vc04_services: codec: Allocate the max number of buffers on the VPU
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
6by9 authored and pelwell committed Sep 13, 2024
1 parent 4d2eaa1 commit 8c9ca64
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2871,8 +2871,14 @@ static int bcm2835_codec_queue_setup(struct vb2_queue *vq,

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;
}
Expand Down

0 comments on commit 8c9ca64

Please sign in to comment.