Hi Bruno,
On Wednesday 25 June 2008, Bruno Viaris wrote:
> Hi,
>
> I try to get raw bayer mode working with a Quickcam Pro for Notebooks
> (046d:0991).
I knew this would hit me sooner or later :-)
> I activate this function with the following command:
>
> uvcdynctrl -d /dev/video1 -s "Disable video processing" 1
>
> then I can get the raw frames (frame???.raw) on disk with
> luvcview -d /dev/video1 -f yuv -s 1600x1200 -C
>
> That worked fine until uvcvideo driver svn revision 207, where a test
> was introduced to drop frames if their length is different from the
> expected size:
> > --- linux-uvc-206/uvc_v4l2.c 2008-06-22 22:00:57.000000000 +0200
> >
> > + video->queue.drop_incomplete =
> > + video->streaming->cur_format->flags &
> > + UVC_FMT_FLAG_COMPRESSED ? 0 : 1;
> > +
> >
> >
> > --- linux-uvc-206/uvc_queue.c 2008-06-22 22:00:57.000000000 +0200
> > + if (queue->drop_incomplete && buf->buf.length !=
> > buf->buf.bytesused) {
> > + buf->state = UVC_BUF_STATE_QUEUED;
> > + buf->buf.bytesused = 0;
> > + return buf;
> > + }
>
> => if the video format is not "COMPRESSED", and a frame has not the
> expected length, drop it!
This patch has been included because many userspace applications can't handle
short frames properly (some of them even crash). The real fix probably
belongs in userspace.
> The problem is that my webcam is switched to raw mode without the driver
> being aware of it, and that the 8bpp bayer frames are half the size of
> YUV frames, so they all get dropped.
> A partial solution is to ask the driver for MJPG frames -> deactivates
> drop_incomplete, but the maximum resolution is then limited to 960x720,
> and I'd like to get the full frame.
>
> I am rather new to webcam and kernel-module programming, so I am not
> sure of what is the correct approach to this problem:
> - should this "drop_incomplete" function be deactivable through an ioctl ?
It would be possible to add a private control, accessible through
VIDIOC_S_CTRL, to disable frame drop. I would prefer frame drop to be
disabled by default, but our goal is to work around userspace bugs without
touching the applications, so that wouldn't be really useful.
> - should logitech bayer mode be treated like "YUV2" or "MJPG" and be
> activated by the VIDIOC_S_FMT ioctl with "BYR8"?
That would be the best solution, but also the most difficult to implement.
Logitech didn't implement Bayer mode as an extra format, but added a private
control. The driver initialises all its internal data from the USB
descriptors, the code would need a few hacks in various places to emulate the
proper behaviour.
> - should the driver recognize the "Disable video processing" dynamic
> control and deactivate drop_incomplete ?
That's the option I like the less. Extension units and their controls should
really be transparent to the driver.
> - something else ?
A quirk to disable (or enable if it's disabled by default) frame drop is an
easy solution. It couldn't be set per device though.
> Any advice is welcome...
>
> Bruno
>
> PS:
> For anyone interested, as a workaround I have added a quirk to disable
> this "drop_incomplete" feature,
> activate with "modprobe uvcvideo quirks=0x80000000"
> ------------------------------------
> diff -u linux-uvc-217/uvc_v4l2.c linux-uvc-217b/uvc_v4l2.c
> --- linux-uvc-217/uvc_v4l2.c 2008-06-24 23:01:57.000000000 +0200
> +++ linux-uvc-217b/uvc_v4l2.c 2008-06-23 00:31:24.000000000 +0200
> @@ -846,6 +846,7 @@
> if (ret < 0)
> return ret;
>
> + if (!(video->dev->quirks &
> UVC_QUIRK_DISABLE_DROP_INCOMPLETE))
> if (!(video->streaming->cur_format->flags &
> UVC_FMT_FLAG_COMPRESSED))
> video->queue.flags |= UVC_QUEUE_DROP_INCOMPLETE;
> diff -u linux-uvc-217/uvcvideo.h linux-uvc-217b/uvcvideo.h
> --- linux-uvc-217/uvcvideo.h 2008-06-24 23:01:57.000000000 +0200
> +++ linux-uvc-217b/uvcvideo.h 2008-06-24 01:10:56.000000000 +0200
> @@ -309,6 +309,7 @@
> #define UVC_CTRL_STREAMING_TIMEOUT 1000
>
> /* Devices quirks */
> +#define UVC_QUIRK_DISABLE_DROP_INCOMPLETE 0x80000000
> #define UVC_QUIRK_STATUS_INTERVAL 0x00000001
> #define UVC_QUIRK_PROBE_MINMAX 0x00000002
> #define UVC_QUIRK_PROBE_EXTRAFIELDS 0x00000004
> --------------------------------------------------------------
Should the driver drop incomplete frames by default ?
Best regards,
Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel