Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb uvideo(4): clamp (micro)frames-per-xfer to at mo...
details: https://anonhg.NetBSD.org/src/rev/bc6ea11e1fbd
branches: trunk
changeset: 933317:bc6ea11e1fbd
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Sun May 24 17:28:20 2020 +0000
description:
uvideo(4): clamp (micro)frames-per-xfer to at most 80
Previously, on a 30fps YUV422 640x480 webcam, we were putting over 250
USB (micro)frames per video frame in the host controller queue.
xhci(4) is currently limited to 256-1 TRBs per xHC Transfer Ring, and as
such, trying to place 3 xfers each of 250+ microframes in the queue fails.
As there is no UVC requirement that whole video frames be in one logical
chunk of isoc transactions, and there doesn't seem to be compelling reason
to keep the xfer completion rate slower than 1 in 10ms, we can limit each
of the 3 uvideo xfers to 80 (micro)frames of bus time, and solve the
Transfer Ring constraint for upcoming xhci(4) Isochronous pipe support.
This works out to using only 240 TRBs on the 255-usable-TRB Transfer Ring.
diffstat:
sys/dev/usb/uvideo.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 9e5a86b34476 -r bc6ea11e1fbd sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c Sun May 24 17:26:18 2020 +0000
+++ b/sys/dev/usb/uvideo.c Sun May 24 17:28:20 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvideo.c,v 1.57 2020/05/22 11:25:06 jmcneill Exp $ */
+/* $NetBSD: uvideo.c,v 1.58 2020/05/24 17:28:20 jakllsch Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.57 2020/05/22 11:25:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.58 2020/05/24 17:28:20 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -81,6 +81,7 @@
#include <dev/usb/uvideoreg.h>
#define UVIDEO_NXFERS 3
+#define UVIDEO_NFRAMES_MAX 80
#define PRI_UVIDEO PRI_BIO
/* #define UVIDEO_DISABLE_MJPEG */
@@ -1561,6 +1562,7 @@
uframe_len = alt->max_packet_size;
nframes = (vframe_len + uframe_len - 1) / uframe_len;
nframes = (nframes + 7) & ~7; /*round up for ehci inefficiency*/
+ nframes = uimin(UVIDEO_NFRAMES_MAX, nframes);
DPRINTF(("uvideo_stream_start_xfer: nframes=%d\n", nframes));
ix->ix_nframes = nframes;
Home |
Main Index |
Thread Index |
Old Index