Linux USB
 help / color / mirror / Atom feed
From: Daehwan Jung <dh10.jung@samsung.com>
To: Keisuke Tsukuda <tkdkei@outlook.jp>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"selvarasu.g@samsung.com" <selvarasu.g@samsung.com>,
	Avichal Rakesh <arakesh@google.com>,
	"jchowdhary@google.com" <jchowdhary@google.com>
Subject: Re: [PATCH] usb: gadget: uvc: reserve frame interval headroom for the zero length backlog
Date: Thu, 3 Dec 2026 16:57:27 +0900	[thread overview]
Message-ID: <axEg56f0ivgfHsxY@ubuntu> (raw)
In-Reply-To: <20261203004939.88424-1-tkdkei@outlook.jp>

[-- Attachment #1: Type: text/plain, Size: 2327 bytes --]

On Thu, Dec 03, 2026 at 12:50:16AM +0000, Keisuke Tsukuda wrote:
> 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?

Hi Keisuke,

Thanks a lot for testing this.

No, 80 fps is not expected, and userspace should not have to pace the
frames. The patch takes the headroom from every frame interval, even
when no zero length request is queued. So when userspace keeps enough
buffers queued, it breaks the pacing added by commit 48dbe731171e and
the gadget sends frames faster than the interval the host selected.

Your one-buffer test shows the same 33 zero length requests I measured.
They only appear when no buffer is queued as the previous frame
completes. As Avi pointed out, that is a buffer depth problem in
DeviceAsWebcam, not in the gadget driver.

Best Regards,
Daehwan Jung

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



      reply	other threads:[~2026-12-03  8:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261012034422epcas2p486b38818b542d2fff5b5fed58863ec6e@epcas2p4.samsung.com>
2026-10-12  3:40 ` [PATCH] usb: gadget: uvc: reserve frame interval headroom for the zero length backlog Daehwan Jung
2026-10-12  3:56   ` sashiko-bot
2026-10-13 21:15   ` Avichal Rakesh
2026-10-19  7:25     ` Daehwan Jung
2026-12-03  0:50   ` Keisuke Tsukuda
2026-12-03  7:57     ` Daehwan Jung [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axEg56f0ivgfHsxY@ubuntu \
    --to=dh10.jung@samsung.com \
    --cc=arakesh@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jchowdhary@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=selvarasu.g@samsung.com \
    --cc=tkdkei@outlook.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox