Q on DMABUF: how to get fd info from downstream plugin

Nicolas Dufresne nicolas.dufresne at collabora.com
Sat Apr 26 10:22:58 PDT 2014

Le jeudi 24 avril 2014 à 10:54 +0900, Makoto Harada a écrit :

> Dear gstreamer expert,
> I'm now working to implement DMABUF feature to our custom video encoder plugin,
> which would be directory connected to v4l2src in the gstreamer pipeline. (We
> have already validated the DMABUF functionality of our kernel by using some
> simple V4L2 applications, so now the turn of gstreamer)

This is not needed. I already got it in my branch [1]. Next week I'm
giving it a last debugging round, need to fix some threading issues and
seeking/flush. Some patch cleanup and will start merging this into
master if it's all good with the others. What will be pending is
transparent activation of it.

> I've checked the DMABUF related commits of git repository including two commits
> below, and also checked the discussion regarding DMABUF on this mailing list.
> https://bugzilla.gnome.org/show_bug.cgi?id=693826
> http://lists.freedesktop.org/archives/gstreamer-commits/2013-February/069408.html
> On top of that, I have two questions.
> 1. How the information of file descriptor of DMABUF memory, which is allocated
> by VIDIOC_EXPBUF ioctl, is expected to transfer to the downstream element, and how 
> the downstream element is expected to receive it ? I've checked gstdmabuf.c and 
> gstdmabuf.h in gst-plugins-base, however could not find such kind of information.

So the branch I mention has a new GstV4l2Allocator, that is used
internally to track v4l2 buffers and associated memory. What we do to
fit the dmabuf allocator model, is that we do the expbuf using
gst_v4l2_allocator_alloc_dmabuf(), allocation a v4l2 memory and make
this memory parent a of normally allocatoted dmabuf memory. The dmabuf
memory are then put into a buffer and forwarded. Other element can
detect that all memory are dmabuf by iterating the memory and using
gst_is_dmabuf_memory ().

> 2. Does anyone know if there is any working gstreamer plugin which acts as the 
> DMABUF importer, and works with v4l2src ?

With my work, any v4l2 element can do this by setting
io-mode=dmabuf-import (or the capture/output varient for m2m).

> I'm newbie of gstreamer world, so any kinds of information would be helpful.

Hope my work will make your life simplier then, nothing of this was
exactly simple. I think there exist patches to wayland sink to add
dmabuf support, though I don't know if it's importation or exportation
(probably the second).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140426/0f535121/attachment.html>

More information about the gstreamer-devel mailing list