On Tue, Aug 09, 2011 at 08:48:42AM +0200, Laurent Pinchart wrote: > Hi Sarah, > > On Tuesday 09 August 2011 02:30:33 Sarah Sharp wrote: > > On Tue, Aug 09, 2011 at 12:29:33AM +0200, Laurent Pinchart wrote: > > > On Tuesday 09 August 2011 00:18:02 Sarah Sharp wrote: > > So is the header something the UVC video driver allocates, or something > > userspace allocates? Is the header, jpeg header, and data all confined > > to one frame (one usb_iso_packet_descriptor in the URB)? > > > > Scatter gather list entries can be variable length, so I don't really > > see where the problem is, as long as the uvcvideo driver knows how long > > the header for that particular frame is supposed to be. You'd just have > > one scatterlist per frame, with either two or three entries (I don't > > know if userspace passes the jpeg header and data as one buffer) that > > you would re-setup every time an URB completes. > > > > Of course, I don't know if the trade off in size of having a scatterlist > > per frame vs. the performance gain of avoiding the memcopy would be a > > good choice. But I do think it's feasible. > > In a nutshell, uvcvideo devices that use isochronous transfers slice the data > in packets and prepend each packet with a header. The resulting packet is then > sent over the bus. > > The header starts with an 8-bit field that indicates its length. The length is > variable (typically 2 or 12 bytes, but can take other values as well) and the > host has no way to know in advance how long the header will be for a > particular packet. Oh, you mean you don't even know when you send the URB what the header size is going to be? Yikes. So you just end up allocating a buffer that would fit the largest size header and data and then copying the data over to the userspace buffer? In that case, yes, I can't see how a scatter gather list would help. I'll poke the USB-AV and USB-IF video folks and see whether they've got any variable length headers in the new specs. Sarah Sharp -- 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