V4L2

Hi people,

I am working with SAA7146 video grabber driver (with kernel 2.6.12), which claim to be V4L2 and came across several strange things.

First off, there is a bug in the driver - when I call VIDIOC_REQBUFS with count 0 it returns EINVAL error, while "Applications can call VIDIOC_REQBUFS again to change the number of buffers, however this cannot succeed when any buffers are still mapped. A count value of zero frees all buffers, after aborting or finishing any DMA in progress, an implicit VIDIOC_STREAMOFF." (Video for Linux Two API Specification Draft 0.11,

formatting link
The code that disregards count == 0 and calls with streaming in progress resides in generic code at drivers/media/video/video-buf.c, so I suppose that all drivers that use this helper code include misbehave in the sam way.

Second, while introducing the dangerous mmap() API (the V4L2 driver allocates buffers in kernel space upon application's request), there's no provision in V4L2 for drivers clean-up if the calling application dies unexpectedly. Actually the above mishap is the only way for calling applications to free buffers, except for closing the device.

Where can I submit this report? Also, what is the status of the "Video for Linux Two API Specification" - is it obligatory for V4L2 submitted drivers maintainers?

TIA, D

Reply to
Stargazer
Loading thread data ...

Does the problem still exist in 2.6.15?

formatting link

--
Kasper Dupont -- Rigtige mænd skriver deres egne backupprogrammer
#define _(_)"d.%.4s%."_"2s" /* This is my new email address */
char*_="@2kaspner"_()"%03"_("4s%.")"t\n";printf(_+11,_+6,_,6,_+2,_+7,_+6);
Reply to
Kasper Dupont

You can look in the source files.

If you find in 'drivers/media/video/video-buf.c' in function videobuf_reqbufs() the following lines:

if (req->count < 1) return -EINVAL;

and in file 'divers/media/common/saa7146_video.c function saa7146_video_do_ioctl() under 'case VIDIOC_REQBUFS:' no special treatment for count == 0 then yes, the problem exists.

Thanks! D

Reply to
Stargazer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.