git: 3b6f833c95eb - main - uvideo: increase isochronous transfer depth for throughput

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Tue, 16 Jun 2026 11:23:06 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=3b6f833c95eb65b29a9f506928467236a11d5169

commit 3b6f833c95eb65b29a9f506928467236a11d5169
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-05-18 21:44:27 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-06-16 11:21:05 +0000

    uvideo: increase isochronous transfer depth for throughput
    
    Increase NFRAMES_MAX from 40 to 128 and IXFERS from 3 to 5 to keep
    more packets in flight on the USB bus.  This brings throughput from
    ~13.5 MB/s to ~21 MB/s (for comparison on the same camera webcamd
    provided ~20MB/s.
    
    The linux driver also uses 5 IXFERS (but only 32 NFRAMES_MAX)
    
    Tested by:      manu
---
 sys/dev/usb/video/uvideo.c | 20 ++++++++++++++++++++
 sys/dev/usb/video/uvideo.h |  4 ++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/sys/dev/usb/video/uvideo.c b/sys/dev/usb/video/uvideo.c
index b35561ff6a24..9229aa34fc47 100644
--- a/sys/dev/usb/video/uvideo.c
+++ b/sys/dev/usb/video/uvideo.c
@@ -196,6 +196,8 @@ enum {
 	UVIDEO_ISOC_RX_0,
 	UVIDEO_ISOC_RX_1,
 	UVIDEO_ISOC_RX_2,
+	UVIDEO_ISOC_RX_3,
+	UVIDEO_ISOC_RX_4,
 	UVIDEO_BULK_RX,
 	UVIDEO_N_XFER
 };
@@ -616,6 +618,24 @@ static const struct usb_config uvideo_isoc_config[UVIDEO_IXFERS] = {
 		.flags = {.short_xfer_ok = 1, .short_frames_ok = 1,},
 		.callback = &uvideo_isoc_callback,
 	},
+	[3] = {
+		.type = UE_ISOCHRONOUS,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_IN,
+		.bufsize = 0,
+		.frames = UVIDEO_NFRAMES_MAX,
+		.flags = {.short_xfer_ok = 1, .short_frames_ok = 1,},
+		.callback = &uvideo_isoc_callback,
+	},
+	[4] = {
+		.type = UE_ISOCHRONOUS,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_IN,
+		.bufsize = 0,
+		.frames = UVIDEO_NFRAMES_MAX,
+		.flags = {.short_xfer_ok = 1, .short_frames_ok = 1,},
+		.callback = &uvideo_isoc_callback,
+	},
 };
 
 static const struct usb_config uvideo_bulk_config[1] = {
diff --git a/sys/dev/usb/video/uvideo.h b/sys/dev/usb/video/uvideo.h
index fc811c5d65fa..9f8570aaf7ed 100644
--- a/sys/dev/usb/video/uvideo.h
+++ b/sys/dev/usb/video/uvideo.h
@@ -640,9 +640,9 @@ struct usb_video_format_desc {
 /*
  * Driver specific private definitions.
  */
-#define UVIDEO_NFRAMES_MAX	40
+#define UVIDEO_NFRAMES_MAX	128
 
-#define UVIDEO_IXFERS		3
+#define UVIDEO_IXFERS		5
 struct uvideo_vs_iface {
 	uint8_t			 iface_index;
 	int			 numalts;