IMX Scaler / CSC m2m driver.

Nicolas Dufresne nicolas.dufresne at collabora.com
Fri Mar 20 09:46:37 PDT 2015



Le 03/20/2015 12:24 PM, Ian Molton a écrit :
> On 20/03/15 15:53, Nicolas Dufresne wrote:
> 
>> MMAP: Fixed size pool provided by the HW, mmap(dev_fd, offset)
>> DMABUF: Fixed size pool provided by the HW, mmap(dma_fd, 0)
>> USERPTR: Buffer from elsewhere (usually another driver in MMAP)
>> DMABUF-IMPORT: DMABUF from elsewhere
>>
>> Nicolas
> 
> Hi!
> 
> gst-launch-1.0 filesrc location= Downloads/big_buck_bunny_1080p_h264.mov
> ! qtdemux ! h264parse ! queue ! v4l2video3videodec
> capture-io-mode=dmabuf ! v4l2video0convert output-io-mode=dmabuf-import
> ! video/x-raw,width=1920,height=1080 ! ximagesink sync=false
> 
> So, in the above pipeline, presumably everything up tov4l2video3videodec
> is happening in userspace.

Yes.

> 
> Does that mean the buffers allocated for h264parse to write its data into
> are allocated by the CODA driver?

No, because demuxers don't negotiate buffer pools. The decoder copies
into one of the mmap buffer. That's why I suggested using
output-io-mode=usrptr (which I saw support being added in media tree iirc).

> 
> in coda_decoder_queue_init() there is:
> 
> dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
>         dst_vq->io_modes = VB2_DMABUF | VB2_MMAP;
> 
> 
> Does this mean that v4l2video0convert will automatically handle the data
> via
> a DMABUF?

No, kernel code does not imply anything on userspace. In fact, only the
manual io-mode setting is currently supported. We would like in the
future to negotiate these.

> 
> is there any practical difference between a DMABUF and a MMAP buf?
> I presume one is allocated GFP_DMA and the other GFK_KERNEL, is that it? so
> for the best performance, I'd want all the elements in the chain to be
> using
> DMABUFs ?

In the kernel v4l2 drivers, DMABUF stands for importer role. Exporter
role is MMAP + expbufs ioctl being implemented.

> 
> Why would I ever want a USERPTR if a DMA/MMAP option is available? doesn't
> that imply a copy (from userspace) ?

Wrong, USERPTR is also a importing role. Certain driver, like UVC, can
deal with vmalloc memory, and write directly from USB port to it. So using:

v4l2src io-mode=userptr ! xvimagesink

Actually saves a copy. Note that some driver support USERPTR, but fails
if the memory isn't contiguous or page aligned.


More information about the gstreamer-devel mailing list