]> code.ossystems Code Review - meta-freescale.git/commitdiff
gstreamer1.0-plugins-bad: Add fixes for qmlglsink 14/16514/1
authorCarlos Rafael Giani <dv7777@gmail.com>
Fri, 11 Aug 2017 21:52:10 +0000 (23:52 +0200)
committerFabio Berton <fabio.berton@ossystems.com.br>
Mon, 14 Aug 2017 19:43:40 +0000 (16:43 -0300)
These fixes enable qmlglsink support with Qt5 EGLFS, and also fix a
flickering issue in qmlglsink caused by a data race (frames are drawn
while the decoder writes new frame data into their DMABUFs).

Change-Id: I51dc3efee26ebb441ea0ea8f601043f6a0024a5a
Signed-off-by: Carlos Rafael Giani <dv7777@gmail.com>
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-qmlglsink-Retain-the-previous-frame-to-avoid-flicker.patch [new file with mode: 0644]
recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/mesa3d-gbm/0002-gl-viv-fb-Fix-user-choice-string-comparisons.patch [deleted file]
recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/mesa3d-gbm/0006-qt-Add-support-for-GBM-backend.patch [new file with mode: 0644]
recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.12.%.bbappend

diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-qmlglsink-Retain-the-previous-frame-to-avoid-flicker.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-qmlglsink-Retain-the-previous-frame-to-avoid-flicker.patch
new file mode 100644 (file)
index 0000000..2dc3b12
--- /dev/null
@@ -0,0 +1,66 @@
+From 8272d5c9e32d2ae26ce28dcbf9a7962bc18f2338 Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <dv@pseudoterminal.org>
+Date: Thu, 10 Aug 2017 11:29:41 +0200
+Subject: [PATCH] qmlglsink: Retain the previous frame to avoid flickering
+ artifacts
+
+With some GstGL uploaders - especially the ones based on DMABUF - it is
+possible that flickering artifacts can occur with qmlglsink. This happens
+because upstream writes into the dmabuf at the same time when the frame
+in that dmabuf is being painted on screen. By retaining the gstbuffer for
+one more frame, this is avoided, since the gstbuffer is not released back
+into the upstream dmabuf buffer pool until the frame is drawn.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=786133
+---
+ ext/qt/gstqsgtexture.cc | 7 +++++++
+ ext/qt/gstqsgtexture.h  | 1 +
+ 2 files changed, 8 insertions(+)
+
+diff --git a/ext/qt/gstqsgtexture.cc b/ext/qt/gstqsgtexture.cc
+index 7391806..46d73bb 100644
+--- a/ext/qt/gstqsgtexture.cc
++++ b/ext/qt/gstqsgtexture.cc
+@@ -46,6 +46,7 @@ GstQSGTexture::GstQSGTexture ()
+   gst_video_info_init (&this->v_info);
+   this->buffer_ = NULL;
++  this->previous_buffer_ = NULL;
+   this->qt_context_ = NULL;
+   this->sync_buffer_ = gst_buffer_new ();
+   this->dummy_tex_id_ = 0;
+@@ -54,6 +55,7 @@ GstQSGTexture::GstQSGTexture ()
+ GstQSGTexture::~GstQSGTexture ()
+ {
+   gst_buffer_replace (&this->buffer_, NULL);
++  gst_buffer_replace (&this->previous_buffer_, NULL);
+   gst_buffer_replace (&this->sync_buffer_, NULL);
+   if (this->dummy_tex_id_ && QOpenGLContext::currentContext ()) {
+     QOpenGLContext::currentContext ()->functions ()->glDeleteTextures (1,
+@@ -75,6 +77,11 @@ gboolean
+ GstQSGTexture::setBuffer (GstBuffer * buffer)
+ {
+   GST_LOG ("%p setBuffer %" GST_PTR_FORMAT, this, buffer);
++
++  /* Retain the current buffer for one frame to prevent
++   * releasing the buffer while it is being drawn */
++  gst_buffer_replace (&this->previous_buffer_, this->buffer_);
++
+   /* FIXME: update more state here */
+   if (!gst_buffer_replace (&this->buffer_, buffer))
+     return FALSE;
+diff --git a/ext/qt/gstqsgtexture.h b/ext/qt/gstqsgtexture.h
+index fdabe93..d2685f8 100644
+--- a/ext/qt/gstqsgtexture.h
++++ b/ext/qt/gstqsgtexture.h
+@@ -48,6 +48,7 @@ public:
+ private:
+     GstBuffer * buffer_;
++    GstBuffer * previous_buffer_;
+     GstBuffer * sync_buffer_;
+     GstGLContext * qt_context_;
+     GstMemory * mem_;
+-- 
+2.7.4
+
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/mesa3d-gbm/0002-gl-viv-fb-Fix-user-choice-string-comparisons.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/mesa3d-gbm/0002-gl-viv-fb-Fix-user-choice-string-comparisons.patch
deleted file mode 100644 (file)
index 4cbf8d9..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-From a1d44ee3fbc517b6515f41e98871b01a7608623c Mon Sep 17 00:00:00 2001
-From: Carlos Rafael Giani <dv@pseudoterminal.org>
-Date: Tue, 9 May 2017 23:59:04 +0200
-Subject: [PATCH 2/5] gl/viv-fb: Fix user-choice string comparisons
-
-https://bugzilla.gnome.org/show_bug.cgi?id=782921
----
- gst-libs/gst/gl/gstgldisplay.c | 2 +-
- gst-libs/gst/gl/gstglwindow.c  | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
-index b456b1f..6408f0c 100644
---- a/gst-libs/gst/gl/gstgldisplay.c
-+++ b/gst-libs/gst/gl/gstgldisplay.c
-@@ -301,7 +301,7 @@ gst_gl_display_new (void)
-     display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL));
- #endif
- #if GST_GL_HAVE_WINDOW_VIV_FB
--  if (!display && (!user_choice || g_strstr_len (user_choice, 2, "viv-fb"))) {
-+  if (!display && (!user_choice || g_strstr_len (user_choice, 6, "viv-fb"))) {
-     const gchar *disp_idx_str = NULL;
-     gint disp_idx = 0;
-     disp_idx_str = g_getenv ("GST_GL_VIV_FB");
-diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
-index c1dae2d..d279b22 100644
---- a/gst-libs/gst/gl/gstglwindow.c
-+++ b/gst-libs/gst/gl/gstglwindow.c
-@@ -275,7 +275,7 @@ gst_gl_window_new (GstGLDisplay * display)
-     window = GST_GL_WINDOW (gst_gl_window_eagl_new (display));
- #endif
- #if GST_GL_HAVE_WINDOW_VIV_FB
--  if (!window && (!user_choice || g_strstr_len (user_choice, 2, "viv-fb")))
-+  if (!window && (!user_choice || g_strstr_len (user_choice, 6, "viv-fb")))
-     window = GST_GL_WINDOW (gst_gl_window_viv_fb_egl_new (display));
- #endif
--- 
-2.7.4
-
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/mesa3d-gbm/0006-qt-Add-support-for-GBM-backend.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/mesa3d-gbm/0006-qt-Add-support-for-GBM-backend.patch
new file mode 100644 (file)
index 0000000..d188769
--- /dev/null
@@ -0,0 +1,40 @@
+From 322be5a7a927765dd9b122280b0c09b50a4bea07 Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <dv@pseudoterminal.org>
+Date: Thu, 10 Aug 2017 13:48:31 +0200
+Subject: [PATCH] qt: Add support for GBM backend
+
+https://bugzilla.gnome.org/show_bug.cgi?id=783521
+---
+ ext/qt/gstqtglutility.cc | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/ext/qt/gstqtglutility.cc b/ext/qt/gstqtglutility.cc
+index 22aae60..b925d1c 100644
+--- a/ext/qt/gstqtglutility.cc
++++ b/ext/qt/gstqtglutility.cc
+@@ -40,6 +40,9 @@
+ #if GST_GL_HAVE_WINDOW_VIV_FB
+ #include <qpa/qplatformnativeinterface.h>
+ #include <gst/gl/viv-fb/gstgldisplay_viv_fb.h>
++#elif GST_GL_HAVE_WINDOW_GBM
++#include <qpa/qplatformnativeinterface.h>
++#include <gst/gl/gbm/gstgldisplay_gbm.h>
+ #else
+ #include <gst/gl/egl/gstgldisplay_egl.h>
+ #endif
+@@ -113,6 +116,12 @@ gst_qt_get_gl_display ()
+     }
+     display = (GstGLDisplay *) gst_gl_display_viv_fb_new (disp_idx);
++#elif GST_GL_HAVE_WINDOW_GBM
++    QPlatformNativeInterface *native =
++        QGuiApplication::platformNativeInterface();
++    EGLDisplay egl_display = (EGLDisplay)
++        native->nativeResourceForWindow("egldisplay", NULL);
++    display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (egl_display);
+ #else
+     display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (eglGetDisplay(EGL_DEFAULT_DISPLAY));
+ #endif
+-- 
+2.7.4
+
index 5890c53ad7815dfb91a534727c84b742b083da52..9832739d150374ecafc865f92adc830a87734437 100644 (file)
@@ -4,11 +4,12 @@ PACKAGECONFIG_GL_mainline-bsp = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl
 
 SRC_URI_append = " \
     file://mesa3d-gbm/0001-qmlglsink-Add-dummy-texture-that-is-shown-as-placeho.patch \
-    file://mesa3d-gbm/0002-gl-viv-fb-Fix-user-choice-string-comparisons.patch \
     file://mesa3d-gbm/0003-configure-Factor-out-libdrm-to-make-the-configuratio.patch \
     file://mesa3d-gbm/0004-configure-Factor-out-gudev-checks.patch \
     file://mesa3d-gbm/0005-gl-Add-Mesa3D-GBM-backend.patch \
+    file://mesa3d-gbm/0006-qt-Add-support-for-GBM-backend.patch \
     file://direct-dmabuf-uploader/0001-gstgl-Fix-sanity-check-in-gst_gl_memory_setup_buffer.patch \
     file://direct-dmabuf-uploader/0002-gl-egl-Add-gst_egl_image_from_dmabuf_direct-function.patch \
     file://direct-dmabuf-uploader/0003-gstgl-Add-direct-DMABUF-uploader-WIP.patch \
+    file://0008-qmlglsink-Retain-the-previous-frame-to-avoid-flicker.patch \
 "