Skip to contentSkip to conversation

uvcvideo USERPTR mode busted?

DISCUSSION Rémi Denis-Courmont 3 participants 4 messages Mar 3, 2013 – Mar 21, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello,

Trying to use USERPTR buffers with UVC, user space gets stuck either in poll(POLLIN) or in ioctl(VIDIOC_DQBUF). It seems the UVC driver never ever returns a frame in USERPTR mode. The symptoms are identical with kernel versions 3.6, 3.7 and 3.8. I also tested 3.2, but it did not support USERPTR.

Tested hardware was Logitech HD Pro Webcam C920 with YUY2 pixel format. The same hardware and the same driver work fine with MMAP buffers. The same USERPTR userspace code works fine with the vivi test device...

Did any have any better luck?

Signature · 2 lines
Rémi Denis-Courmont
http://www.remlab.net/
#1 lore raw
Quoted 7 lines · Rémi Denis-Courmont

Hello,

Trying to use USERPTR buffers with UVC, user space gets stuck either in poll(POLLIN) or in ioctl(VIDIOC_DQBUF). It seems the UVC driver never ever returns a frame in USERPTR mode. The symptoms are identical with kernel versions 3.6, 3.7 and 3.8. I also tested 3.2, but it did not support USERPTR.

Quoted 5 lines

Tested hardware was Logitech HD Pro Webcam C920 with YUY2 pixel format. The same hardware and the same driver work fine with MMAP buffers. The same USERPTR userspace code works fine with the vivi test device...

Did any have any better luck?

Hi Remi,

I've used userptr mode with the C920 on an ARM platform (with YUYV mode and not MPEG). It's worth noting that there is actually a bug I hit where if the memory you pass is not aligned on a page boundary then you will get garbage video. I have a fix or this but haven't submitted it upstream yet.

So it should work, aside from the bug I found.

Have you tried testing with v42l-ctl's streaming command? That would help identify whether it's something special about your code or whether it's the driver. Don't get me wrong, it's almost certainly a driver issue in either case, but it would help narrow down the issue if you're using v4l2-ctl as that app is really simple and readily available to the driver developers.

Devin

Signature · 2 lines
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
#2 lore raw
Quoted 9 lines · On Sunday 03 March 2013 09:57:14 Devin Heitmueller wrote:
Quoted 8 lines · Rémi Denis-Courmont

Hello,

Trying to use USERPTR buffers with UVC, user space gets stuck either in poll(POLLIN) or in ioctl(VIDIOC_DQBUF). It seems the UVC driver never ever returns a frame in USERPTR mode. The symptoms are identical with kernel versions 3.6, 3.7 and 3.8. I also tested 3.2, but it did not support USERPTR.

Quoted 5 lines
Quoted 5 lines

Tested hardware was Logitech HD Pro Webcam C920 with YUY2 pixel format. The same hardware and the same driver work fine with MMAP buffers. The same USERPTR userspace code works fine with the vivi test device...

Did any have any better luck?

I've just tested USERPTR with a Logitech C905 on a 3.7.10 kernel using yavta without any issue.

Quoted 6 lines

Hi Remi,

I've used userptr mode with the C920 on an ARM platform (with YUYV mode and not MPEG). It's worth noting that there is actually a bug I hit where if the memory you pass is not aligned on a page boundary then you will get garbage video. I have a fix or this but haven't submitted it upstream yet.

Please submit it at some point :-)

Is it a uvcvideo issue or a videobuf2 issue ?

Quoted 7 lines

So it should work, aside from the bug I found.

Have you tried testing with v42l-ctl's streaming command? That would help identify whether it's something special about your code or whether it's the driver. Don't get me wrong, it's almost certainly a driver issue in either case, but it would help narrow down the issue if you're using v4l2-ctl as that app is really simple and readily available to the driver developers.

Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw
Quoted 3 lines · Laurent Pinchart

Please submit it at some point :-)

Is it a uvcvideo issue or a videobuf2 issue ?

Yeah, it's definitely on my list. Basically if you hand videobuf2-vmalloc a piece of memory that is not page aligned, it gets treated as if paged aligned, which causes the first N bytes of every video frame to be garbage and the video is shifted right by N bytes. I saw the issue with both uvcvideo as well as em28xx.

Devin

Signature · 2 lines
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com