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. > > One solution I was looking at would be to have the UVC driver use > dma_alloc_noncoherent() instead of usb_alloc_coherent(). The problem > then is that the UVC driver would have to invalidate the buffers > before submission and this seems very platform specific. Any > suggestions would be greatly appreciated. IMO, uvc driver uses coherent buffer for avoiding dma mapping during submit urb and dma unmapping during complete urb, both which are basically executed in IRQ context for uvc case and very frequent operations. If you want to try non coherent buffer, just use kmalloc to replace usb_alloc_coherent and remove the flag of URB_NO_TRANSFER_DMA_MAP, and usbcore will do the dma mapping automatically. thanks, -- Ming Le -- 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