From a2d9584b275c4e8588a00ec47662c509b8ed8cfa Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 16 May 2023 21:24:44 +1000 Subject: [PATCH] gl: provide a pkg-config/gir file for the viv-fb backend Required to be able to generate coherent bindings for window system specific APIs due to limitations in gobject-introspection. Part-of: --- subprojects/gst-plugins-bad/meson.build | 4 ++ .../gst-libs/gst/gl/meson.build | 55 +++++++++++++++++-- .../gst-libs/gst/gl/viv-fb/gstglviv-fb.h | 27 +++++++++ .../gst-plugins-good/ext/qt/gstqtglutility.cc | 6 +- .../gst-plugins-good/ext/qt/meson.build | 11 ++++ subprojects/gst-plugins-good/meson.build | 5 ++ 6 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 subprojects/gst-plugins-base/gst-libs/gst/gl/viv-fb/gstglviv-fb.h diff --git a/subprojects/gst-plugins-bad/meson.build b/subprojects/gst-plugins-bad/meson.build index 1c99983efc..c8355ac990 100644 --- a/subprojects/gst-plugins-bad/meson.build +++ b/subprojects/gst-plugins-bad/meson.build @@ -380,6 +380,10 @@ if gstgl_dep.found() gstglegl_dep = dependency('gstreamer-gl-egl-1.0', version : gst_req, fallback : ['gst-plugins-base', 'gstglegl_dep'], required: true) endif + if gst_gl_have_window_viv_fb + gstglviv_fb_dep = dependency('gstreamer-gl-viv-fb-1.0', version : gst_req, + fallback : ['gst-plugins-base', 'gstglviv_fb_dep'], required: true) + endif endif libm = cc.find_library('m', required : false) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/meson.build b/subprojects/gst-plugins-base/gst-libs/gst/gl/meson.build index 451a21c4d8..ebdab9089a 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/meson.build +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/meson.build @@ -3,6 +3,7 @@ gstglproto_dep = dependency('', required : false) gstglx11_dep = dependency('', required : false) gstglwayland_dep = dependency('', required : false) gstglegl_dep = dependency('', required : false) +gstglviv_fb_dep = dependency('', required : false) if get_option('gl').disabled() message('GStreamer OpenGL integration disabled via options.') @@ -115,6 +116,8 @@ gl_wayland_sources = [] gl_wayland_headers = [] gl_egl_sources = [] gl_egl_headers = [] +gl_viv_fb_sources = [] +gl_viv_fb_headers = [] glconf = configuration_data() glconf_options = [ @@ -930,15 +933,19 @@ if need_platform_egl != 'no' and need_win_viv_fb != 'no' if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep) enabled_gl_winsys += 'viv-fb' glconf.set('GST_GL_HAVE_WINDOW_VIV_FB', 1) - gl_priv_sources += [ + gl_priv_sources += files([ 'viv-fb/gstgldisplay_viv_fb.c', 'viv-fb/gstglwindow_viv_fb_egl.c', - ] + ]) + gl_viv_fb_sources += files([ + 'viv-fb/gstgldisplay_viv_fb.c', + ]) + gl_cpp_args += ['-DEGL_API_FB'] - gl_viv_fb_headers = [ + gl_viv_fb_headers = files([ + 'viv-fb/gstglviv-fb.h', 'viv-fb/gstgldisplay_viv_fb.h', - ] - install_headers(gl_viv_fb_headers, subdir : 'gstreamer-1.0/gst/gl/viv-fb') + ]) endif endif @@ -1060,7 +1067,7 @@ if build_gstgl common_args += '-I@0@'.format(meson.current_build_dir()) gstgl = library('gstgl-' + api_version, - gl_sources, gl_egl_sources, gl_x11_sources, gl_wayland_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h, + gl_sources, gl_egl_sources, gl_x11_sources, gl_wayland_sources, gl_viv_fb_sources, gl_priv_sources, gl_enumtypes_c, gl_enumtypes_h, c_args : common_args, cpp_args : common_args, objc_args : common_args + gl_objc_args, @@ -1249,6 +1256,42 @@ if build_gstgl meson.override_dependency(pkg_name, gstglegl_dep) endif + if gl_viv_fb_headers.length() > 0 + install_headers(gl_viv_fb_headers, subdir : 'gstreamer-1.0/gst/gl/viv-fb') + pkg_name = 'gstreamer-gl-viv-fb-1.0' + pkgconfig.generate( + libraries : [gstgl], + subdirs : pkgconfig_subdirs, + name : pkg_name, + description : 'Streaming media framework, OpenGL plugins libraries (Vivante Framebuffer specifics)', + ) + gl_viv_fb_gir = [] + if build_gir + gir = { + 'sources' : gl_viv_fb_sources + gl_viv_fb_headers, + 'namespace' : 'GstGLVivFB', + 'nsversion' : api_version, + 'identifier_prefix' : 'Gst', + 'symbol_prefix' : 'gst', + 'export_packages' : pkg_name, + 'includes' : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'], + 'install' : true, + 'extra_args' : gir_init_section + ['--c-include=gst/gl/viv-fb/gstglviv-fb.h'], + 'dependencies' : [video_dep, gst_dep, gst_base_dep] + } + gir_dict = gir + {'includes': gir['includes'] + ['GstGL-1.0']} + gst_libraries += [[pkg_name, {'gir': gir_dict}]] + if not static_build + gir += {'includes': gir['includes'] + [gl_gir[0]]} + gl_viv_fb_gir = gnome.generate_gir(gstgl, kwargs: gir) + library_def += {'gir_targets': library_def.get('gir_targets', []) + [gl_viv_fb_gir]} + endif + endif + gstglviv_fb_dep = declare_dependency(dependencies : [gstgl_dep], + sources : gl_viv_fb_gir) + meson.override_dependency(pkg_name, gstglviv_fb_dep) + endif + elif get_option('gl').enabled() error('GStreamer OpenGL integration required via options, but needed dependencies not found.') endif diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/viv-fb/gstglviv-fb.h b/subprojects/gst-plugins-base/gst-libs/gst/gl/viv-fb/gstglviv-fb.h new file mode 100644 index 0000000000..f897c0d691 --- /dev/null +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/viv-fb/gstglviv-fb.h @@ -0,0 +1,27 @@ +/* + * GStreamer + * Copyright (C) 2023 Matthew Waters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_GL_VIV_FB_H__ +#define __GST_GL_VIV_FB_H__ + +#include +#include + +#endif /* __GST_GL_VIV_FB_H__ */ diff --git a/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc b/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc index 84d5618967..a9d2f38fe3 100644 --- a/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc +++ b/subprojects/gst-plugins-good/ext/qt/gstqtglutility.cc @@ -44,7 +44,7 @@ #include #endif -#if GST_GL_HAVE_WINDOW_VIV_FB +#if GST_GL_HAVE_WINDOW_VIV_FB && defined (HAVE_QT_VIV_FB) #include #endif @@ -117,7 +117,7 @@ gst_qt_get_gl_display (gboolean sink) } #elif GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS) if (QString::fromUtf8("eglfs") == app->platformName()) { -#if GST_GL_HAVE_WINDOW_VIV_FB +#if GST_GL_HAVE_WINDOW_VIV_FB && defined (HAVE_QT_VIV_FB) /* FIXME: Could get the display directly from Qt like this * QPlatformNativeInterface *native = * QGuiApplication::platformNativeInterface(); @@ -202,7 +202,7 @@ 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_GL_HAVE_WINDOW_VIV_FB && defined (HAVE_QT_VIV_FB) if (GST_IS_GL_DISPLAY_VIV_FB (display)) { #else if (GST_IS_GL_DISPLAY_EGL (display)) { diff --git a/subprojects/gst-plugins-good/ext/qt/meson.build b/subprojects/gst-plugins-good/ext/qt/meson.build index 56f5161e2e..b17ff96f34 100644 --- a/subprojects/gst-plugins-good/ext/qt/meson.build +++ b/subprojects/gst-plugins-good/ext/qt/meson.build @@ -181,6 +181,17 @@ if host_system == 'ios' endif endif +# EGL windowing for Vivante Framebuffer (e.g. i.MX6) +qt5_viv_fb = qt5_egl \ + .require(host_system == 'linux') \ + .require(gstglviv_fb_dep.found(), error_message: 'gstreamer-gl-viv_fb-1.0 is required') \ + .require(gst_gl_have_platform_egl, error_message: 'egl platform support in gstreamer-gl is required') +if qt5_viv_fb.allowed() + qt_defines += ['-DHAVE_QT_VIV_FB'] + optional_deps += gstglviv_fb_dep + have_qt_windowing = true +endif + if qt5_option.require(have_qt_windowing).allowed() # rpath is needed to be able to load the plugin on macOS inside the devenv qmlgl_kwargs = {} diff --git a/subprojects/gst-plugins-good/meson.build b/subprojects/gst-plugins-good/meson.build index 5934183894..4ff3d658e7 100644 --- a/subprojects/gst-plugins-good/meson.build +++ b/subprojects/gst-plugins-good/meson.build @@ -321,6 +321,7 @@ gstglproto_dep = dependency('', required : false) gstglx11_dep = dependency('', required : false) gstglwayland_dep = dependency('', required : false) gstglegl_dep = dependency('', required : false) +gstglviv_fb_dep = dependency('', required : false) have_gstgl = gstgl_dep.found() @@ -370,6 +371,10 @@ if have_gstgl gstglegl_dep = dependency('gstreamer-gl-egl-1.0', version : gst_req, fallback : ['gst-plugins-base', 'gstglegl_dep'], required: true) endif + if gst_gl_have_window_viv_fb + gstglviv_fb_dep = dependency('gstreamer-gl-viv-fb-1.0', version : gst_req, + fallback : ['gst-plugins-base', 'gstglviv_fb_dep'], required: true) + endif endif zlib_dep = dependency('zlib')