--- On Thu, 7/22/10, Laurent Pinchart <laurent.pinch...@ideasonboard.com> wrote:
> 
> Could you try to modify the userspace application to mmap
> buffers only right 
> before reading from them (after VIDIOC_DQBUF) and unmap
> them when you're done 
> (before requeuing the buffer with VIDIOC_QBUF) ?
> 
Great idea!  I tried this, and it resolved all corruption.  It incurs a 
slight drop in frame rate, but I think this is an acceptable trade-off.

Also, without this workaround in place, I was able to extract two copies
of a JPEG via two methods:
1. Through my application
2. Through an in-line hardware USB analyzer

The copy obtained through the application is corrupt, while the "sniffed"
copy is not.  A binary diff between them shows that two 32-byte chunks have
been replaced with random data.  Sorry to keep harping on this, but 32
bytes is the size of a cache line on my platform.

I thought that perhaps the uvc_video_queue's mem buffer was susceptible to
cache aliasing because it has 2 mappings:
1. from vmalloc_32
2. from mmap

I added a call to flush_dcache_page() (looping over the appropriate pages)
after memcpy-ing from the urb's transfer_buffer to the uvc_video_queue's
mem, but this had no effect on the corruption.

I've attached the two JPEGs mentioned above.


      

<<attachment: corrupt.jpg>>

<<attachment: correct.jpg>>

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

Reply via email to