Re: [PATCH] usb: gadget: uvc: reserve frame interval headroom for the zero length backlog

From: Keisuke Tsukuda

Date: Wed Dec 02 2026 - 19:50:32 EST


On Mon, Oct 12, 2026, Daehwan Jung wrote:
> The frame period is therefore reqs_per_frame plus that backlog, always
> longer than the frame interval the host asked for.

I tested this on a Tinker Board 3N (RK3568/DWC3) at SuperSpeed, using
usb-testing 9357829ac604 and a Mac host. The gadget offered 160x120
YUYV at 60 fps (166666 x 100 ns), with bInterval 1, wMaxPacketSize
1024 and bMaxBurst 2. I used the same test-pattern source with and
without the patch.

I queued four buffers before STREAMON and requeued each after DQBUF.
The host received 60.6 fps without the patch and 80.0 fps with it.
The five-second gadget traces contained no zero-length requests, and
the gadget completed 303 versus 400 frames.
Between completed frames, there were 132 versus 100 payload requests.
Those counts are slightly below the 134 versus 101 budgeted by
reqs_per_frame because the driver emits 8-byte headers for this test
source where the sizing calculation allows for 12.

I then allocated two buffers but kept only one queued, putting it back
after DQBUF.
The trace showed 33 empty request completions between successive
completed frames. The host rate went from 48.5 to 60.2 fps with the
patch.

This test source fills buffers as soon as they are returned; a camera
that captures at a fixed rate might behave differently. The patch
still reduces the requests per frame from 132 to 100 when no empty
requests are queued. The four-buffer stream ran at 80 fps with a
selected 60 fps interval. Is that expected? Should userspace pace the
frames?