On 06/01/2009 09:58 AM, Trent Piepho wrote:
On Mon, 1 Jun 2009, Stefan Kost wrote:
I have implemented support for V4L2_MEMORY_USERPTR buffers in gstreamers
v4l2src [1]. This allows to request shared memory buffers from xvideo,
capture into those and therefore save a memcpy. This works great with
the v4l2 driver on our embedded device.
When I was testing this on my desktop, I noticed that almost no driver
seems to support it.
I tested zc0301 and uvcvideo, but also grepped the kernel driver
sources. It seems that gspca might support it, but I ave not confirmed
it. Is there a technical reason for it, or is it simply not implemented?
userptr support is relatively new and so it has less support, especially
with driver that pre-date it. Maybe USB cams use a compressed format and
so userptr with xvideo would not work anyway since xv won't support the
camera's native format. It certainly could be done for bt8xx, cx88,
saa7134, etc.
Even in the webcam with custom compressed format case, userptr support could
be useful to safe a memcpy, as libv4l currently fakes mmap buffers, so what
happens is:
cam >direct transfer> mmap buffer >libv4l format conversion> fake mmap buffer
>application-memcpy> dest buffer
So if libv4l would support userptr's (which it currently does not do) we
could still safe a memcpy here.
I would be willing to take *clean, non invasive* patches to libv4l to add
userptr support, but I'm not sure if this can be done in a clean way (haven't
tried).
An alternative could be for the app to just use read() in the above case
as then the app already provides the dest buffer. And the conversion will write
directly to the application provided buffer.
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html