proxy allocation query to fix appsink zero-copy issue

Nicolas Dufresne nicolas at ndufresne.ca
Fri Jan 31 16:09:58 UTC 2020


Le jeudi 30 janvier 2020 à 16:28 -0600, mksafavi a écrit :
>   > 1. Are you modifying the buffers in-place?
> yes. I memcpy the buffer data to a mmapped region, in order to send the
> buffer with axidma to the accelerator. the returned data is scaled
> down(right now I'm only testing it on 1080 to 720 on NV12).then I wrap it on
> a GstMem and push the buffer to appsrc.
> (we're trying to avoid the memcpy by setting up SMMU using VFIO driver)

So on this side, you would have to reply to the allocation query by proposing a
pool. Unfortunatly, the VCU OMX code only support DMABuf importation, so you'll
need DMABuf support on your accelerator. The simple thing to do, is to run the
pipeline with decode ! encode, add a probe in between and prints the
strides/offset in use and try to reproduce this in your accelerator.

> 
>   > 2. If not, do you have the ability to allocated DMABuf memory?
> I'd like to allocate DMABUF but I couldn't make it work with Xilinx VCU
> decoder.
> the Xilinx changelog states that it's possible to get DMABUF form decoder. 
> I remember there was /iomode=1/ option for v4l2src that enabled dmabuf on
> decoder.
> but couldn't find anything for my pipeline
> filesrc->decoder->appsink->scaler->appsrc->encoder->filesink

The decoder always produce dmabuf. As long as you set GST_VIDEO_META_API in your
allocation query reply, it will produce that. New version of the VCU/OMX will
support DMAbuf importation.

> 
>   > 3. What do you know about video buffer alignment?
> I'm not really familiar with buffer alignment. I just know that it affects
> the throughput of memcpy. but don't know why exactly 

Ok, no worries, it's mostly used to satisfy batch processing requirement. As an
example, if you have an instructions that deadls with 128bits per intructions,
it will also requires the memory pointers to be 128 align (a multiple of), and
that the buffer size is a multiple of 128 bytes.

As the processing is often per line, we need this alignment/padding per line, so
in we use strides (like size in bytes), larger then the width in order to allow
using these accelerators. See GstVideoMeta for the paramters GStreamer supports.
We also have some alignment support in GstMemory.

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



More information about the gstreamer-devel mailing list