Repository navigation
Conversation
sithglan
force-pushed
the
avd-max-capture-buffers
branch
from
October 14, 2026 19:11
380624f to
c75c838
Compare
The capture queue never sets max_num_buffers, so vb2 limits every context to VB2_MAX_FRAME (32) buffers. Nothing in the driver needs that limit: reference frames are looked up by timestamp (vb2_find_buffer()) and handed to the hardware by DMA address, never by buffer index. 32 buffers leave too little room for userspace to decode ahead. With a 16-frame DPB, four frame threads and the frames held for display, mpv's decoder queue (--vd-queue) gets only a few frames before VIDIOC_CREATE_BUFS fails with ENOBUFS, and the FFmpeg V4L2 request hwaccel then falls back to software decoding. Decoding ahead is needed because the t8103 AVD decodes 4K59.94 H.264 at only ~41 fps during a 125-156 Mbit/s burst, so playback drops frames unless the decoder has built up a lead of 60-90 frames beforehand. Add a max_capture_buffers module parameter, default 128. Buffers are still allocated on demand by userspace, so this only raises the limit. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
sithglan
force-pushed
the
avd-max-capture-buffers
branch
from
October 15, 2026 16:59
c75c838 to
153eab9
Compare
This was referenced Oct 15, 2026
Contributor
|
Closing as superseded: this work was ported by #328 (merged 2026-10-16) and carried into the maintained 7.3 integration/aurora line. Thanks for the original change; nothing here is lost. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The AVD capture queue never sets
max_num_buffers, so vb2 caps every decoding context atVB2_MAX_FRAME(32) buffers. The driver doesn't need that cap: it looks up reference frames by timestamp (vb2_find_buffer()) and gives the hardware DMA addresses, never buffer indices. This adds amax_capture_buffersmodule parameter (default 128). Buffers are still allocated on demand by userspace, so it only raises the limit.Why it matters: the t8103 AVD can't decode every 4K60 H.264 stream in real time. On a 4K59.94 High@5.2 camera clip (65 Mbit/s average), FFmpeg's V4L2 request hwaccel decodes:
GStreamer
v4l2slh264decgives the same numbers. CPU, firmware build (-O0vs-O3) and the CPU governor make no difference, so this is the hardware's throughput. During the burst, mpv drops 60–70 frames. Decoding ahead (mpv--vd-queue) can cover the burst, but it needs a lead of 60–90 frames. With 32 buffers, a 16-frame DPB, 4 frame threads and the frames held for display, queues above ~20 frames fail:VIDIOC_CREATE_BUFSreturnsENOBUFSand mpv silently falls back to software decoding.Testing: Mac mini M1 (j274), kernel
7.1.12built fromaurora-wipplus #275–#277;drivers/media/platform/apple/avd/is identical to currentaurora-wip. The patched module was built out of tree against that kernel. Userspace: Debian FFmpeg 9.0.2 with the V4L2 request hwaccels (FFmpeg PR 20847), mpv 0.41 with mpv PR 14690.--hwdec-extra-frames=104 --vd-queue-max-samples=96ENOBUFS, falls back to softwarev4l2request, ~110 capture buffersNotes:
checkpatch --strict: no errors, warnings or checks.