On Sat, 30 Jul 2011, Ming Lei wrote: > Hi, > > On Sat, Jul 30, 2011 at 7:15 AM, Alan Cooper <alcooperx@xxxxxxxxx> wrote: > > I'm seeing an interesting performance problem when using a USB HD > > Logitech video cam via UVC and I was hoping for some advice on the > > best way to resolve it. When I try to capture video data from the cam > > with a simple test app, I can't keep up with a 720x1440 data stream a > > 10 FPS. I traced the problem down to the fact that the UCV driver ends > > up allocating the USB transfer buffers via usb_alloc_coherent() which, > > on our MIPS system, returns buffers in uncached memory. UVC ends up > > doing a memcpy of the uncached data to the cached UVC buffers and this > > is where the performance is terrible. I did a quick benchmark and > > found that memcpy from uncached memory ran at about 3.5MB/s, instead > > of ~600MB for cached. > > Sounds like it is a arch dependent problem, and not much related with usb. Yes indeed. Coherent buffers are allocated in uncached memory on some architectures, which makes them very expensive to access. But other architectures can use cached memory, which makes coherent buffers less expensive than non-coherent ones since no DMA mapping is required. This makes for a difficult tradeoff. Historically, I think the balance in USB has been tipped in favor of x86. For something as time-critical as uvcvideo, it might make sense for the driver to implement both options in arch-dependent code. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html