dmabuf from appsink
Nicolas Dufresne
nicolas at ndufresne.ca
Wed Sep 15 18:34:05 UTC 2021
Le mercredi 15 septembre 2021 à 20:01 +0400, Lusine Hayrapetyan a écrit :
> Hi Nicolas,
>
> Thank you for the information. Let me give more details. Basically I'm looking
> for something like this:
> gst-launch-1.0 filesrc location=input.mp4 ! qtdemux ! h264parse ! nvh264dec !
> gldownload ! appsink sync=false caps=video/x-raw\(memory:DMABuf\)
>
> gldownload src pad has memory:DMABuf support so I expect this to work but caps
> negotiation is failing. Am I missing something?
>
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> Got context from element
> 'gldownloadelement0': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"
> \(GstGLDisplayX11\)\ gldisplayx11-0";
> Got context from element 'nvh264dec0': gst.cuda.context=context,
> gst.cuda.context=(GstCudaContext)"\(GstCudaContext\)\ cudacontext0", cuda-
> device-id=(int)0;
> Redistribute latency...
> ERROR: from element /GstPipeline:pipeline0/GstQTDemux:qtdemux0: Internal data
> stream error.
> Additional debug info:
> ../subprojects/gst-plugins-good/gst/isomp4/qtdemux.c(6650): gst_qtdemux_loop ():
> /GstPipeline:pipeline0/GstQTDemux:qtdemux0:
> streaming stopped, reason not-negotiated (-4)
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to NULL ...
> Freeing pipeline ...
>
> When I use memory:GLMemory instead of memory:DMABuf the pipeline works.
> Is it possible to convert GLMemory to DMABuf?
Only if your GL driver supports this. The DMABuf exportation is a Mesa
extension:
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_image_dma_buf_export.txt
I would be surprised if NVidia implemented this on Linux. The second thing to
know, is that it will not work on any of the modern GL driver, as we don't yet
support DRM modifiers. GPU are very inefficient with linear video buffer,
instead they use tiles and also compression.
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/blob/master/gst-libs/gst/gl/egl/gsteglimage.c#L1083
>
> Regards,
> Lusine
>
> On Wed, Sep 8, 2021 at 9:05 PM Nicolas Dufresne <nicolas at ndufresne.ca> wrote:
> > Le mercredi 08 septembre 2021 à 19:17 +0400, Lusine Hayrapetyan via gstreamer-
> > devel a écrit :
> > > Hi Folks,
> > >
> > > I have a pipeline which does gpu decoding and ends with appsink.
> > > Is it possible to get dmabuf from appsink with zero-copy?
> >
> > Yes, though may require an extra step. Here's some example:
> >
> > Checking if you did receive dmabuf:
> > https://gitlab.freedesktop.org/mesa/kmscube/-/blob/master/gst-decoder.c#L395
> >
> > Getting dmabuf FD (note that dup is optional, you can simply ref the gstmemory
> > or the buffer for the needed amount of time):
> > https://gitlab.freedesktop.org/mesa/kmscube/-/blob/master/gst-decoder.c#L412
> >
> > Telling upstream that you support GstVideoMeta can greatly help preventing
> > upstream copies:
> > https://gitlab.freedesktop.org/mesa/kmscube/-/blob/master/gst-decoder.c#L242
> >
> > >
> > > Thanks,
> > > Lusine
> > >
> >
> >
More information about the gstreamer-devel
mailing list