From 56a1eb65e2f82c36d5f63e1182ebf78680a0adba Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Sun, 4 Mar 2018 15:14:08 +0100 Subject: [PATCH] qt: Get EGL native display from QPA if platform header is available https://bugzilla.gnome.org/show_bug.cgi?id=792378 --- configure.ac | 1 + ext/qt/gstqtglutility.cc | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 800b356150..3503ed9f2a 100644 --- a/configure.ac +++ b/configure.ac @@ -892,6 +892,7 @@ AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [ AS_IF([test -f "$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH/qpa/qplatformnativeinterface.h"], [ QT_CFLAGS="$QT_CFLAGS -I$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH" HAVE_QT_QPA_HEADER="yes" + AC_DEFINE([HAVE_QT_QPA_HEADER], [], [Define if the Qt QPA header is installed]) ], [AC_MSG_NOTICE([Cannot find QPA])]) if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1" || test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then PKG_CHECK_MODULES(QT_X11, Qt5X11Extras, [ diff --git a/ext/qt/gstqtglutility.cc b/ext/qt/gstqtglutility.cc index ee9d04b8ff..cc84c8340c 100644 --- a/ext/qt/gstqtglutility.cc +++ b/ext/qt/gstqtglutility.cc @@ -42,6 +42,9 @@ #else #include #include +#ifdef HAVE_QT_QPA_HEADER +#include +#endif #endif #endif @@ -110,6 +113,13 @@ gst_qt_get_gl_display () } display = (GstGLDisplay *) gst_gl_display_viv_fb_new (disp_idx); +#elif defined(HAVE_QT_QPA_HEADER) + QPlatformNativeInterface *native = + QGuiApplication::platformNativeInterface(); + EGLDisplay egl_display = (EGLDisplay) + native->nativeResourceForWindow("egldisplay", NULL); + if (egl_display != EGL_NO_DISPLAY) + display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (egl_display); #else EGLDisplay egl_display = (EGLDisplay) gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0); display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (egl_display);