Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
182 stars 127 forks source link

imxeglvivsink -> glimagesink? #289

Closed woutervanh closed 2 years ago

woutervanh commented 3 years ago

In the past, we were using imxeglvivsink to cope with window-id's from X11. With the removal of imxeglvivsink, I tryed with glimagesink. The performance is very bad though. A lot of gstreamer data is being dropped. What to do about it? I would assume that, when imxeglvivsink is removed in favour of glimagesink or waylandsink, the performance should be equal?

dv1 commented 3 years ago

It should, yes. If the performance is bad, then something is wrong with the zerocopy path inside GstreamerGL, meaning that frames are being copied (perhaps also colorspace converted) with the CPU. What BSP and GStreamer version are you using?

woutervanh commented 3 years ago

Well, it was on yocto gatesgarth, just meta-freescale layers

dv1 commented 2 years ago

Nowadays, the best approach is to use newest libimxdmabuffer, libimxvpuapi2, and gstreamer-imx versions, and make sure that the kernel config has the ION CMA and/or dma-heap CMA allocators enabled and that libimxdmabuffer is built with the ION and/or dma-heap allocator support enabled. (Also check out the details about cached/uncached memory when using dma-heap.) This then allows for using DMA-BUF. GstreamerGL can automatically handle DMA-BUF data and upload it to GL textures without copying pixels via the CPU. Tested on Yocto Dunfell and Yocto Kirkstone, performance was just like with the old imxeglvivsink. Closing this. If you still get performance issues, reopen it. Note though that gatesgarth is unsupported - the focus is on the LTS Yocto releases.

Talkless commented 1 year ago

Interesting find:

Nowadays, the best approach is to use newest libimxdmabuffer, libimxvpuapi2, and gstreamer-imx versions, and make sure that the kernel config has the ION CMA and/or dma-heap

My libimxdmabuffer configuration looks like this:

i.MX linux headers path: /opt/fsl-imx-wayland/5.10-hardknott/sysroots/cortexa53-crypto-poky-linux/usr/include/imx 
Checking for dma-heap allocator support by testing the presence of the DMA_HEAP_IOCTL_ALLOC ioctl : yes 
dma-heap device node path: /dev/dma_heap/linux,cma 
dma-heap allocates uncached memory                                                                : no 
Checking for ION allocator support by testing the presence of linux/ion.h                         : yes 
--hantro-decoder-version is not set; disabling DWL allocator 
Hantro decoder version: None 
Hantro headers path:  
checking for linux/fb.h and the IPU header linux/ipu.h                                            : yes 
Checking for library g2d                                                                          : yes 
Checking for header g2d.h                                                                         : yes 
checking for linux/pxp_device.h                                                                   : yes 
libimxdmabuffer version 1.1.2 
'configure' finished successfully (0.666s)

So I guess it at least from libimxdmabuffer side should work? But I still need to use imxg2dvideotransform to work with glupload, and it eats up performance :/ (see https://github.com/Freescale/gstreamer-imx/issues/316).