From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=203.254.224.34 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796284936; b=gmabvsBhQ7ZqL+apTqIzIEqZIXDPXJWQxDxVEORJd2x6hG5+Yl91CpqhkDeDp8AoUJOc qwvJNi92Lt9E8GiYE2fKdaWo1leSVQJTiZ8uox9I2fNXlK6iB/ySBKVgIHOb1lgdv0LzE qIFTDLnBbdG6O69MM/kjChFuJ+XufaYubI7ELLr2PrUVrY2JY9s2Rbfafe2M+cpC2xGXT jNcJX0HV4VFD3sGnwE/VLwLKnRna0B98kPje1HK3FbCVxztTmxnvFAAMAalA9TI97dAqw LpVIhK9Ul7QoQruI4WtlJRH14Zxp1pu8Lhmf0ECs47r+uNM/SzNwr1pHFMb6e+CnFUQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796284936; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version: In-Reply-To:X-CMS-MailID:X-Msg-Generator:Content-Type: X-Sendblock-Type:CMS-TYPE:cpgsPolicy:X-CFilter-Loop:X-CMS-RootMailID: References; bh=eTnDYz3HRQUO3nO+R6CzjR8FXanuWIMW8QerA56/Q+c=; b=JHZO4A6v7K1uXSqeHZ5j+cwQHZqnzBjZGPRpUzjuVrtvd+SJhGCcn28/exDerWIc+LUK Oe/hZRUxFI3poo/aYDYoWTlpcWcDS/Uz62dWdURQ1EJwaxOjSZpdR3cKGSg95almgmGx6 s1955UewPWyumi606tWkMaPzY4yng4TJcUUr+9uHdwKFOAk9DENI8ewyay5jRArm2Uigr mlGGPn5iwIIuhDqioz1cGOBjZcFO0yRXh9aj0lFW1/0GSDxdynvUyhyzS7nUQn0kQJhDa 4exWBrFk3R7rsGUQxJ428XfEzq6/27reAe0620gR/vZRQPLE3in6ulCpqTpiDUaG3+g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=QwHMybtJ; arc=none smtp.remote-ip=203.254.224.34 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFB7F606A32C for ; Thu, 3 Dec 2026 08:02:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DFB7F606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=QwHMybtJ Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20261203080212epoutp0426f56fb3895de6ea4888c660959ed1ae~tr6EFgl_u2218622186epoutp04n for ; Thu, 3 Dec 2026 08:02:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20261203080212epoutp0426f56fb3895de6ea4888c660959ed1ae~tr6EFgl_u2218622186epoutp04n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1796284932; bh=eTnDYz3HRQUO3nO+R6CzjR8FXanuWIMW8QerA56/Q+c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QwHMybtJlOAgWykAfeI20KjA+KFGccGA2KbPKDpYuR/hKyW7hmTb8Mfu1gRZrS0RP tPTB9uZK+F/djawcxGOUUcVC+nJxre47bRZv8wTgw8AP8vIfusrJIkFjwWo1BaQipd 1lVaBfy/kLPPeG32zaNka4L1FPMALSjdCufpbNTE= Received: from epsnrtp02.localdomain (unknown [182.195.42.154]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPS id 20261203080212epcas2p354784b9bcb0aff92fe08f673fea61e03~tr6DrGEBH1324613246epcas2p3T; Thu, 3 Dec 2026 08:02:12 +0000 (GMT) Received: from epcas2p2.samsung.com (unknown [182.195.38.202]) by epsnrtp02.localdomain (Postfix) with ESMTP id 4jg6Xz4y8wz2SSKX; Thu, 3 Dec 2026 08:02:11 +0000 (GMT) Received: from epsmtip2.samsung.com (unknown [182.195.34.31]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20261203080211epcas2p2734a6de26bc5422bc21cdc33fadd543d~tr6C4afh_2802228022epcas2p28; Thu, 3 Dec 2026 08:02:11 +0000 (GMT) Received: from ubuntu (unknown [12.81.221.204]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20261203080211epsmtip2bfbd79c609f2a67fc5562c282076d008~tr6C1oRxu0264802648epsmtip29; Thu, 3 Dec 2026 08:02:11 +0000 (GMT) Date: Thu, 3 Dec 2026 16:57:27 +0900 From: Daehwan Jung To: Keisuke Tsukuda Cc: Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "selvarasu.g@samsung.com" , Avichal Rakesh , "jchowdhary@google.com" Subject: Re: [PATCH] usb: gadget: uvc: reserve frame interval headroom for the zero length backlog Message-ID: X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 In-Reply-To: <20261203004939.88424-1-tkdkei@outlook.jp> X-CMS-MailID: 20261203080211epcas2p2734a6de26bc5422bc21cdc33fadd543d X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----WD35WCKqSkBc_8lC0VaEyObkd.9EPfsJTyOO9xd1SPdQXBpX=_6fa7e_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P cpgsPolicy: CPGSC10-234,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20261203005022epcas2p1ce02d3232937fbb074963814f6c0dbc8 References: <20261012034018.3193146-1-dh10.jung@samsung.com> <20261203004939.88424-1-tkdkei@outlook.jp> ------WD35WCKqSkBc_8lC0VaEyObkd.9EPfsJTyOO9xd1SPdQXBpX=_6fa7e_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline 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 ------WD35WCKqSkBc_8lC0VaEyObkd.9EPfsJTyOO9xd1SPdQXBpX=_6fa7e_ Content-Type: text/plain; charset="utf-8" ------WD35WCKqSkBc_8lC0VaEyObkd.9EPfsJTyOO9xd1SPdQXBpX=_6fa7e_--