From 2132ba9a9437ce93e178a49d61c2e30ec85fac27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 17 Feb 2017 14:37:08 +0200 Subject: [PATCH] qml: Add support for Vivante EGL FS windowing system https://bugzilla.gnome.org/show_bug.cgi?id=778825 --- configure.ac | 4 ++-- ext/qt/gstqtglutility.cc | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2f69e89..25ca7c3 100644 --- a/configure.ac +++ b/configure.ac @@ -2915,10 +2915,10 @@ AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [ else HAVE_QT="yes" HAVE_QT_WINDOWING="no" - QT_VERSION="`$PKG_CONFIG --modversion Qt5Core`" + QT_VERSION="`$PKG_CONFIG --define-prefix --modversion Qt5Core`" QPA_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir Qt5Core`/QtGui/${QT_VERSION}/QtGui AS_IF([test -f "$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH/qpa/qplatformnativeinterface.h"], [ - QT_CFLAGS="$QT_CFLAGS -I$QPA_INCLUDE_PATH" + QT_CFLAGS="$QT_CFLAGS -I$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH" HAVE_QT_QPA_HEADER="yes" ], [AC_MSG_NOTICE([Cannot find QPA])]) if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1"; then diff --git a/ext/qt/gstqtglutility.cc b/ext/qt/gstqtglutility.cc index 196d010..22aae60 100644 --- a/ext/qt/gstqtglutility.cc +++ b/ext/qt/gstqtglutility.cc @@ -37,7 +37,12 @@ #endif #if GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS) +#if GST_GL_HAVE_WINDOW_VIV_FB +#include +#include +#else #include +#endif #include #endif @@ -85,9 +90,34 @@ gst_qt_get_gl_display () if (QString::fromUtf8 ("android") == app->platformName()) display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (eglGetDisplay(EGL_DEFAULT_DISPLAY)); #elif GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS) - if (QString::fromUtf8("eglfs") == app->platformName()) + if (QString::fromUtf8("eglfs") == app->platformName()) { +#if GST_GL_HAVE_WINDOW_VIV_FB + /* FIXME: Could get the display directly from Qt like this + QPlatformNativeInterface *native = + QGuiApplication::platformNativeInterface(); + EGLDisplay egl_display = (EGLDisplay) + native->nativeResourceForWindow("egldisplay", NULL); + + However we seem to have no way for getting the EGLNativeDisplayType, aka + native_display, via public API. As such we have to assume that display 0 + is always used. Only way around that is parsing the index the same way as + Qt does in QEGLDeviceIntegration::fbDeviceName(), so let's do that. + */ + const gchar *fb_dev; + gint disp_idx = 0; + + fb_dev = g_getenv ("QT_QPA_EGLFS_FB"); + if (fb_dev) { + if (sscanf (fb_dev, "/dev/fb%d", &disp_idx) != 1) + disp_idx = 0; + } + + display = (GstGLDisplay *) gst_gl_display_viv_fb_new (disp_idx); +#else display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (eglGetDisplay(EGL_DEFAULT_DISPLAY)); #endif + } +#endif #if GST_GL_HAVE_WINDOW_COCOA && GST_GL_HAVE_PLATFORM_COCOA && defined (HAVE_QT_MAC) if (QString::fromUtf8 ("cocoa") == app->platformName()) @@ -130,7 +160,11 @@ gst_qt_get_gl_wrapcontext (GstGLDisplay * display, } #endif #if GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS) +#if GST_GL_HAVE_WINDOW_VIV_FB + if (GST_IS_GL_DISPLAY_VIV_FB (display)) { +#else if (GST_IS_GL_DISPLAY_EGL (display)) { +#endif platform = GST_GL_PLATFORM_EGL; } #endif -- 2.7.4