dmabuf in pipeline

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

dmabuf in pipeline

prg.amc
Hi, currently I have a problem in passing dmabuf fd to other elements.

so, I have plugin which acts as src and it will receive dma fd from another
process using DBUS, so there a way to pass the same fd to next elements, the
next element knows how to access the memory location using the fd.

     GstBuffer *buffer = gst_buffer_new();

    GstAllocator *allocator = gst_dmabuf_allocator_new();

    if (buffer != nullptr && allocator != nullptr) {
      GstMemory *mem = gst_dmabuf_allocator_alloc(allocator, fd, nBufSize);

       gst_buffer_append_memory(buffer, mem);

      *buf = buffer;

This is what i`m using now, but with the above code gstreamer is trying to
copy the data using fdmemory. where the fd is not accessable directly.

*0x5575c30f70 ERROR               fdmemory gstfdmemory.c:126:gst_fd_mem_map:
0x5575e47520: fd 14: mmap failed: No such device
ERROR               fdmemory gstfdmemory.c:126:gst_fd_mem_map: 0x5575e47520:
fd 14: mmap failed: No such device
*

I`m i doing it correct? and i dont have any custom bufferpool manager.






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dmabuf in pipeline

Nicolas Dufresne-5
Le jeudi 08 avril 2021 à 08:53 -0500, prg.amc a écrit :

> Hi, currently I have a problem in passing dmabuf fd to other elements.
>
> so, I have plugin which acts as src and it will receive dma fd from another
> process using DBUS, so there a way to pass the same fd to next elements, the
> next element knows how to access the memory location using the fd.
>
>      GstBuffer *buffer = gst_buffer_new();
>
>     GstAllocator *allocator = gst_dmabuf_allocator_new();
>
>     if (buffer != nullptr && allocator != nullptr) {

These two _new() function will never fail.

>       GstMemory *mem = gst_dmabuf_allocator_alloc(allocator, fd, nBufSize);
>
>        gst_buffer_append_memory(buffer, mem);
>
>       *buf = buffer;
>
> This is what i`m using now, but with the above code gstreamer is trying to
> copy the data using fdmemory. where the fd is not accessable directly.
>
> *0x5575c30f70 ERROR               fdmemory gstfdmemory.c:126:gst_fd_mem_map:
> 0x5575e47520: fd 14: mmap failed: No such device
> ERROR               fdmemory gstfdmemory.c:126:gst_fd_mem_map: 0x5575e47520:
> fd 14: mmap failed: No such device
> *
>
> I`m i doing it correct? and i dont have any custom bufferpool manager.

Along the way, something in your pipeline (undocumented here) is doing a memory
map to access the data. But this mapping failed because the DMABuf FD is
invalid. I would recommend reviewing how you "pass" the FD through DBus, as it
seems this isn't appropriate method. Perhaps you are using an FD value from
another process ?

>
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dmabuf in pipeline

prg.amc
Hi Thanks for the reply, actually the fd is exported from gbm buffers. using
this fd the downstream element will open the device and it will do memap.
I`m trying to understand can we wrap just DMA fd into gstbuffer ?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dmabuf in pipeline

Nicolas Dufresne-5


Le jeu. 8 avr. 2021 17 h 30, prg.amc <[hidden email]> a écrit :
Hi Thanks for the reply, actually the fd is exported from gbm buffers. using
this fd the downstream element will open the device and it will do memap.
I`m trying to understand can we wrap just DMA fd into gstbuffer ?

No, since GST buffers are GstMemory container. As I said, the error you reported indicates an invalid FD, I would worry about that fiest and then try and figure out why the memory is being mapped to CPU. GEM prime FD are not always mappable or a supported the video format.





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dmabuf in pipeline

prg.amc
The FD error is due to mmap. I've to pass only fd to wayland sink. In the
code when I wrap it with dmabuff allocator gstreamer is trying to copy data
with memap from fdmemory. Is there a way to stop copy and pass buffer to
wayland sink.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: dmabuf in pipeline

Nicolas Dufresne-5
Le jeudi 08 avril 2021 à 21:26 -0500, prg.amc a écrit :
> The FD error is due to mmap. I've to pass only fd to wayland sink. In the
> code when I wrap it with dmabuff allocator gstreamer is trying to copy data
> with memap from fdmemory. Is there a way to stop copy and pass buffer to
> wayland sink.

As I tried to explain, you need to read the related code that attempt to copy
and understand why a copy is being made. And then fix that to avoid the copy.

>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel