summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-09-11 11:09:52 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-10-02 10:45:58 +0200
commitc7bd3131a8854814d59881339ac1d7a4af3c9863 (patch)
tree8b88dc38ab981928b6b188fe02f7f85c40d3c723
parent64fff601a78887e321cd7d486974fe7dfe065d6b (diff)
downloadqtmultimedia-c7bd3131a8854814d59881339ac1d7a4af3c9863.tar.gz
imx6: Fix mapping VPU texture using real physical address of data
* Get real physical address of video frame data and provide it to imx6 vivante videonode to prevent memory leak from kernel. By default qtmultimedia does not depend on gstreamer-imx, but the plugin should exist on imx platform. So gstreamer_imxcommon will be disabled. And should be manually enabled in yocto receipt. Change-Id: I6e75746a2ba651d12bdd7697ae483699aad450fc Fixes: QTBUG-73084 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
-rw-r--r--src/multimedia/configure.json17
-rw-r--r--src/plugins/videonode/imx6/imx6.pro6
-rw-r--r--src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp12
3 files changed, 34 insertions, 1 deletions
diff --git a/src/multimedia/configure.json b/src/multimedia/configure.json
index 6d56af5ed..2db8ce55c 100644
--- a/src/multimedia/configure.json
+++ b/src/multimedia/configure.json
@@ -95,6 +95,18 @@
{ "libs": "-lgstphotography-1.0" }
]
},
+ "gstreamer_imxcommon": {
+ "label": "GStreamer i.MX common",
+ "export": "gstreamer_imxcommon",
+ "test": {
+ "include": "gst/allocators/imx/phys_mem_meta.h"
+ },
+ "use": "gstreamer_1_0",
+ "sources": [
+ { "type": "pkgConfig",
+ "args": "gstimxcommon" }
+ ]
+ },
"libresourceqt5": {
"label": "libresourceqt5",
"test": "resourcepolicy",
@@ -229,6 +241,11 @@
"condition": "(features.gstreamer_1_0 && libs.gstreamer_photography_1_0) || (features.gstreamer_0_10 && libs.gstreamer_photography_0_10)",
"output": [ "privateFeature" ]
},
+ "gstreamer_imxcommon": {
+ "label": "GStreamer i.MX common",
+ "condition": "(features.gstreamer_1_0 && libs.gstreamer_imxcommon)",
+ "output": [ "privateFeature" ]
+ },
"gpu_vivante": {
"label": "Vivante GPU",
"condition": "features.gui && features.opengles2 && tests.gpu_vivante",
diff --git a/src/plugins/videonode/imx6/imx6.pro b/src/plugins/videonode/imx6/imx6.pro
index c8085a31e..43e17e725 100644
--- a/src/plugins/videonode/imx6/imx6.pro
+++ b/src/plugins/videonode/imx6/imx6.pro
@@ -2,6 +2,12 @@ TARGET = imx6vivantevideonode
QT += multimedia-private qtmultimediaquicktools-private
+qtConfig(gstreamer_imxcommon) {
+ QT += multimediagsttools-private
+ QMAKE_USE += gstreamer_imxcommon
+ DEFINES += GST_USE_UNSTABLE_API
+}
+
HEADERS += \
qsgvivantevideonode.h \
qsgvivantevideomaterialshader.h \
diff --git a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
index 4b68f47a4..e1468fe34 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
+++ b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
@@ -49,6 +49,11 @@
#include <unistd.h>
+#include <QtMultimedia/private/qtmultimediaglobal_p.h>
+#if QT_CONFIG(gstreamer_imxcommon)
+#include "private/qgstvideobuffer_p.h"
+#include <gst/allocators/imx/phys_mem_meta.h>
+#endif
//#define QT_VIVANTE_VIDEO_DEBUG
@@ -224,7 +229,12 @@ GLuint QSGVivanteVideoMaterial::vivanteMapping(QVideoFrame vF)
#endif
GLuint physical = ~0U;
-
+#if QT_CONFIG(gstreamer_imxcommon)
+ auto buffer = reinterpret_cast<QGstVideoBuffer *>(vF.buffer());
+ GstImxPhysMemMeta *meta = GST_IMX_PHYS_MEM_META_GET(buffer->buffer());
+ if (meta && meta->phys_addr)
+ physical = meta->phys_addr;
+#endif
glBindTexture(GL_TEXTURE_2D, tmpTexId);
glTexDirectVIVMap_LOCAL(GL_TEXTURE_2D,
fullWidth, fullHeight,