Bug 252712 - Webcam does not work when attached to xhci(4) but does attached to ehci(4)
Summary: Webcam does not work when attached to xhci(4) but does attached to ehci(4)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-15 14:29 UTC by Nathan Whitehorn
Modified: 2021-02-15 15:16 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Whitehorn freebsd_committer freebsd_triage 2021-01-15 14:29:36 UTC
I have a Logitech C925e webcam. When attached to the onboard xhci(4) controller (AMD 300 Series USB 3.0 controller), it does not provide any picture through webcamd, though does turn on. Data are clearly transferred, as the interrupt rate goes up dramatically when running pwcview. If I set uvc_driver.nodrop=1 in webcamd, I can see a small top portion of each frame, which gets smaller at higher resolution, suggesting that the transfers are being truncated after some number of bytes.

If I install an ehci(4)-based PCI card and plug the webcam into that instead, everything works perfectly without tweaks.
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2021-01-15 15:28:33 UTC
It is likely a bug regarding the bandwidth allocation for XHCI ISOCH endpoints.

When we setup an endpoint context we need to fill in some parameters to tell the hardware how many bytes to reserve. Likely these are wrong:

Refer to:

XHCI_EPCTX_4_MAX_ESIT_PAYLOAD_SET(max_frame_size)

in xhci.c

Maybe you can play with the parameter.

--HPS
Comment 2 Nathan Whitehorn freebsd_committer freebsd_triage 2021-01-15 15:31:49 UTC
Thanks for the pointer, I'll take a look at that.
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2021-01-15 16:18:58 UTC
You may also find the XHCI status codes useful for the failed ISOCHRONOUS transfers.

sysctl hw.usb.xhci.debug=17

--HPS
Comment 4 Nathan Whitehorn freebsd_committer freebsd_triage 2021-02-15 15:16:20 UTC
This has magically fixed itself recently, so I can't investigate the problem any further. There haven't obviously been any commits that would change the behavior,  so I'm pretty sure whatever the bug was still exists, but I can't do anything more unfortunately. I'll close it for now and if this happens again will reopen it.