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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5020>
This commit is contained in:
Matthew Waters 2023-05-16 21:24:44 +10:00
parent ffb2e87fd4
commit a2d9584b27
6 changed files with 99 additions and 9 deletions

View file

@ -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)

View file

@ -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

View file

@ -0,0 +1,27 @@
/*
* GStreamer
* Copyright (C) 2023 Matthew Waters <matthew@centricular.com>
*
* 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 <gst/gl/gl.h>
#include <gst/gl/viv-fb/gstgldisplay_viv_fb.h>
#endif /* __GST_GL_VIV_FB_H__ */

View file

@ -44,7 +44,7 @@
#include <gst/gl/wayland/gstgldisplay_wayland.h>
#endif
#if GST_GL_HAVE_WINDOW_VIV_FB
#if GST_GL_HAVE_WINDOW_VIV_FB && defined (HAVE_QT_VIV_FB)
#include <gst/gl/viv-fb/gstgldisplay_viv_fb.h>
#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)) {

View file

@ -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 = {}

View file

@ -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')