On Sunday 06 May 2007, Markus Rechberger wrote:
[snip]
> On 5/6/07, Laurent Pinchart <[EMAIL PROTECTED]> wrote:
> > On Sunday 06 May 2007, Markus Rechberger wrote:
> > > On 5/6/07, Laurent Pinchart <[EMAIL PROTECTED]> wrote:
> > > > On Sunday 06 May 2007, Markus Rechberger wrote:
> > > > > On 5/6/07, Laurent Pinchart <[EMAIL PROTECTED]> wrote:
> > > > >  dwMaxVideoFrameBufferSize     2752512 (which is used for
> > > > > usb_buffer_alloc, seems to be too much already)
> > > >
> > > > The bulk buffers are allocated using dwMaxPayloadTransferSize.
> > > > Isochronous buffers are allocated using dwMaxVideoFrameSize, which is
> > > > clearly a bug. I'm working on a fix.
> > > >
> > > > The stack trace you posted shows your device uses bulk transfers.
> > > > Could you tell me how big dwMaxPayloadTransferSize is ? If the
> > > > devices insists on using
> > > > huge buffers, there's not much I can do about it.
> > >
> > > I simply wouldn't allocate that much memory for the urbs, this way
> > > seems to work reliable with the driver I have.
> > > I added some debug at the allocation it is 2.7 MB/URB
> >
> > I suspect that the dwMaxPayloadTransferSize value is thus equal to
> > 2752512 as
> > well.
> >
> > For bulk transfers, you are right, I could allocate smaller URBs. As bulk
> > transfers are guaranteed, I can split payloads across multiple URBs. For
> > isochronous transfers that won't be possible.
>
> it is also possible for isochronous transfers, if the framebuffer
> doesn't get fully filled just drop the frame. By experience this works very
> well with em28xx based devices. 

After having a closer look at the spec, isochronous transfers won't be an 
issue. Each isochronous packet starts with a UVC header. I already submit 
isochronous URBs of no more than 40 packets.

For bulk transfers, the situation seems a little more complex than I thought. 
Bulk payloads can be made of lots of packets, up to a whole frame per 
payload. The maximum payload size is reported by the device. As the device 
sends a header for each payload and not for each URB, I have to find a way 
detect payload boundaries (keep in mind that payloads can have a variable 
size).

When using payload-sized URBs, each URB will contain a single payload. This is 
what the Linux UVC driver currently does, and it works fine as long as the 
device doesn't have a payload size bigger than what the host can allocate.

When splitting payloads across multiple URBs, I need another way to detect 
payload boundaries. As the payload size isn't known in advance (only the 
maximum size is known), I can't rely on a byte count. A possible solution 
would have been to detect URBs with an actual length smaller than the 
transfer buffer length, as such URBs should indicate the end of a payload. 
Unfortunately, this won't work as the payload size can be an exact multiple 
of the URB size.

Can you think of a way to detect payload boundaries properly when splitting 
payloads across multiple URBs ?

[snip]

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
Linux-uvc-devel@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to