GNOME Bugzilla – Bug 730863
qtvideosink: add i.MX6 zero-copy rendering implementation
Last modified: 2018-05-04 13:08:42 UTC
The CPU usage is very high when using qtgstreamer on an imx6 based platform. This is due to very time consuming memory copy operation. There is a patch included in Qt5.3 that allows for zero copy memory mapping (see here: https://codereview.qt-project.org/#change,76764). On Qt5.3 the QtMultimedia only uses negligible amount of CPU time even for 1080p material. QtGstreamer, however, does not seem to make use of this new mechanism and is thus not usable on imx6 platforms. Please consider porting this patch to QtGstreamer. If possible, also to the 0.10 branch, as under imx6 not all HW codecs have been ported yet to 1.0.
Created attachment 277389 [details] [review] Added zero-copy patch for i.MX6 I have added a cmake define called -DHW_PLATFORM=imx6 to activate the zero-copy patch. This is a first version and for sure needs some more testing. I have done some first tests with qt-gstreamer 0.10 and 1.0 on the i.MX6 platform and until now it works for me.
Great, I'm testing in now !!!
First results are very promising. I am testing with qt-gstreamer 0.10 and Qt5.3 on imx6. 1080p playback is smooth and about 35% CPU usage!
Any plans to update this for the 1.x branch?
Created attachment 341939 [details] [review] i.MX6 zero-copy rendering patch without memory leak The patch from comment 1 can trigger a in-Kernel memory leak with certain Kernel/GPU driver combinations such as Kernel 4.1.15-1.1.0 with GPU driver 5.0.11.p8.3. The memory leak is about 1k per frame, and can be seen by a growing "SUnreclaim" in /proc/meminfo and a growing "kmalloc-1024" in slabtop. Passing the correct physical address to glTexDirectVIVMap() fixes the problem. This is also how it is done in eglvivsink from gstreamer-imx. I've attached a new patch against version 1.2.0 of qt-gstreamer that includes the fix for this.
Note that in order to upstream the patch, it probably needs to gain a a few "#ifdef HW_PLATFORM_IMX6" for the new code I added. Some other improvements that could be made, based on qsgvivantevideomaterial.cpp from QtMultimedia: - Use glTexDirectVIV() + memcpy() if the physical address is not available - Use only glTexDirectInvalidateVIV() if the same virtual address has already been seen before
Thank you all for the patches, but unfortunately it doesn't look like something trivial to merge and this codebase is unmaintained, so it's unlikely that someone will go on and complete this. The alternative qmlglsink element (in gst-plugins-good) does have support for vivante extensions, so it would be a better idea to use that instead (and improve that one if necessary, which will also benefit all other GStreamer-GL elements)