summaryrefslogtreecommitdiffstats
path: root/src/plugins
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 /src/plugins
parent64fff601a78887e321cd7d486974fe7dfe065d6b (diff)
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>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/videonode/imx6/imx6.pro6
-rw-r--r--src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp12
2 files changed, 17 insertions, 1 deletions
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,