diff options
author | Matthew Waters <matthew@centricular.com> | 2016-10-19 16:11:58 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2016-10-19 17:10:48 +1100 |
commit | c36ea6f56f69715a37a57dc977a3531c79c32b2d (patch) | |
tree | bf96690238940ea71cf6f8cc78e0c0b77fe6ce08 | |
parent | 0abeebc4e86a3b24041eb084381e960099c3a5b4 (diff) |
meson: gl: add support for building with dispmanx on the rpi
-rw-r--r-- | ext/gl/gstopengl.c | 5 | ||||
-rw-r--r-- | ext/gl/meson.build | 4 | ||||
-rw-r--r-- | gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h | 4 | ||||
-rw-r--r-- | gst-libs/gst/gl/egl/gstegl.h | 4 | ||||
-rw-r--r-- | gst-libs/gst/gl/meson.build | 53 | ||||
-rw-r--r-- | meson_options.txt | 3 |
6 files changed, 57 insertions, 16 deletions
diff --git a/ext/gl/gstopengl.c b/ext/gl/gstopengl.c index 9bd754d87..4a8c4d6a1 100644 --- a/ext/gl/gstopengl.c +++ b/ext/gl/gstopengl.c @@ -90,7 +90,7 @@ extern GType gst_ca_opengl_layer_sink_bin_get_type (void); #endif -#ifdef USE_EGL_RPI +#if GST_GL_HAVE_WINDOW_DISPMANX extern void bcm_host_init (void); #endif @@ -107,7 +107,7 @@ plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (gst_gl_gstgl_debug, "gstopengl", 0, "gstopengl"); -#ifdef USE_EGL_RPI +#if GST_GL_HAVE_WINDOW_DISPMANX GST_DEBUG ("Initialize BCM host"); bcm_host_init (); #endif @@ -236,7 +236,6 @@ plugin_init (GstPlugin * plugin) GST_RANK_NONE, GST_TYPE_GL_DEINTERLACE)) { return FALSE; } - #if HAVE_JPEG #if HAVE_PNG if (!gst_element_register (plugin, "gloverlay", diff --git a/ext/gl/meson.build b/ext/gl/meson.build index 7076880a9..a99b8c25f 100644 --- a/ext/gl/meson.build +++ b/ext/gl/meson.build @@ -97,6 +97,10 @@ if build_gstgl and gstgl_dep.found() optional_deps += x11_dep endif + if bcm_host_dep.found() + optional_deps += bcm_host_dep + endif + gstopengl = library('gstopengl', opengl_sources, c_args : gst_plugins_bad_args + opengl_defines, diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h index aa996e779..5680f0769 100644 --- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h +++ b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h @@ -25,7 +25,7 @@ #include <gst/gl/gl.h> #include <gst/gl/egl/gstegl.h> -#if defined (USE_EGL_RPI) && defined(__GNUC__) +#if defined(__GNUC__) #ifndef __VCCOREVER__ #define __VCCOREVER__ 0x04000000 #endif @@ -37,7 +37,7 @@ #include <bcm_host.h> -#if defined (USE_EGL_RPI) && defined(__GNUC__) +#if defined(__GNUC__) #pragma GCC reset_options #pragma GCC diagnostic pop #endif diff --git a/gst-libs/gst/gl/egl/gstegl.h b/gst-libs/gst/gl/egl/gstegl.h index 2a31f82da..d73658c96 100644 --- a/gst-libs/gst/gl/egl/gstegl.h +++ b/gst-libs/gst/gl/egl/gstegl.h @@ -23,7 +23,7 @@ #include <gst/gl/gstglconfig.h> -#if defined (USE_EGL_RPI) && defined(__GNUC__) +#if GST_GL_HAVE_WINDOW_DISPMANX && defined(__GNUC__) #ifndef __VCCOREVER__ #define __VCCOREVER__ 0x04000000 #endif @@ -41,7 +41,7 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#if defined (USE_EGL_RPI) && defined(__GNUC__) +#if GST_GL_HAVE_WINDOW_DISPMANX && defined(__GNUC__) #pragma GCC reset_options #pragma GCC diagnostic pop #endif diff --git a/gst-libs/gst/gl/meson.build b/gst-libs/gst/gl/meson.build index e8f599066..6d53d6b4b 100644 --- a/gst-libs/gst/gl/meson.build +++ b/gst-libs/gst/gl/meson.build @@ -105,12 +105,27 @@ gl_platform_deps = [] gl_winsys_deps = [] # other things we need. gl_misc_deps = [] +# Other preprocessor arguments +gl_cpp_args = ['-DGST_USE_UNSTABLE_API'] enabled_gl_apis = [] enabled_gl_platforms = [] enabled_gl_winsys = [] # parse provided options +libegl_module_name = get_option('with_egl_module_name') +if libegl_module_name != '' + gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)] +endif +libgles2_module_name = get_option('with_gles2_module_name') +if libgles2_module_name != '' + gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)] +endif +libgl_module_name = get_option('with_opengl_module_name') +if libgl_module_name != '' + gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)] +endif + gl_apis_s = get_option ('with_gl_api') if gl_apis_s == 'auto' need_api_opengl = 'auto' @@ -188,8 +203,8 @@ else # need_win_cocoa = 'yes' # elif winsys == 'eagl' # need_win_eagl = 'yes' -# elif winsys == 'dispmanx' -# need_win_dispmanx = 'yes' + elif winsys == 'dispmanx' + need_win_dispmanx = 'yes' else error('Unsupported GL winsys provided ' + winsys) endif @@ -210,7 +225,7 @@ gl_include_header = ''' gl_dep = unneeded_dep glx_dep = unneeded_dep if need_api_opengl != 'no' or need_platform_glx != 'no' - gl_dep = dependency('GL', required : false) + gl_dep = dependency('gl', required : false) if not gl_dep.found() # if host_machine.system() == 'windows' # gl_dep = cc.find_library('opengl32', required : false) @@ -253,7 +268,7 @@ endif # GLES2 checks gles2_dep = unneeded_dep if need_api_gles2 != 'no' - gles2_dep = dependency('GLESv2', required : false) + gles2_dep = dependency('glesv2', required : false) if not gles2_dep.found() # if host_machine.system() == 'windows' # elif host_machine.system() == 'darwin' @@ -328,7 +343,7 @@ endif # EGL checks egl_dep = unneeded_dep if need_platform_egl != 'no' - egl_dep = dependency('EGL', required : false) + egl_dep = dependency('egl', required : false) if not egl_dep.found() egl_dep = cc.find_library('EGL', required : false) @@ -446,6 +461,27 @@ if need_win_x11 != 'no' endif endif +bcm_host_dep = unneeded_dep +if need_win_dispmanx != 'no' + bcm_host_dep = dependency('bcm_host', required : false) + if bcm_host_dep.found() + if not egl_dep.found() + error('dispmanx requires the use of egl') + endif + + gl_sources += [ + 'dispmanx/gstglwindow_dispmanx_egl.c' + ] + + glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1) + gl_winsys_deps += bcm_host_dep + enabled_gl_winsys += 'dispmanx' + gl_cpp_args += ['-DUSE_EGL_RPI'] + elif need_win_dispmanx == 'yes' + error('Could not find dispmanx libraries') + endif +endif + # win32 checks if need_platform_wgl == 'yes' if need_win_win32 == 'no' @@ -477,8 +513,7 @@ if host_machine.system() == 'darwin' endif # TODO: Add rest of gl config here. -# --with-{egl,gles2,opengl}-module-name -# rpi, arm-mali, iOS, OS X, win32 specific support +# arm-mali, iOS, OS X, win32 specific support build_gstgl = true if gl_lib_deps.length() == 0 @@ -538,7 +573,7 @@ if build_gstgl gstgl = library('gstgl-' + api_version, gl_sources, - c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], + c_args : gst_plugins_bad_args + gl_cpp_args, include_directories : [configinc, libsinc], version : libversion, soversion : soversion, @@ -552,5 +587,5 @@ if build_gstgl gstgl_dep = declare_dependency(link_with : gstgl, include_directories : [libsinc], - dependencies : [gstbase_dep, gstvideo_dep]) + dependencies : [gstbase_dep, gstvideo_dep] + gl_winsys_deps) endif diff --git a/meson_options.txt b/meson_options.txt index a52b47573..ed97cda26 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,3 +2,6 @@ option('use_orc', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto option('with_gl_api', type : 'string', value : 'auto', description : 'A comma separated list of opengl APIs to enable building against. Supported values are opengl and gles2.') option('with_gl_platform', type : 'string', value : 'auto', description : 'A comma separated list of opengl platforms to enable building against. Supported values are glx, egl, cgl, wgl and eagl') option('with_gl_winsys', type : 'string', value : 'auto', description : 'A comma separated list of opengl windows systems to enable building against. Supported values are x11, wayland, win32, cocoa, and dispmanx') +option('with_egl_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libEGL.so library (default: libEGL.so)') +option('with_opengl_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libGL.so library (default: libGL.so)') +option('with_gles2_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libGLESv2.so library (default: libGLESv2.so)') |