After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730863 - qtvideosink: add i.MX6 zero-copy rendering implementation
qtvideosink: add i.MX6 zero-copy rendering implementation
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: qt-gstreamer
0.10.x
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-28 07:30 UTC by Michael
Modified: 2018-05-04 13:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Added zero-copy patch for i.MX6 (8.67 KB, patch)
2014-05-28 13:34 UTC, Benjamin Federau
none Details | Review
i.MX6 zero-copy rendering patch without memory leak (11.41 KB, patch)
2016-12-14 09:28 UTC, Thomas McGuire
none Details | Review

Description Michael 2014-05-28 07:30:16 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.
Comment 1 Benjamin Federau 2014-05-28 13:34:33 UTC
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.
Comment 2 Michael 2014-05-28 13:59:21 UTC
Great, I'm testing in now !!!
Comment 3 Michael 2014-05-28 15:35:52 UTC
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!
Comment 4 Tim-Philipp Müller 2014-11-28 20:21:37 UTC
Any plans to update this for the 1.x branch?
Comment 5 Thomas McGuire 2016-12-14 09:28:10 UTC
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.
Comment 6 Thomas McGuire 2016-12-14 09:33:43 UTC
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
Comment 7 George Kiagiadakis 2018-05-04 13:08:42 UTC
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)