From 25dd3b32e56f2acf8744baed6938fe701451ac8f Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 8 Apr 2019 21:35:22 +1000 Subject: [PATCH] vulkan: make a gstvulkan library out of the existing API --- configure.ac | 70 ------- ext/Makefile.am | 8 - ext/vulkan/.gitignore | 1 - ext/vulkan/Makefile.am | 77 -------- ext/vulkan/meson.build | 140 ++------------ ext/vulkan/vksink.c | 2 +- ext/vulkan/vksink.h | 3 +- ext/vulkan/vkswapper.c | 1 + ext/vulkan/vkswapper.h | 6 +- ext/vulkan/vktrash.c | 1 - ext/vulkan/vktrash.h | 10 +- ext/vulkan/vkupload.h | 2 +- ext/vulkan/vkutils.h | 42 ----- ext/vulkan/wayland/Makefile.am | 30 --- ext/vulkan/xcb/Makefile.am | 30 --- gst-libs/gst/meson.build | 1 + gst-libs/gst/vulkan/.gitignore | 1 + .../gst/vulkan/cocoa/gstvkcocoa_utils.h | 2 +- .../gst/vulkan/cocoa/gstvkdisplay_cocoa.h | 5 +- .../gst/vulkan/cocoa/gstvkdisplay_cocoa.m | 6 +- .../gst/vulkan/cocoa/gstvkwindow_cocoa.h | 2 +- .../gst/vulkan/cocoa/gstvkwindow_cocoa.m | 8 +- .../vkapi.h => gst-libs/gst/vulkan/gstvkapi.h | 13 +- .../gst/vulkan/gstvkbuffermemory.c | 2 +- .../gst/vulkan/gstvkbuffermemory.h | 13 +- .../gst/vulkan/gstvkbufferpool.c | 2 +- .../gst/vulkan/gstvkbufferpool.h | 11 +- .../gst/vulkan/gstvkconfig.h.meson | 0 .../gst/vulkan/gstvkdevice.c | 5 +- .../gst/vulkan/gstvkdevice.h | 22 ++- .../gst/vulkan/gstvkdisplay.c | 10 +- .../gst/vulkan/gstvkdisplay.h | 15 +- .../vkerror.c => gst-libs/gst/vulkan/gstvkerror.c | 2 +- .../vkerror.h => gst-libs/gst/vulkan/gstvkerror.h | 9 +- .../vkfence.c => gst-libs/gst/vulkan/gstvkfence.c | 3 +- .../vkfence.h => gst-libs/gst/vulkan/gstvkfence.h | 12 +- .../gst/vulkan/gstvkimagememory.c | 2 +- .../gst/vulkan/gstvkimagememory.h | 17 +- .../gst/vulkan/gstvkinstance.c | 3 +- .../gst/vulkan/gstvkinstance.h | 17 +- .../gst/vulkan/gstvkmacros.h | 8 +- .../gst/vulkan/gstvkmemory.c | 2 +- .../gst/vulkan/gstvkmemory.h | 11 +- .../vkqueue.c => gst-libs/gst/vulkan/gstvkqueue.c | 4 +- .../vkqueue.h => gst-libs/gst/vulkan/gstvkqueue.h | 14 +- .../vkutils.c => gst-libs/gst/vulkan/gstvkutils.c | 70 +++---- gst-libs/gst/vulkan/gstvkutils.h | 57 ++++++ .../gst/vulkan/gstvkwindow.c | 10 +- .../gst/vulkan/gstvkwindow.h | 13 +- .../gst/vulkan/ios/gstvkdisplay_ios.h | 5 +- .../gst/vulkan/ios/gstvkdisplay_ios.m | 4 +- .../gst/vulkan/ios/gstvkios_utils.h | 2 +- .../gst/vulkan/ios/gstvkwindow_ios.h | 4 +- .../gst/vulkan/ios/gstvkwindow_ios.m | 8 +- gst-libs/gst/vulkan/meson.build | 206 +++++++++++++++++++++ .../gst/vulkan/vulkan-prelude.h | 23 ++- ext/vulkan/vk.h => gst-libs/gst/vulkan/vulkan.h | 35 ++-- .../vk_fwd.h => gst-libs/gst/vulkan/vulkan_fwd.h | 12 +- .../gst/vulkan/wayland/gstvkdisplay_wayland.c | 3 +- .../gst/vulkan/wayland/gstvkdisplay_wayland.h | 9 +- .../gst/vulkan/wayland/gstvkwindow_wayland.c | 6 +- .../gst/vulkan/wayland/gstvkwindow_wayland.h | 6 +- .../gst}/vulkan/wayland/wayland_event_source.c | 2 + .../gst}/vulkan/wayland/wayland_event_source.h | 12 +- .../gst/vulkan/xcb/gstvkdisplay_xcb.c | 4 +- .../gst/vulkan/xcb/gstvkdisplay_xcb.h | 6 +- .../gst/vulkan/xcb/gstvkwindow_xcb.c | 4 +- .../gst/vulkan/xcb/gstvkwindow_xcb.h | 2 +- .../gst}/vulkan/xcb/xcb_event_source.c | 7 +- .../gst}/vulkan/xcb/xcb_event_source.h | 1 - pkgconfig/gstreamer-vulkan-uninstalled.pc.in | 12 ++ pkgconfig/gstreamer-vulkan.pc.in | 12 ++ pkgconfig/meson.build | 5 + 73 files changed, 613 insertions(+), 572 deletions(-) delete mode 100644 ext/vulkan/.gitignore delete mode 100644 ext/vulkan/Makefile.am delete mode 100644 ext/vulkan/vkutils.h delete mode 100644 ext/vulkan/wayland/Makefile.am delete mode 100644 ext/vulkan/xcb/Makefile.am create mode 100644 gst-libs/gst/vulkan/.gitignore rename ext/vulkan/cocoa/vkcocoa_utils.h => gst-libs/gst/vulkan/cocoa/gstvkcocoa_utils.h (98%) rename ext/vulkan/cocoa/vkdisplay_cocoa.h => gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h (96%) rename ext/vulkan/cocoa/vkdisplay_cocoa.m => gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.m (98%) rename ext/vulkan/cocoa/vkwindow_cocoa.h => gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h (98%) rename ext/vulkan/cocoa/vkwindow_cocoa.m => gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.m (98%) rename ext/vulkan/vkapi.h => gst-libs/gst/vulkan/gstvkapi.h (85%) rename ext/vulkan/vkbuffermemory.c => gst-libs/gst/vulkan/gstvkbuffermemory.c (99%) rename ext/vulkan/vkbuffermemory.h => gst-libs/gst/vulkan/gstvkbuffermemory.h (94%) rename ext/vulkan/vkbufferpool.c => gst-libs/gst/vulkan/gstvkbufferpool.c (99%) rename ext/vulkan/vkbufferpool.h => gst-libs/gst/vulkan/gstvkbufferpool.h (91%) rename ext/vulkan/vkconfig.h.meson => gst-libs/gst/vulkan/gstvkconfig.h.meson (100%) rename ext/vulkan/vkdevice.c => gst-libs/gst/vulkan/gstvkdevice.c (99%) rename ext/vulkan/vkdevice.h => gst-libs/gst/vulkan/gstvkdevice.h (93%) rename ext/vulkan/vkdisplay.c => gst-libs/gst/vulkan/gstvkdisplay.c (98%) rename ext/vulkan/vkdisplay.h => gst-libs/gst/vulkan/gstvkdisplay.h (95%) rename ext/vulkan/vkerror.c => gst-libs/gst/vulkan/gstvkerror.c (99%) rename ext/vulkan/vkerror.h => gst-libs/gst/vulkan/gstvkerror.h (88%) rename ext/vulkan/vkfence.c => gst-libs/gst/vulkan/gstvkfence.c (98%) rename ext/vulkan/vkfence.h => gst-libs/gst/vulkan/gstvkfence.h (90%) rename ext/vulkan/vkimagememory.c => gst-libs/gst/vulkan/gstvkimagememory.c (99%) rename ext/vulkan/vkimagememory.h => gst-libs/gst/vulkan/gstvkimagememory.h (94%) rename ext/vulkan/vkinstance.c => gst-libs/gst/vulkan/gstvkinstance.c (99%) rename ext/vulkan/vkinstance.h => gst-libs/gst/vulkan/gstvkinstance.h (92%) rename ext/vulkan/vkmacros.h => gst-libs/gst/vulkan/gstvkmacros.h (97%) rename ext/vulkan/vkmemory.c => gst-libs/gst/vulkan/gstvkmemory.c (99%) rename ext/vulkan/vkmemory.h => gst-libs/gst/vulkan/gstvkmemory.h (95%) rename ext/vulkan/vkqueue.c => gst-libs/gst/vulkan/gstvkqueue.c (98%) rename ext/vulkan/vkqueue.h => gst-libs/gst/vulkan/gstvkqueue.h (92%) rename ext/vulkan/vkutils.c => gst-libs/gst/vulkan/gstvkutils.c (96%) create mode 100644 gst-libs/gst/vulkan/gstvkutils.h rename ext/vulkan/vkwindow.c => gst-libs/gst/vulkan/gstvkwindow.c (98%) rename ext/vulkan/vkwindow.h => gst-libs/gst/vulkan/gstvkwindow.h (96%) rename ext/vulkan/ios/vkdisplay_ios.h => gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h (96%) rename ext/vulkan/ios/vkdisplay_ios.m => gst-libs/gst/vulkan/ios/gstvkdisplay_ios.m (97%) rename ext/vulkan/ios/vkios_utils.h => gst-libs/gst/vulkan/ios/gstvkios_utils.h (97%) rename ext/vulkan/ios/vkwindow_ios.h => gst-libs/gst/vulkan/ios/gstvkwindow_ios.h (96%) rename ext/vulkan/ios/vkwindow_ios.m => gst-libs/gst/vulkan/ios/gstvkwindow_ios.m (98%) create mode 100644 gst-libs/gst/vulkan/meson.build rename ext/vulkan/vkutils_private.h => gst-libs/gst/vulkan/vulkan-prelude.h (66%) rename ext/vulkan/vk.h => gst-libs/gst/vulkan/vulkan.h (58%) rename ext/vulkan/vk_fwd.h => gst-libs/gst/vulkan/vulkan_fwd.h (90%) rename ext/vulkan/wayland/vkdisplay_wayland.c => gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.c (99%) rename ext/vulkan/wayland/vkdisplay_wayland.h => gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h (96%) rename ext/vulkan/wayland/vkwindow_wayland.c => gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.c (99%) rename ext/vulkan/wayland/vkwindow_wayland.h => gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h (98%) rename {ext => gst-libs/gst}/vulkan/wayland/wayland_event_source.c (99%) rename {ext => gst-libs/gst}/vulkan/wayland/wayland_event_source.h (67%) rename ext/vulkan/xcb/vkdisplay_xcb.c => gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.c (98%) rename ext/vulkan/xcb/vkdisplay_xcb.h => gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h (97%) rename ext/vulkan/xcb/vkwindow_xcb.c => gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c (99%) rename ext/vulkan/xcb/vkwindow_xcb.h => gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h (98%) rename {ext => gst-libs/gst}/vulkan/xcb/xcb_event_source.c (98%) rename {ext => gst-libs/gst}/vulkan/xcb/xcb_event_source.h (97%) create mode 100644 pkgconfig/gstreamer-vulkan-uninstalled.pc.in create mode 100644 pkgconfig/gstreamer-vulkan.pc.in diff --git a/configure.ac b/configure.ac index c4ca1ec..ca8bddf 100644 --- a/configure.ac +++ b/configure.ac @@ -532,55 +532,6 @@ if test "x$HAVE_WINSOCK2_H" = "xyes"; then AC_SUBST(WINSOCK2_LIBS) fi -dnl Vulkan -PKG_CHECK_MODULES(XCB, xcb >= 1.10, GST_VULKAN_HAVE_WINDOW_XCB=1, GST_VULKAN_HAVE_WINDOW_XCB=0) -AM_CONDITIONAL(USE_XCB, test "x$GST_VULKAN_HAVE_WINDOW_XCB" = "x1") - -PKG_CHECK_MODULES(VULKAN_WAYLAND, wayland-client >= 1.4, GST_VULKAN_HAVE_WINDOW_WAYLAND=1, GST_VULKAN_HAVE_WINDOW_WAYLAND=0) -AM_CONDITIONAL(USE_WAYLAND, test "x$GST_VULKAN_HAVE_WINDOW_WAYLAND" = "x1") -VULKAN_CONFIG_DEFINES=" -#define GST_VULKAN_HAVE_WINDOW_XCB $GST_VULKAN_HAVE_WINDOW_XCB -#define GST_VULKAN_HAVE_WINDOW_WAYLAND $GST_VULKAN_HAVE_WINDOW_WAYLAND" - -AC_CONFIG_COMMANDS([ext/vulkan/vkconfig.h], [ - outfile=vkconfig.h-tmp - cat > $outfile <<\_______EOF -/* vkconfig.h - * - * This is a generated file. Please modify `configure.ac' - */ - -#ifndef __GST_VULKAN_CONFIG_H__ -#define __GST_VULKAN_CONFIG_H__ - -#include - -G_BEGIN_DECLS - -_______EOF - - cat >>$outfile <<_______EOF -$vulkan_config_defines -_______EOF - - cat >>$outfile <<_______EOF - -G_END_DECLS - -#endif /* __GST_VULKAN_CONFIG_H__ */ -_______EOF - - - if cmp -s $outfile ext/vulkan/vkconfig.h; then - AC_MSG_NOTICE([ext/vulkan/vkconfig.h is unchanged]) - rm -f $outfile - else - mv $outfile ext/vulkan/vkconfig.h - fi -],[ -vulkan_config_defines='$VULKAN_CONFIG_DEFINES' -]) - dnl *** sys plug-ins *** dnl DirectSound @@ -1974,23 +1925,6 @@ AG_GST_CHECK_FEATURE(GL, [gl elements], gl, [ AM_CONDITIONAL(USE_GL, test "x$HAVE_GL" = "xyes") AM_CONDITIONAL(USE_OPENGL, test "x$GST_GL_HAVE_API_GL" = "x1") -dnl *** Vulkan *** -translit(dnm, m, l) AM_CONDITIONAL(USE_VULKAN, true) -AG_GST_CHECK_FEATURE(VULKAN, [Vulkan elements], vulkan, [ - AC_CHECK_HEADER(vulkan/vulkan.h, [ - AC_CHECK_LIB(vulkan, vkCreateDevice, [ - VULKAN_LIBS="-lvulkan" - AC_SUBST(VULKAN_LIBS) - if test "x$GST_VULKAN_HAVE_WINDOW_XCB" = "x1"; then - HAVE_VULKAN="yes" - fi - if test "x$GST_VULKAN_HAVE_WINDOW_WAYLAND" = "x1"; then - HAVE_VULKAN="yes" - fi - ], []) - ], []) -]) - dnl *** teletextdec *** translit(dnm, m, l) AM_CONDITIONAL(USE_TELETEXTDEC, true) AG_GST_CHECK_FEATURE(TELETEXTDEC, [Teletext decoder], teletextdec, [ @@ -2397,7 +2331,6 @@ AM_CONDITIONAL(USE_WEBRTCDSP, false) AM_CONDITIONAL(USE_OPENH264, false) AM_CONDITIONAL(USE_X265, false) AM_CONDITIONAL(USE_DTLS, false) -AM_CONDITIONAL(USE_VULKAN, false) AM_CONDITIONAL(USE_TTML, false) AM_CONDITIONAL(USE_SCTP, false) @@ -2684,9 +2617,6 @@ ext/srtp/Makefile ext/teletextdec/Makefile ext/gme/Makefile ext/wildmidi/Makefile -ext/vulkan/Makefile -ext/vulkan/xcb/Makefile -ext/vulkan/wayland/Makefile ext/webp/Makefile ext/x265/Makefile ext/zbar/Makefile diff --git a/ext/Makefile.am b/ext/Makefile.am index 94d3bc4..9656ce7 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -370,12 +370,6 @@ else DTLS_DIR= endif -if USE_VULKAN -VULKAN_DIR=vulkan -else -VULKAN_DIR= -endif - if USE_WEBRTCDSP WEBRTCDSP_DIR=webrtcdsp else @@ -464,7 +458,6 @@ SUBDIRS=\ $(WEBP_DIR) \ $(X265_DIR) \ $(DTLS_DIR) \ - $(VULKAN_DIR) \ $(WEBRTCDSP_DIR) \ $(TTML_DIR) \ $(WEBRTC_DIR) \ @@ -531,7 +524,6 @@ DIST_SUBDIRS = \ webp \ x265 \ dtls \ - vulkan \ webrtcdsp \ ttml \ webrtc \ diff --git a/ext/vulkan/.gitignore b/ext/vulkan/.gitignore deleted file mode 100644 index dc690c8..0000000 --- a/ext/vulkan/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vkconfig.h diff --git a/ext/vulkan/Makefile.am b/ext/vulkan/Makefile.am deleted file mode 100644 index 5dee4ae..0000000 --- a/ext/vulkan/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -plugin_LTLIBRARIES = libgstvulkan.la - -SUBDIRS = -DIST_SUBDIRS = xcb wayland -DISTCLEANFILES = vkconfig.h - -libgstvulkan_la_SOURCES = \ - gstvulkan.c \ - vkdevice.c \ - vkdisplay.c \ - vkerror.c \ - vkfence.c \ - vkbuffermemory.c \ - vkimagememory.c \ - vkbufferpool.c \ - vkinstance.c \ - vkmemory.c \ - vkqueue.c \ - vktrash.c \ - vksink.c \ - vkswapper.c \ - vkupload.c \ - vkutils.c \ - vkwindow.c - -noinst_HEADERS = \ - vk.h \ - vkapi.h \ - vk_fwd.h \ - vkbuffermemory.h \ - vkbufferpool.h \ - vkconfig.h \ - vkdevice.h \ - vkdisplay.h \ - vkerror.h \ - vkfence.h \ - vkimagememory.h \ - vkinstance.h \ - vkmacros.h \ - vkmemory.h \ - vkqueue.h \ - vktrash.h \ - vksink.h \ - vkswapper.h \ - vkupload.h \ - vkutils.h \ - vkutils_private.h \ - vkwindow.h - -libgstvulkan_la_CFLAGS = \ - -I$(top_srcdir)/gst-libs \ - -I$(top_builddir)/gst-libs \ - -I$(top_builddir)/ext/vulkan \ - $(GST_CFLAGS) \ - $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) \ - $(VULKAN_CFLAGS) - -libgstvulkan_la_LIBADD = \ - $(GST_BASE_LIBS) \ - $(GST_PLUGINS_BASE_LIBS) \ - -lgstvideo-$(GST_API_VERSION) \ - $(VULKAN_LIBS) - -if USE_XCB -SUBDIRS += xcb -libgstvulkan_la_LIBADD += xcb/libgstvulkan-xcb.la -endif - -if USE_WAYLAND -SUBDIRS += wayland -libgstvulkan_la_LIBADD += wayland/libgstvulkan-wayland.la -endif - -libgstvulkan_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - - diff --git a/ext/vulkan/meson.build b/ext/vulkan/meson.build index 53960a9..351192b 100644 --- a/ext/vulkan/meson.build +++ b/ext/vulkan/meson.build @@ -1,132 +1,24 @@ +if get_option('vulkan').disabled() + subdir_done() +endif + vulkan_sources = [ 'gstvulkan.c', - 'vkbuffermemory.c', - 'vkbufferpool.c', - 'vkdevice.c', - 'vkdisplay.c', - 'vkerror.c', - 'vkfence.c', - 'vkimagememory.c', - 'vkinstance.c', - 'vkmemory.c', - 'vkqueue.c', 'vksink.c', 'vkswapper.c', 'vktrash.c', 'vkupload.c', - 'vkutils.c', - 'vkwindow.c', ] -vulkan_objc_args = [] -vulkan_defines = [] -optional_deps = [] -if get_option('vulkan').disabled() - subdir_done() -endif - -if host_system == 'ios' - vulkan_dep = cc.find_library('MoltenVK', required : get_option('vulkan')) -else - vulkan_dep = cc.find_library('vulkan', required : get_option('vulkan')) -endif -has_vulkan_header = cc.has_header('vulkan/vulkan.h') -if not has_vulkan_header and get_option('vulkan').enabled() - error('vulkan plugin enabled, but vulkan.h not found') -endif - -if vulkan_dep.found() and has_vulkan_header - have_vulkan_windowing = false - - vkconf = configuration_data() - - xcb_dep = dependency('xcb', version : '>=1.10', required : get_option('x11')) - if xcb_dep.found() - vulkan_sources += [ - 'xcb/vkdisplay_xcb.c', - 'xcb/vkwindow_xcb.c', - 'xcb/xcb_event_source.c', - ] - - optional_deps += xcb_dep - have_vulkan_windowing = true - vkconf.set10('GST_VULKAN_HAVE_WINDOW_XCB', 1) - endif - - wayland_client_dep = dependency('wayland-client', version : '>=1.4', required : get_option('wayland')) - if wayland_client_dep.found() - vulkan_sources += [ - 'wayland/vkdisplay_wayland.c', - 'wayland/vkwindow_wayland.c', - 'wayland/wayland_event_source.c', - ] - - optional_deps += wayland_client_dep - have_vulkan_windowing = true - vkconf.set10('GST_VULKAN_HAVE_WINDOW_WAYLAND', 1) - endif - - if ['darwin', 'ios'].contains(host_system) - objc = meson.get_compiler('objc') - if not objc.has_argument('-fobjc-arc') - error('ARC is required for building') - endif - - vulkan_objc_args += ['-fobjc-arc'] - - foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : get_option('vulkan')) - quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : get_option('vulkan')) - corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : get_option('vulkan')) - if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found() - optional_deps += [foundation_dep, corefoundation_dep, quartzcore_dep] - endif - endif - - if host_system == 'darwin' - cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : get_option('vulkan')) - - if cocoa_dep.found() - vulkan_sources += [ - 'cocoa/vkdisplay_cocoa.m', - 'cocoa/vkwindow_cocoa.m', - ] - optional_deps += [cocoa_dep] - have_vulkan_windowing = true - vkconf.set10('GST_VULKAN_HAVE_WINDOW_COCOA', 1) - endif - endif - - if host_system == 'ios' - uikit_dep = dependency('appleframeworks', modules : ['UIKit'], required : get_option('vulkan')) - - if uikit_dep.found() - vulkan_sources += [ - 'ios/vkdisplay_ios.m', - 'ios/vkwindow_ios.m', - ] - optional_deps += [uikit_dep] - have_vulkan_windowing = true - vkconf.set10('GST_VULKAN_HAVE_WINDOW_IOS', 1) - endif - endif - - if have_vulkan_windowing - configure_file(input : 'vkconfig.h.meson', - output : 'vkconfig.h', - configuration : vkconf) - - gstvulkan = library('gstvulkan', - vulkan_sources, - c_args : gst_plugins_bad_args + vulkan_defines, - objc_args : gst_plugins_bad_args + vulkan_defines + vulkan_objc_args, - link_args : noseh_link_args, - include_directories : [configinc], - dependencies : [gstvideo_dep, gstbase_dep, vulkan_dep] + optional_deps, - install : true, - install_dir : plugins_install_dir, - ) - pkgconfig.generate(gstvulkan, install_dir : plugins_pkgconfig_install_dir) - plugins += [gstvulkan] - endif -endif - +gstvulkan_plugin = library('gstvulkan', + vulkan_sources, + c_args : gst_plugins_bad_args, + objc_args : gst_plugins_bad_args, + link_args : noseh_link_args, + include_directories : [configinc], + dependencies : [gstvideo_dep, gstbase_dep, gstvulkan_dep, vulkan_dep], + install : true, + install_dir : plugins_install_dir, +) +pkgconfig.generate(gstvulkan_plugin, install_dir : plugins_pkgconfig_install_dir) +plugins += [gstvulkan_plugin] diff --git a/ext/vulkan/vksink.c b/ext/vulkan/vksink.c index ea141df..b95d644 100644 --- a/ext/vulkan/vksink.c +++ b/ext/vulkan/vksink.c @@ -33,7 +33,7 @@ //#include #include "vksink.h" -#include "vkdevice.h" +#include "vkswapper.h" GST_DEBUG_CATEGORY (gst_debug_vulkan_sink); #define GST_CAT_DEFAULT gst_debug_vulkan_sink diff --git a/ext/vulkan/vksink.h b/ext/vulkan/vksink.h index 294832f..ee7551e 100644 --- a/ext/vulkan/vksink.h +++ b/ext/vulkan/vksink.h @@ -24,7 +24,8 @@ #include #include #include -#include "vk.h" +#include +#include "vkswapper.h" G_BEGIN_DECLS diff --git a/ext/vulkan/vkswapper.c b/ext/vulkan/vkswapper.c index f576195..afbaf1d 100644 --- a/ext/vulkan/vkswapper.c +++ b/ext/vulkan/vkswapper.c @@ -25,6 +25,7 @@ #include #include "vkswapper.h" +#include "vktrash.h" #define GST_CAT_DEFAULT gst_vulkan_swapper_debug GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); diff --git a/ext/vulkan/vkswapper.h b/ext/vulkan/vkswapper.h index 0486036..cfb5c02 100644 --- a/ext/vulkan/vkswapper.h +++ b/ext/vulkan/vkswapper.h @@ -23,7 +23,7 @@ #include -#include +#include G_BEGIN_DECLS @@ -37,6 +37,10 @@ GType gst_vulkan_swapper_get_type (void); #define GST_VULKAN_SWAPPER_VIDEO_FORMATS " { RGBA, BGRA, RGB, BGR } " +typedef struct _GstVulkanSwapper GstVulkanSwapper; +typedef struct _GstVulkanSwapperClass GstVulkanSwapperClass; +typedef struct _GstVulkanSwapperPrivate GstVulkanSwapperPrivate; + struct _GstVulkanSwapper { GstObject parent; diff --git a/ext/vulkan/vktrash.c b/ext/vulkan/vktrash.c index 1c7d7f2..ade0abd 100644 --- a/ext/vulkan/vktrash.c +++ b/ext/vulkan/vktrash.c @@ -23,7 +23,6 @@ #endif #include "vktrash.h" -#include "vkutils_private.h" GST_DEBUG_CATEGORY (gst_debug_vulkan_trash); #define GST_CAT_DEFAULT gst_debug_vulkan_trash diff --git a/ext/vulkan/vktrash.h b/ext/vulkan/vktrash.h index 20cf05b..176cf6b 100644 --- a/ext/vulkan/vktrash.h +++ b/ext/vulkan/vktrash.h @@ -18,15 +18,17 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_TRASH_H_ -#define _VK_TRASH_H_ +#ifndef __GST_VULKAN_TRASH_H__ +#define __GST_VULKAN_TRASH_H__ -#include +#include G_BEGIN_DECLS typedef void (*GstVulkanTrashNotify) (GstVulkanDevice * device, gpointer user_data); +typedef struct _GstVulkanTrash GstVulkanTrash; + struct _GstVulkanTrash { GstVulkanFence *fence; @@ -50,4 +52,4 @@ gboolean gst_vulkan_trash_list_wait (GList * trash_l G_END_DECLS -#endif /* _VK_INSTANCE_H_ */ +#endif /* __GST_VULKAN_TRASH_H__ */ diff --git a/ext/vulkan/vkupload.h b/ext/vulkan/vkupload.h index 93792fd..11d65bc 100644 --- a/ext/vulkan/vkupload.h +++ b/ext/vulkan/vkupload.h @@ -23,7 +23,7 @@ #include #include -#include +#include G_BEGIN_DECLS diff --git a/ext/vulkan/vkutils.h b/ext/vulkan/vkutils.h deleted file mode 100644 index 04f6395..0000000 --- a/ext/vulkan/vkutils.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2015 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 _VK_UTILS_H_ -#define _VK_UTILS_H_ - -#include -#include - -G_BEGIN_DECLS - -gboolean gst_vulkan_ensure_element_data (gpointer element, - GstVulkanDisplay **display_ptr, GstVulkanInstance ** instance_ptr); -gboolean gst_vulkan_handle_set_context (GstElement * element, GstContext * context, - GstVulkanDisplay ** display, GstVulkanInstance ** instance); -gboolean gst_vulkan_handle_context_query (GstElement * element, GstQuery * query, - GstVulkanDisplay ** display, GstVulkanInstance ** instance, GstVulkanDevice ** device); - -void gst_vulkan_global_context_query (GstElement * element, const gchar * context_type); -GstQuery * gst_vulkan_local_context_query (GstElement * element, const gchar * context_type, gboolean set_context); -gboolean gst_vulkan_run_query (GstElement * element, - GstQuery * query, GstPadDirection direction); - -G_END_DECLS - -#endif /*_VK_UTILS_H_ */ diff --git a/ext/vulkan/wayland/Makefile.am b/ext/vulkan/wayland/Makefile.am deleted file mode 100644 index cd4b7fe..0000000 --- a/ext/vulkan/wayland/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -## Process this file with automake to produce Makefile.in - -noinst_LTLIBRARIES = libgstvulkan-wayland.la - -libgstvulkan_wayland_la_SOURCES = \ - vkdisplay_wayland.c \ - vkwindow_wayland.c \ - wayland_event_source.c - -noinst_HEADERS = \ - vkdisplay_wayland.h \ - vkwindow_wayland.h \ - wayland_event_source.h - -libgstvulkan_wayland_la_CFLAGS = \ - -I$(top_srcdir)/gst-libs \ - -I$(top_builddir)/ext/vulkan \ - -I$(top_srcdir)/ext/vulkan \ - -I$(top_builddir)/gst-libs \ - $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_BASE_CFLAGS) \ - $(GST_CFLAGS) \ - $(VULKAN_WAYLAND_CFLAGS) - -libgstvulkan_wayland_la_LIBADD = \ - $(VULKAN_WAYLAND_LIBS) - -libgstvulkan_wayland_la_LDFLAGS = \ - $(GST_LIB_LDFLAGS) \ - $(GST_ALL_LDFLAGS) diff --git a/ext/vulkan/xcb/Makefile.am b/ext/vulkan/xcb/Makefile.am deleted file mode 100644 index b510355..0000000 --- a/ext/vulkan/xcb/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -## Process this file with automake to produce Makefile.in - -noinst_LTLIBRARIES = libgstvulkan-xcb.la - -libgstvulkan_xcb_la_SOURCES = \ - vkdisplay_xcb.c \ - vkwindow_xcb.c \ - xcb_event_source.c - -noinst_HEADERS = \ - vkdisplay_xcb.h \ - vkwindow_xcb.h \ - xcb_event_source.h - -libgstvulkan_xcb_la_CFLAGS = \ - -I$(top_srcdir)/gst-libs \ - -I$(top_builddir)/ext/vulkan \ - -I$(top_srcdir)/ext/vulkan \ - -I$(top_builddir)/gst-libs \ - $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_BASE_CFLAGS) \ - $(GST_CFLAGS) \ - $(XCB_CFLAGS) - -libgstvulkan_xcb_la_LIBADD = \ - $(XCB_LIBS) - -libgstvulkan_xcb_la_LDFLAGS = \ - $(GST_LIB_LDFLAGS) \ - $(GST_ALL_LDFLAGS) diff --git a/gst-libs/gst/meson.build b/gst-libs/gst/meson.build index 5d90a91..daa1bda 100644 --- a/gst-libs/gst/meson.build +++ b/gst-libs/gst/meson.build @@ -11,5 +11,6 @@ subdir('mpegts') subdir('opencv') subdir('player') subdir('sctp') +subdir('vulkan') subdir('wayland') subdir('webrtc') diff --git a/gst-libs/gst/vulkan/.gitignore b/gst-libs/gst/vulkan/.gitignore new file mode 100644 index 0000000..32a7ac44 --- /dev/null +++ b/gst-libs/gst/vulkan/.gitignore @@ -0,0 +1 @@ +gstvkconfig.h diff --git a/ext/vulkan/cocoa/vkcocoa_utils.h b/gst-libs/gst/vulkan/cocoa/gstvkcocoa_utils.h similarity index 98% rename from ext/vulkan/cocoa/vkcocoa_utils.h rename to gst-libs/gst/vulkan/cocoa/gstvkcocoa_utils.h index 2007a36..a111fe2 100644 --- a/ext/vulkan/cocoa/vkcocoa_utils.h +++ b/gst-libs/gst/vulkan/cocoa/gstvkcocoa_utils.h @@ -24,7 +24,7 @@ #include #include -#include "vkwindow_cocoa.h" +#include "gstvkwindow_cocoa.h" G_BEGIN_DECLS diff --git a/ext/vulkan/cocoa/vkdisplay_cocoa.h b/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h similarity index 96% rename from ext/vulkan/cocoa/vkdisplay_cocoa.h rename to gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h index e3ab7c0..5486d78 100644 --- a/ext/vulkan/cocoa/vkdisplay_cocoa.h +++ b/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h @@ -1,6 +1,6 @@ /* * GStreamer - * Copyright (C) 2019 Matthew Waters + * Copyright (C) 2019 Matthew Waters * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,13 +23,14 @@ #include -#include #ifndef VK_USE_PLATFORM_MACOS_MVK #error "VK_USE_PLATFORM_MACOS_MVK not defined before including this header" #error "Either include vkapi.h or define VK_USE_PLATFORM_MACOS_MVK before including this header" #endif #include +#include + G_BEGIN_DECLS GType gst_vulkan_display_cocoa_get_type (void); diff --git a/ext/vulkan/cocoa/vkdisplay_cocoa.m b/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.m similarity index 98% rename from ext/vulkan/cocoa/vkdisplay_cocoa.m rename to gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.m index 4d84235..27519a6 100644 --- a/ext/vulkan/cocoa/vkdisplay_cocoa.m +++ b/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.m @@ -22,8 +22,10 @@ #include "config.h" #endif -#include "vkdisplay_cocoa.h" -#include "vkcocoa_utils.h" +#include + +#include "gstvkdisplay_cocoa.h" +#include "gstvkcocoa_utils.h" #define GST_CAT_DEFAULT gst_vulkan_display_debug GST_DEBUG_CATEGORY_STATIC (gst_vulkan_display_debug); diff --git a/ext/vulkan/cocoa/vkwindow_cocoa.h b/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h similarity index 98% rename from ext/vulkan/cocoa/vkwindow_cocoa.h rename to gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h index 0efa09f..4697570 100644 --- a/ext/vulkan/cocoa/vkwindow_cocoa.h +++ b/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h @@ -21,7 +21,7 @@ #ifndef __GST_VULKAN_WINDOW_COCOA_H__ #define __GST_VULKAN_WINDOW_COCOA_H__ -#include +#include G_BEGIN_DECLS diff --git a/ext/vulkan/cocoa/vkwindow_cocoa.m b/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.m similarity index 98% rename from ext/vulkan/cocoa/vkwindow_cocoa.m rename to gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.m index edfb1a1..b616c52 100644 --- a/ext/vulkan/cocoa/vkwindow_cocoa.m +++ b/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.m @@ -27,10 +27,12 @@ #include -#include "vkwindow_cocoa.h" -#include "vkdisplay_cocoa.h" +#include -#include "vkcocoa_utils.h" +#include "gstvkwindow_cocoa.h" +#include "gstvkdisplay_cocoa.h" + +#include "gstvkcocoa_utils.h" #define GST_VULKAN_WINDOW_COCOA_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_VULKAN_WINDOW_COCOA, GstVulkanWindowCocoaPrivate)) diff --git a/ext/vulkan/vkapi.h b/gst-libs/gst/vulkan/gstvkapi.h similarity index 85% rename from ext/vulkan/vkapi.h rename to gst-libs/gst/vulkan/gstvkapi.h index 0e67e08..99b99b1 100644 --- a/ext/vulkan/vkapi.h +++ b/gst-libs/gst/vulkan/gstvkapi.h @@ -18,14 +18,15 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_API_H_ -#define _VK_API_H_ +#ifndef __GST_VULKAN_API_H__ +#define __GST_VULKAN_API_H__ #define VK_PROTOTYPES -#include -#include "vk_fwd.h" -#include "vkmacros.h" +#include +#include +#include +#include /* Need these defined to have access to winsys functions before including vulkan.h */ #if GST_VULKAN_HAVE_WINDOW_XCB @@ -54,4 +55,4 @@ #include -#endif /* _VK_H_ */ +#endif /* __GST_VULKAN_API_H__ */ diff --git a/ext/vulkan/vkbuffermemory.c b/gst-libs/gst/vulkan/gstvkbuffermemory.c similarity index 99% rename from ext/vulkan/vkbuffermemory.c rename to gst-libs/gst/vulkan/gstvkbuffermemory.c index f06af82..0490c10 100644 --- a/ext/vulkan/vkbuffermemory.c +++ b/gst-libs/gst/vulkan/gstvkbuffermemory.c @@ -22,7 +22,7 @@ #include "config.h" #endif -#include "vkbuffermemory.h" +#include "gstvkbuffermemory.h" /** * SECTION:vkbuffermemory diff --git a/ext/vulkan/vkbuffermemory.h b/gst-libs/gst/vulkan/gstvkbuffermemory.h similarity index 94% rename from ext/vulkan/vkbuffermemory.h rename to gst-libs/gst/vulkan/gstvkbuffermemory.h index 3b58282..d00ba6f 100644 --- a/ext/vulkan/vkbuffermemory.h +++ b/gst-libs/gst/vulkan/gstvkbuffermemory.h @@ -18,18 +18,19 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_BUFFER_MEMORY_H_ -#define _VK_BUFFER_MEMORY_H_ +#ifndef __GST_VULKAN_BUFFER_MEMORY_H__ +#define __GST_VULKAN_BUFFER_MEMORY_H__ #include #include #include -#include +#include G_BEGIN_DECLS #define GST_TYPE_VULKAN_BUFFER_MEMORY_ALLOCATOR (gst_vulkan_buffer_memory_allocator_get_type()) +GST_VULKAN_API GType gst_vulkan_buffer_memory_allocator_get_type(void); #define GST_IS_VULKAN_BUFFER_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VULKAN_BUFFER_MEMORY_ALLOCATOR)) @@ -81,15 +82,19 @@ struct _GstVulkanBufferMemoryAllocatorClass GstAllocatorClass parent_class; }; +GST_VULKAN_API void gst_vulkan_buffer_memory_init_once (void); +GST_VULKAN_API gboolean gst_is_vulkan_buffer_memory (GstMemory * mem); +GST_VULKAN_API GstMemory * gst_vulkan_buffer_memory_alloc (GstVulkanDevice * device, VkFormat format, gsize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags mem_prop_flags); +GST_VULKAN_API GstMemory * gst_vulkan_buffer_memory_wrapped (GstVulkanDevice * device, VkBuffer buffer, VkFormat format, @@ -99,4 +104,4 @@ GstMemory * gst_vulkan_buffer_memory_wrapped (GstVulkanDevice * devi G_END_DECLS -#endif /* _VK_BUFFER_MEMORY_H_ */ +#endif /* __GST_VULKAN_BUFFER_MEMORY_H__ */ diff --git a/ext/vulkan/vkbufferpool.c b/gst-libs/gst/vulkan/gstvkbufferpool.c similarity index 99% rename from ext/vulkan/vkbufferpool.c rename to gst-libs/gst/vulkan/gstvkbufferpool.c index c8b61d7..86acb34 100644 --- a/ext/vulkan/vkbufferpool.c +++ b/gst-libs/gst/vulkan/gstvkbufferpool.c @@ -22,7 +22,7 @@ #include "config.h" #endif -#include "vkbufferpool.h" +#include "gstvkbufferpool.h" /** * SECTION:vkbufferpool diff --git a/ext/vulkan/vkbufferpool.h b/gst-libs/gst/vulkan/gstvkbufferpool.h similarity index 91% rename from ext/vulkan/vkbufferpool.h rename to gst-libs/gst/vulkan/gstvkbufferpool.h index 5dd4baf..eb24f82 100644 --- a/ext/vulkan/vkbufferpool.h +++ b/gst-libs/gst/vulkan/gstvkbufferpool.h @@ -18,18 +18,18 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GST_VULKAN_BUFFER_POOL_H_ -#define _GST_VULKAN_BUFFER_POOL_H_ +#ifndef __GST_VULKAN_BUFFER_POOL_H__ +#define __GST_VULKAN_BUFFER_POOL_H__ #include #include #include -#include +#include G_BEGIN_DECLS -/* buffer pool functions */ +GST_VULKAN_API GType gst_vulkan_buffer_pool_get_type (void); #define GST_TYPE_VULKAN_BUFFER_POOL (gst_vulkan_buffer_pool_get_type()) #define GST_IS_VULKAN_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VULKAN_BUFFER_POOL)) @@ -60,8 +60,9 @@ struct _GstVulkanBufferPoolClass GstBufferPoolClass parent_class; }; +GST_VULKAN_API GstBufferPool *gst_vulkan_buffer_pool_new (GstVulkanDevice * device); G_END_DECLS -#endif /* _GST_VULKAN_BUFFER_POOL_H_ */ +#endif /* __GST_VULKAN_BUFFER_POOL_H__ */ diff --git a/ext/vulkan/vkconfig.h.meson b/gst-libs/gst/vulkan/gstvkconfig.h.meson similarity index 100% rename from ext/vulkan/vkconfig.h.meson rename to gst-libs/gst/vulkan/gstvkconfig.h.meson diff --git a/ext/vulkan/vkdevice.c b/gst-libs/gst/vulkan/gstvkdevice.c similarity index 99% rename from ext/vulkan/vkdevice.c rename to gst-libs/gst/vulkan/gstvkdevice.c index c997b89..d0d7161 100644 --- a/ext/vulkan/vkdevice.c +++ b/gst-libs/gst/vulkan/gstvkdevice.c @@ -22,8 +22,7 @@ #include "config.h" #endif -#include "vkdevice.h" -#include "vkutils_private.h" +#include "gstvkdevice.h" #include @@ -512,7 +511,7 @@ gst_vulkan_device_run_context_query (GstElement * element, if ((query = gst_vulkan_local_context_query (element, - GST_VULKAN_DEVICE_CONTEXT_TYPE_STR, FALSE))) { + GST_VULKAN_DEVICE_CONTEXT_TYPE_STR))) { GstContext *context; gst_query_parse_context (query, &context); diff --git a/ext/vulkan/vkdevice.h b/gst-libs/gst/vulkan/gstvkdevice.h similarity index 93% rename from ext/vulkan/vkdevice.h rename to gst-libs/gst/vulkan/gstvkdevice.h index b2b1065..018eebb 100644 --- a/ext/vulkan/vkdevice.h +++ b/gst-libs/gst/vulkan/gstvkdevice.h @@ -18,11 +18,12 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_DEVICE_H_ -#define _VK_DEVICE_H_ +#ifndef __GST_VULKAN_DEVICE_H__ +#define __GST_VULKAN_DEVICE_H__ #include -#include "vk.h" + +#include G_BEGIN_DECLS @@ -32,6 +33,7 @@ G_BEGIN_DECLS #define GST_IS_VULKAN_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_DEVICE)) #define GST_IS_VULKAN_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_DEVICE)) #define GST_VULKAN_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_DEVICE, GstVulkanDeviceClass)) +GST_VULKAN_API GType gst_vulkan_device_get_type (void); #define GST_VULKAN_DEVICE_CONTEXT_TYPE_STR "gst.vulkan.device" @@ -66,34 +68,46 @@ struct _GstVulkanDeviceClass GstObjectClass parent_class; }; +GST_VULKAN_API GstVulkanDevice * gst_vulkan_device_new (GstVulkanInstance * instance); +GST_VULKAN_API GstVulkanInstance * gst_vulkan_device_get_instance (GstVulkanDevice * device); +GST_VULKAN_API gboolean gst_vulkan_device_open (GstVulkanDevice * device, GError ** error); +GST_VULKAN_API gpointer gst_vulkan_device_get_proc_address (GstVulkanDevice * device, const gchar * name); +GST_VULKAN_API void gst_vulkan_device_foreach_queue (GstVulkanDevice * device, GstVulkanDeviceForEachQueueFunc func, gpointer user_data); +GST_VULKAN_API GstVulkanQueue * gst_vulkan_device_get_queue (GstVulkanDevice * device, guint32 queue_family, guint32 queue_i); +GST_VULKAN_API VkPhysicalDevice gst_vulkan_device_get_physical_device (GstVulkanDevice * device); +GST_VULKAN_API gboolean gst_vulkan_device_create_cmd_buffer (GstVulkanDevice * device, VkCommandBuffer * cmd, GError ** error); +GST_VULKAN_API void gst_context_set_vulkan_device (GstContext * context, GstVulkanDevice * device); +GST_VULKAN_API gboolean gst_context_get_vulkan_device (GstContext * context, GstVulkanDevice ** device); +GST_VULKAN_API gboolean gst_vulkan_device_handle_context_query (GstElement * element, GstQuery * query, GstVulkanDevice ** device); +GST_VULKAN_API gboolean gst_vulkan_device_run_context_query (GstElement * element, GstVulkanDevice ** device); G_END_DECLS -#endif /* _VK_DEVICE_H_ */ +#endif /* __GST_VULKAN_DEVICE_H__ */ diff --git a/ext/vulkan/vkdisplay.c b/gst-libs/gst/vulkan/gstvkdisplay.c similarity index 98% rename from ext/vulkan/vkdisplay.c rename to gst-libs/gst/vulkan/gstvkdisplay.c index a01321e..89468b4 100644 --- a/ext/vulkan/vkdisplay.c +++ b/gst-libs/gst/vulkan/gstvkdisplay.c @@ -25,19 +25,19 @@ #include "config.h" #endif -#include "vkdisplay.h" +#include "gstvkdisplay.h" #if GST_VULKAN_HAVE_WINDOW_XCB -#include "xcb/vkdisplay_xcb.h" +#include "xcb/gstvkdisplay_xcb.h" #endif #if GST_VULKAN_HAVE_WINDOW_WAYLAND -#include "wayland/vkdisplay_wayland.h" +#include "wayland/gstvkdisplay_wayland.h" #endif #if GST_VULKAN_HAVE_WINDOW_COCOA -#include "cocoa/vkdisplay_cocoa.h" +#include "cocoa/gstvkdisplay_cocoa.h" #endif #if GST_VULKAN_HAVE_WINDOW_IOS -#include "ios/vkdisplay_ios.h" +#include "ios/gstvkdisplay_ios.h" #endif GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT); diff --git a/ext/vulkan/vkdisplay.h b/gst-libs/gst/vulkan/gstvkdisplay.h similarity index 95% rename from ext/vulkan/vkdisplay.h rename to gst-libs/gst/vulkan/gstvkdisplay.h index c223c46..5fe9179 100644 --- a/ext/vulkan/vkdisplay.h +++ b/gst-libs/gst/vulkan/gstvkdisplay.h @@ -26,7 +26,7 @@ #include -#include +#include G_BEGIN_DECLS @@ -37,6 +37,7 @@ G_BEGIN_DECLS #define GST_IS_VULKAN_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VULKAN_DISPLAY)) #define GST_VULKAN_DISPLAY_CAST(obj) ((GstVulkanDisplay*)(obj)) #define GST_VULKAN_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_DISPLAY, GstVulkanDisplayClass)) +GST_VULKAN_API GType gst_vulkan_display_get_type (void); #define GST_VULKAN_DISPLAY_CONTEXT_TYPE_STR "gst.vulkan.display" @@ -85,28 +86,40 @@ struct _GstVulkanDisplayClass GstVulkanWindow * (*create_window) (GstVulkanDisplay * display); }; +GST_VULKAN_API GstVulkanDisplay * gst_vulkan_display_new (GstVulkanInstance *instance); +GST_VULKAN_API GstVulkanDisplay * gst_vulkan_display_new_with_type (GstVulkanInstance *instance, GstVulkanDisplayType type); +GST_VULKAN_API GstVulkanDisplayType gst_vulkan_display_choose_type (GstVulkanInstance *instance); +GST_VULKAN_API const gchar * gst_vulkan_display_type_to_extension_string (GstVulkanDisplayType type); +GST_VULKAN_API gpointer gst_vulkan_display_get_handle (GstVulkanDisplay * display); +GST_VULKAN_API GstVulkanDisplayType gst_vulkan_display_get_handle_type (GstVulkanDisplay * display); +GST_VULKAN_API GstVulkanWindow * gst_vulkan_display_create_window (GstVulkanDisplay * display); +GST_VULKAN_API gboolean gst_context_get_vulkan_display (GstContext * context, GstVulkanDisplay ** display); +GST_VULKAN_API void gst_context_set_vulkan_display (GstContext * context, GstVulkanDisplay * display); +GST_VULKAN_API gboolean gst_vulkan_display_handle_context_query (GstElement * element, GstQuery * query, GstVulkanDisplay ** display); +GST_VULKAN_API gboolean gst_vulkan_display_run_context_query (GstElement * element, GstVulkanDisplay ** display); /* GstVulkanWindow usage only */ +GST_VULKAN_API gboolean gst_vulkan_display_remove_window (GstVulkanDisplay * display, GstVulkanWindow * window); diff --git a/ext/vulkan/vkerror.c b/gst-libs/gst/vulkan/gstvkerror.c similarity index 99% rename from ext/vulkan/vkerror.c rename to gst-libs/gst/vulkan/gstvkerror.c index 3fec27e..2e22bc7 100644 --- a/ext/vulkan/vkerror.c +++ b/gst-libs/gst/vulkan/gstvkerror.c @@ -24,7 +24,7 @@ #include -#include "vkerror.h" +#include "gstvkerror.h" /* *INDENT-OFF* */ static const struct diff --git a/ext/vulkan/vkerror.h b/gst-libs/gst/vulkan/gstvkerror.h similarity index 88% rename from ext/vulkan/vkerror.h rename to gst-libs/gst/vulkan/gstvkerror.h index de99c71..f48d1bc 100644 --- a/ext/vulkan/vkerror.h +++ b/gst-libs/gst/vulkan/gstvkerror.h @@ -18,15 +18,17 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_ERROR_H_ -#define _VK_ERROR_H_ +#ifndef __GST_VULKAN_ERROR_H__ +#define __GST_VULKAN_ERROR_H__ #include #include +#include G_BEGIN_DECLS #define GST_VULKAN_ERROR (gst_vulkan_error_quark ()) +GST_VULKAN_API GQuark gst_vulkan_error_quark (void); /* custom error values */ @@ -36,8 +38,9 @@ typedef enum } GstVulkanError; /* only fills error iff error != NULL and result < 0 */ +GST_VULKAN_API VkResult gst_vulkan_error_to_g_error (VkResult result, GError ** error, const char * format, ...) G_GNUC_PRINTF (3, 4); G_END_DECLS -#endif /* _VK_INSTANCE_H_ */ +#endif /* __GST_VULKAN_ERROR_H__ */ diff --git a/ext/vulkan/vkfence.c b/gst-libs/gst/vulkan/gstvkfence.c similarity index 98% rename from ext/vulkan/vkfence.c rename to gst-libs/gst/vulkan/gstvkfence.c index ff7b47a..d39e1f0 100644 --- a/ext/vulkan/vkfence.c +++ b/gst-libs/gst/vulkan/gstvkfence.c @@ -22,8 +22,7 @@ #include "config.h" #endif -#include "vkfence.h" -#include "vkutils_private.h" +#include "gstvkfence.h" GST_DEBUG_CATEGORY (gst_debug_vulkan_fence); #define GST_CAT_DEFAULT gst_debug_vulkan_fence diff --git a/ext/vulkan/vkfence.h b/gst-libs/gst/vulkan/gstvkfence.h similarity index 90% rename from ext/vulkan/vkfence.h rename to gst-libs/gst/vulkan/gstvkfence.h index c101073..f67903a 100644 --- a/ext/vulkan/vkfence.h +++ b/gst-libs/gst/vulkan/gstvkfence.h @@ -18,12 +18,13 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_FENCE_H_ -#define _VK_FENCE_H_ +#ifndef __GST_VULKAN_FENCE_H__ +#define __GST_VULKAN_FENCE_H__ -#include +#include #define GST_TYPE_VULKAN_FENCE (gst_vulkan_fence_get_type ()) +GST_VULKAN_API GType gst_vulkan_fence_get_type (void); #define GST_VULKAN_FENCE_CAST(f) ((GstVulkanFence *) f) @@ -40,10 +41,13 @@ struct _GstVulkanFence VkFence fence; }; +GST_VULKAN_API GstVulkanFence * gst_vulkan_fence_new (GstVulkanDevice * device, VkFenceCreateFlags flags, GError ** error); +GST_VULKAN_API GstVulkanFence * gst_vulkan_fence_wait (GstVulkanFence * fence); +GST_VULKAN_API gboolean gst_vulkan_fence_is_signaled (GstVulkanFence * fence); static inline GstVulkanFence * @@ -60,4 +64,4 @@ gst_vulkan_fence_unref (GstVulkanFence * fence) G_END_DECLS -#endif /* _VK_FENCE_H_ */ +#endif /* __GST_VULKAN_FENCE_H__ */ diff --git a/ext/vulkan/vkimagememory.c b/gst-libs/gst/vulkan/gstvkimagememory.c similarity index 99% rename from ext/vulkan/vkimagememory.c rename to gst-libs/gst/vulkan/gstvkimagememory.c index 1bf56b7..27e7b68 100644 --- a/ext/vulkan/vkimagememory.c +++ b/gst-libs/gst/vulkan/gstvkimagememory.c @@ -22,7 +22,7 @@ #include "config.h" #endif -#include "vkimagememory.h" +#include "gstvkimagememory.h" /** * SECTION:vkimagememory diff --git a/ext/vulkan/vkimagememory.h b/gst-libs/gst/vulkan/gstvkimagememory.h similarity index 94% rename from ext/vulkan/vkimagememory.h rename to gst-libs/gst/vulkan/gstvkimagememory.h index aa6cad6..208918f 100644 --- a/ext/vulkan/vkimagememory.h +++ b/gst-libs/gst/vulkan/gstvkimagememory.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_IMAGE_MEMORY_H_ -#define _VK_IMAGE_MEMORY_H_ +#ifndef __GST_VULKAN_IMAGE_MEMORY_H__ +#define __GST_VULKAN_IMAGE_MEMORY_H__ #include #include @@ -27,11 +27,12 @@ #include -#include +#include G_BEGIN_DECLS #define GST_TYPE_VULKAN_IMAGE_MEMORY_ALLOCATOR (gst_vulkan_image_memory_allocator_get_type()) +GST_VULKAN_API GType gst_vulkan_image_memory_allocator_get_type(void); #define GST_IS_VULKAN_IMAGE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VULKAN_IMAGE_MEMORY_ALLOCATOR)) @@ -86,9 +87,12 @@ struct _GstVulkanImageMemoryAllocatorClass GstAllocatorClass parent_class; }; +GST_VULKAN_API void gst_vulkan_image_memory_init_once (void); +GST_VULKAN_API gboolean gst_is_vulkan_image_memory (GstMemory * mem); +GST_VULKAN_API GstMemory * gst_vulkan_image_memory_alloc (GstVulkanDevice * device, VkFormat format, gsize width, @@ -97,6 +101,7 @@ GstMemory * gst_vulkan_image_memory_alloc (GstVulkanDevice * devic VkImageUsageFlags usage, VkMemoryPropertyFlags mem_prop_flags); +GST_VULKAN_API GstMemory * gst_vulkan_image_memory_wrapped (GstVulkanDevice * device, VkImage image, VkFormat format, @@ -107,16 +112,20 @@ GstMemory * gst_vulkan_image_memory_wrapped (GstVulkanDevice * devic gpointer user_data, GDestroyNotify notify); +GST_VULKAN_API gboolean gst_vulkan_image_memory_set_layout (GstVulkanImageMemory * vk_mem, VkImageLayout, VkImageMemoryBarrier * barrier); +GST_VULKAN_API guint32 gst_vulkan_image_memory_get_width (GstVulkanImageMemory * image); +GST_VULKAN_API guint32 gst_vulkan_image_memory_get_height (GstVulkanImageMemory * image); +GST_VULKAN_API VkFormat gst_vulkan_format_from_video_format (GstVideoFormat v_format, guint plane); G_END_DECLS -#endif /* _VK_IMAGE_MEMORY_H_ */ +#endif /* __GST_VULKAN_IMAGE_MEMORY_H__ */ diff --git a/ext/vulkan/vkinstance.c b/gst-libs/gst/vulkan/gstvkinstance.c similarity index 99% rename from ext/vulkan/vkinstance.c rename to gst-libs/gst/vulkan/gstvkinstance.c index b06c6ae..16b03ba 100644 --- a/ext/vulkan/vkinstance.c +++ b/gst-libs/gst/vulkan/gstvkinstance.c @@ -22,8 +22,7 @@ #include "config.h" #endif -#include "vkinstance.h" -#include "vkutils_private.h" +#include "gstvkinstance.h" #include diff --git a/ext/vulkan/vkinstance.h b/gst-libs/gst/vulkan/gstvkinstance.h similarity index 92% rename from ext/vulkan/vkinstance.h rename to gst-libs/gst/vulkan/gstvkinstance.h index e7d8e49..8a6860d 100644 --- a/ext/vulkan/vkinstance.h +++ b/gst-libs/gst/vulkan/gstvkinstance.h @@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_INSTANCE_H_ -#define _VK_INSTANCE_H_ +#ifndef __GST_VULKAN_INSTANCE_H__ +#define __GST_VULKAN_INSTANCE_H__ -#include +#include G_BEGIN_DECLS @@ -31,6 +31,7 @@ G_BEGIN_DECLS #define GST_IS_VULKAN_INSTANCE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_INSTANCE)) #define GST_IS_VULKAN_INSTANCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_INSTANCE)) #define GST_VULKAN_INSTANCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstanceClass)) +GST_VULKAN_API GType gst_vulkan_instance_get_type (void); #define GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR "gst.vulkan.instance" @@ -56,26 +57,34 @@ struct _GstVulkanInstanceClass GstObjectClass parent_class; }; +GST_VULKAN_API GstVulkanInstance * gst_vulkan_instance_new (void); +GST_VULKAN_API gboolean gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error); +GST_VULKAN_API gpointer gst_vulkan_instance_get_proc_address (GstVulkanInstance * instance, const gchar * name); +GST_VULKAN_API GstVulkanDevice * gst_vulkan_instance_create_device (GstVulkanInstance * instance, GError ** error); +GST_VULKAN_API void gst_context_set_vulkan_instance (GstContext * context, GstVulkanInstance * instance); +GST_VULKAN_API gboolean gst_context_get_vulkan_instance (GstContext * context, GstVulkanInstance ** instance); +GST_VULKAN_API gboolean gst_vulkan_instance_handle_context_query (GstElement * element, GstQuery * query, GstVulkanInstance ** instance); +GST_VULKAN_API gboolean gst_vulkan_instance_run_context_query (GstElement * element, GstVulkanInstance ** instance); G_END_DECLS -#endif /* _VK_INSTANCE_H_ */ +#endif /* __GST_VULKAN_INSTANCE_H__ */ diff --git a/ext/vulkan/vkmacros.h b/gst-libs/gst/vulkan/gstvkmacros.h similarity index 97% rename from ext/vulkan/vkmacros.h rename to gst-libs/gst/vulkan/gstvkmacros.h index 2a74f51..e554532 100644 --- a/ext/vulkan/vkmacros.h +++ b/gst-libs/gst/vulkan/gstvkmacros.h @@ -17,11 +17,11 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#ifndef _VK_MACROS_H_ -#define _VK_MACROS_H_ +#ifndef __GST_VULKAN_MACROS_H__ +#define __GST_VULKAN_MACROS_H__ #include -#include +#include G_BEGIN_DECLS @@ -121,4 +121,4 @@ G_BEGIN_DECLS G_END_DECLS -#endif /*_VK_MACROS_H_ */ +#endif /*__GST_VULKAN_MACROS_H__ */ diff --git a/ext/vulkan/vkmemory.c b/gst-libs/gst/vulkan/gstvkmemory.c similarity index 99% rename from ext/vulkan/vkmemory.c rename to gst-libs/gst/vulkan/gstvkmemory.c index f426043..b81a551 100644 --- a/ext/vulkan/vkmemory.c +++ b/gst-libs/gst/vulkan/gstvkmemory.c @@ -24,7 +24,7 @@ #include -#include "vkmemory.h" +#include "gstvkmemory.h" /** * SECTION:vkmemory diff --git a/ext/vulkan/vkmemory.h b/gst-libs/gst/vulkan/gstvkmemory.h similarity index 95% rename from ext/vulkan/vkmemory.h rename to gst-libs/gst/vulkan/gstvkmemory.h index db552a6..d219186 100644 --- a/ext/vulkan/vkmemory.h +++ b/gst-libs/gst/vulkan/gstvkmemory.h @@ -18,18 +18,19 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GST_VULKAN_BASE_BUFFER_H_ -#define _GST_VULKAN_BASE_BUFFER_H_ +#ifndef __GST_VULKAN_BASE_BUFFER_H__ +#define __GST_VULKAN_BASE_BUFFER_H__ #include #include #include -#include +#include G_BEGIN_DECLS #define GST_TYPE_VULKAN_MEMORY_ALLOCATOR (gst_vulkan_memory_allocator_get_type()) +GST_VULKAN_API GType gst_vulkan_memory_allocator_get_type(void); #define GST_IS_VULKAN_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VULKAN_MEMORY_ALLOCATOR)) @@ -87,15 +88,19 @@ struct _GstVulkanMemoryAllocatorClass GstAllocatorClass parent_class; }; +GST_VULKAN_API void gst_vulkan_memory_init_once (void); +GST_VULKAN_API gboolean gst_is_vulkan_memory (GstMemory * mem); +GST_VULKAN_API GstMemory * gst_vulkan_memory_alloc (GstVulkanDevice * device, guint32 memory_type_index, GstAllocationParams * params, gsize size, VkMemoryPropertyFlags mem_prop_flags); +GST_VULKAN_API gboolean gst_vulkan_memory_find_memory_type_index_with_type_properties (GstVulkanDevice * device, guint32 typeBits, VkMemoryPropertyFlags properties, diff --git a/ext/vulkan/vkqueue.c b/gst-libs/gst/vulkan/gstvkqueue.c similarity index 98% rename from ext/vulkan/vkqueue.c rename to gst-libs/gst/vulkan/gstvkqueue.c index 7984fbf..a1f86c0 100644 --- a/ext/vulkan/vkqueue.c +++ b/gst-libs/gst/vulkan/gstvkqueue.c @@ -22,7 +22,7 @@ #include "config.h" #endif -#include "vkqueue.h" +#include "gstvkqueue.h" #define GST_CAT_DEFAULT gst_vulkan_queue_debug GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); @@ -168,7 +168,7 @@ gst_vulkan_queue_run_context_query (GstElement * element, if ((query = gst_vulkan_local_context_query (element, - GST_VULKAN_QUEUE_CONTEXT_TYPE_STR, FALSE))) { + GST_VULKAN_QUEUE_CONTEXT_TYPE_STR))) { GstContext *context; gst_query_parse_context (query, &context); diff --git a/ext/vulkan/vkqueue.h b/gst-libs/gst/vulkan/gstvkqueue.h similarity index 92% rename from ext/vulkan/vkqueue.h rename to gst-libs/gst/vulkan/gstvkqueue.h index 04b1313..c001bc8 100644 --- a/ext/vulkan/vkqueue.h +++ b/gst-libs/gst/vulkan/gstvkqueue.h @@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_QUEUE_H_ -#define _VK_QUEUE_H_ +#ifndef __GST_VULKAN_QUEUE_H__ +#define __GST_VULKAN_QUEUE_H__ -#include "vk.h" +#include #define GST_TYPE_VULKAN_QUEUE (gst_vulkan_queue_get_type()) #define GST_VULKAN_QUEUE(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_QUEUE, GstVulkanQueue)) @@ -29,6 +29,7 @@ #define GST_IS_VULKAN_QUEUE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_QUEUE)) #define GST_IS_VULKAN_QUEUE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_QUEUE)) #define GST_VULKAN_QUEUE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_QUEUE, GstVulkanQueueClass)) +GST_VULKAN_API GType gst_vulkan_queue_get_type (void); #define GST_VULKAN_QUEUE_CONTEXT_TYPE_STR "gst.vulkan.queue" @@ -49,16 +50,21 @@ struct _GstVulkanQueueClass GstObjectClass parent_class; }; +GST_VULKAN_API GstVulkanDevice * gst_vulkan_queue_get_device (GstVulkanQueue * queue); +GST_VULKAN_API void gst_context_set_vulkan_queue (GstContext * context, GstVulkanQueue * queue); +GST_VULKAN_API gboolean gst_context_get_vulkan_queue (GstContext * context, GstVulkanQueue ** queue); +GST_VULKAN_API gboolean gst_vulkan_queue_handle_context_query (GstElement * element, GstQuery * query, GstVulkanQueue ** queue); +GST_VULKAN_API gboolean gst_vulkan_queue_run_context_query (GstElement * element, GstVulkanQueue ** queue); -#endif /* _VK_QUEUE_H_ */ +#endif /* __GST_VULKAN_QUEUE_H__ */ diff --git a/ext/vulkan/vkutils.c b/gst-libs/gst/vulkan/gstvkutils.c similarity index 96% rename from ext/vulkan/vkutils.c rename to gst-libs/gst/vulkan/gstvkutils.c index a202575..426bcdc 100644 --- a/ext/vulkan/vkutils.c +++ b/gst-libs/gst/vulkan/gstvkutils.c @@ -22,8 +22,7 @@ #include "config.h" #endif -#include "vkutils.h" -#include "vkutils_private.h" +#include "gstvkutils.h" GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT); @@ -85,6 +84,40 @@ gst_vulkan_run_query (GstElement * element, GstQuery * query, return g_value_get_boolean (&res); } +static GstQuery * +_vulkan_local_context_query (GstElement * element, + const gchar * context_type, gboolean set_context) +{ + GstQuery *query; + GstContext *ctxt; + + _init_context_debug (); + + /* 2a) Query downstream with GST_QUERY_CONTEXT for the context and + * check if downstream already has a context of the specific type + * 2b) Query upstream as above. + */ + query = gst_query_new_context (context_type); + if (gst_vulkan_run_query (element, query, GST_PAD_SRC)) { + gst_query_parse_context (query, &ctxt); + GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, + "found context (%p) in downstream query", ctxt); + if (set_context) + gst_element_set_context (element, ctxt); + } else if (gst_vulkan_run_query (element, query, GST_PAD_SINK)) { + gst_query_parse_context (query, &ctxt); + GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, + "found context (%p) in upstream query", ctxt); + if (set_context) + gst_element_set_context (element, ctxt); + } else { + gst_query_unref (query); + query = NULL; + } + + return query; +} + void gst_vulkan_global_context_query (GstElement * element, const gchar * context_type) @@ -92,7 +125,7 @@ gst_vulkan_global_context_query (GstElement * element, GstQuery *query; GstMessage *msg; - if ((query = gst_vulkan_local_context_query (element, context_type, TRUE))) { + if ((query = _vulkan_local_context_query (element, context_type, TRUE))) { gst_query_unref (query); return; } @@ -117,36 +150,9 @@ gst_vulkan_global_context_query (GstElement * element, GstQuery * gst_vulkan_local_context_query (GstElement * element, - const gchar * context_type, gboolean set_context) + const gchar * context_type) { - GstQuery *query; - GstContext *ctxt; - - _init_context_debug (); - - /* 2a) Query downstream with GST_QUERY_CONTEXT for the context and - * check if downstream already has a context of the specific type - * 2b) Query upstream as above. - */ - query = gst_query_new_context (context_type); - if (gst_vulkan_run_query (element, query, GST_PAD_SRC)) { - gst_query_parse_context (query, &ctxt); - GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, - "found context (%p) in downstream query", ctxt); - if (set_context) - gst_element_set_context (element, ctxt); - } else if (gst_vulkan_run_query (element, query, GST_PAD_SINK)) { - gst_query_parse_context (query, &ctxt); - GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, - "found context (%p) in upstream query", ctxt); - if (set_context) - gst_element_set_context (element, ctxt); - } else { - gst_query_unref (query); - query = NULL; - } - - return query; + return _vulkan_local_context_query (element, context_type, FALSE); } static void diff --git a/gst-libs/gst/vulkan/gstvkutils.h b/gst-libs/gst/vulkan/gstvkutils.h new file mode 100644 index 0000000..c1a954f --- /dev/null +++ b/gst-libs/gst/vulkan/gstvkutils.h @@ -0,0 +1,57 @@ +/* + * GStreamer + * Copyright (C) 2015 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 _VK_UTILS_H_ +#define _VK_UTILS_H_ + +#include +#include + +G_BEGIN_DECLS + +GST_VULKAN_API +gboolean gst_vulkan_ensure_element_data (gpointer element, + GstVulkanDisplay ** display_ptr, + GstVulkanInstance ** instance_ptr); +GST_VULKAN_API +gboolean gst_vulkan_handle_set_context (GstElement * element, + GstContext * context, + GstVulkanDisplay ** display, + GstVulkanInstance ** instance); +GST_VULKAN_API +gboolean gst_vulkan_handle_context_query (GstElement * element, + GstQuery * query, + GstVulkanDisplay ** display, + GstVulkanInstance ** instance, + GstVulkanDevice ** device); + +GST_VULKAN_API +void gst_vulkan_global_context_query (GstElement * element, + const gchar * context_type); +GST_VULKAN_API +GstQuery * gst_vulkan_local_context_query (GstElement * element, + const gchar * context_type); +GST_VULKAN_API +gboolean gst_vulkan_run_query (GstElement * element, + GstQuery * query, + GstPadDirection direction); + +G_END_DECLS + +#endif /*_VK_UTILS_H_ */ diff --git a/ext/vulkan/vkwindow.c b/gst-libs/gst/vulkan/gstvkwindow.c similarity index 98% rename from ext/vulkan/vkwindow.c rename to gst-libs/gst/vulkan/gstvkwindow.c index 2a7fcb0..f5b8456 100644 --- a/ext/vulkan/vkwindow.c +++ b/gst-libs/gst/vulkan/gstvkwindow.c @@ -35,19 +35,19 @@ #include #include -#include "vkwindow.h" +#include "gstvkwindow.h" #if GST_VULKAN_HAVE_WINDOW_XCB -#include "xcb/vkwindow_xcb.h" +#include "xcb/gstvkwindow_xcb.h" #endif #if GST_VULKAN_HAVE_WINDOW_WAYLAND -#include "wayland/vkwindow_wayland.h" +#include "wayland/gstvkwindow_wayland.h" #endif #if GST_VULKAN_HAVE_WINDOW_COCOA -#include "cocoa/vkwindow_cocoa.h" +#include "cocoa/gstvkwindow_cocoa.h" #endif #if GST_VULKAN_HAVE_WINDOW_IOS -#include "ios/vkwindow_ios.h" +#include "ios/gstvkwindow_ios.h" #endif #define GST_CAT_DEFAULT gst_vulkan_window_debug diff --git a/ext/vulkan/vkwindow.h b/gst-libs/gst/vulkan/gstvkwindow.h similarity index 96% rename from ext/vulkan/vkwindow.h rename to gst-libs/gst/vulkan/gstvkwindow.h index ff25f9f..cebd2f6 100644 --- a/ext/vulkan/vkwindow.h +++ b/gst-libs/gst/vulkan/gstvkwindow.h @@ -24,7 +24,7 @@ #include -#include +#include G_BEGIN_DECLS @@ -34,6 +34,7 @@ G_BEGIN_DECLS #define GST_IS_VULKAN_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_WINDOW)) #define GST_IS_VULKAN_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_WINDOW)) #define GST_VULKAN_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_WINDOW, GstVulkanWindowClass)) +GST_VULKAN_API GType gst_vulkan_window_get_type (void); #define GST_VULKAN_WINDOW_LOCK(w) g_mutex_lock(&GST_VULKAN_WINDOW(w)->lock) @@ -41,6 +42,7 @@ GType gst_vulkan_window_get_type (void); #define GST_VULKAN_WINDOW_GET_LOCK(w) (&GST_VULKAN_WINDOW(w)->lock) #define GST_VULKAN_WINDOW_ERROR (gst_vulkan_window_error_quark ()) +GST_VULKAN_API GQuark gst_vulkan_window_error_quark (void); typedef enum @@ -94,24 +96,33 @@ struct _GstVulkanWindowClass { gpointer _reserved[GST_PADDING]; }; +GST_VULKAN_API GstVulkanWindow * gst_vulkan_window_new (GstVulkanDisplay *display); +GST_VULKAN_API GstVulkanDisplay * gst_vulkan_window_get_display (GstVulkanWindow *window); +GST_VULKAN_API VkSurfaceKHR gst_vulkan_window_get_surface (GstVulkanWindow *window, GError **error); +GST_VULKAN_API gboolean gst_vulkan_window_get_presentation_support (GstVulkanWindow *window, GstVulkanDevice *device, guint32 queue_family_idx); +GST_VULKAN_API void gst_vulkan_window_set_window_handle (GstVulkanWindow *window, guintptr handle); +GST_VULKAN_API gboolean gst_vulkan_window_open (GstVulkanWindow *window, GError ** error); +GST_VULKAN_API void gst_vulkan_window_close (GstVulkanWindow *window); +GST_VULKAN_API void gst_vulkan_window_resize (GstVulkanWindow *window, gint width, gint height); +GST_VULKAN_API void gst_vulkan_window_redraw (GstVulkanWindow *window); G_END_DECLS diff --git a/ext/vulkan/ios/vkdisplay_ios.h b/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h similarity index 96% rename from ext/vulkan/ios/vkdisplay_ios.h rename to gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h index 0cbdbc8..393274d 100644 --- a/ext/vulkan/ios/vkdisplay_ios.h +++ b/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h @@ -1,6 +1,6 @@ /* * GStreamer - * Copyright (C) 2019 Matthew Waters + * Copyright (C) 2019 Matthew Waters * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,13 +23,14 @@ #include -#include #ifndef VK_USE_PLATFORM_IOS_MVK #error "VK_USE_PLATFORM_IOS_MVK not defined before including this header" #error "Either include vkapi.h or define VK_USE_PLATFORM_IOS_MVK before including this header" #endif #include +#include + G_BEGIN_DECLS GType gst_vulkan_display_ios_get_type (void); diff --git a/ext/vulkan/ios/vkdisplay_ios.m b/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.m similarity index 97% rename from ext/vulkan/ios/vkdisplay_ios.m rename to gst-libs/gst/vulkan/ios/gstvkdisplay_ios.m index 64c4400..0bd3ff7 100644 --- a/ext/vulkan/ios/vkdisplay_ios.m +++ b/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.m @@ -24,7 +24,9 @@ #include -#include "vkdisplay_ios.h" +#include + +#include "gstvkdisplay_ios.h" #define GST_CAT_DEFAULT gst_vulkan_display_debug GST_DEBUG_CATEGORY_STATIC (gst_vulkan_display_debug); diff --git a/ext/vulkan/ios/vkios_utils.h b/gst-libs/gst/vulkan/ios/gstvkios_utils.h similarity index 97% rename from ext/vulkan/ios/vkios_utils.h rename to gst-libs/gst/vulkan/ios/gstvkios_utils.h index e7bac24e..a0df1ae 100644 --- a/ext/vulkan/ios/vkios_utils.h +++ b/gst-libs/gst/vulkan/ios/gstvkios_utils.h @@ -24,7 +24,7 @@ #include #include -#include "vkwindow_ios.h" +#include "gstvkwindow_ios.h" G_BEGIN_DECLS diff --git a/ext/vulkan/ios/vkwindow_ios.h b/gst-libs/gst/vulkan/ios/gstvkwindow_ios.h similarity index 96% rename from ext/vulkan/ios/vkwindow_ios.h rename to gst-libs/gst/vulkan/ios/gstvkwindow_ios.h index d652b26..be95c84 100644 --- a/ext/vulkan/ios/vkwindow_ios.h +++ b/gst-libs/gst/vulkan/ios/gstvkwindow_ios.h @@ -1,6 +1,6 @@ /* * GStreamer - * Copyright (C) 2019 Matthew Waters + * Copyright (C) 2019 Matthew Waters * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,7 +21,7 @@ #ifndef __GST_VULKAN_WINDOW_IOS_H__ #define __GST_VULKAN_WINDOW_IOS_H__ -#include +#include G_BEGIN_DECLS diff --git a/ext/vulkan/ios/vkwindow_ios.m b/gst-libs/gst/vulkan/ios/gstvkwindow_ios.m similarity index 98% rename from ext/vulkan/ios/vkwindow_ios.m rename to gst-libs/gst/vulkan/ios/gstvkwindow_ios.m index a6de9a2..a391ab5 100644 --- a/ext/vulkan/ios/vkwindow_ios.m +++ b/gst-libs/gst/vulkan/ios/gstvkwindow_ios.m @@ -26,10 +26,12 @@ #include -#include "vkwindow_ios.h" -#include "vkdisplay_ios.h" +#include -#include "vkios_utils.h" +#include "gstvkwindow_ios.h" +#include "gstvkdisplay_ios.h" + +#include "gstvkios_utils.h" #define GST_VULKAN_WINDOW_IOS_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_VULKAN_WINDOW_IOS, GstVulkanWindowIosPrivate)) diff --git a/gst-libs/gst/vulkan/meson.build b/gst-libs/gst/vulkan/meson.build new file mode 100644 index 0000000..cb28fc7 --- /dev/null +++ b/gst-libs/gst/vulkan/meson.build @@ -0,0 +1,206 @@ +if get_option('vulkan').disabled() + gstvulkan_dep = dependency('', required: false) + subdir_done() +endif + +vulkan_sources = [ + 'gstvkbuffermemory.c', + 'gstvkbufferpool.c', + 'gstvkdevice.c', + 'gstvkdisplay.c', + 'gstvkerror.c', + 'gstvkfence.c', + 'gstvkimagememory.c', + 'gstvkinstance.c', + 'gstvkmemory.c', + 'gstvkqueue.c', + 'gstvkutils.c', + 'gstvkwindow.c', +] + +vulkan_headers = [ + 'gstvkbuffermemory.h', + 'gstvkbufferpool.h', + 'gstvkdevice.h', + 'gstvkdisplay.h', + 'gstvkerror.h', + 'gstvkfence.h', + 'gstvkimagememory.h', + 'gstvkinstance.h', + 'gstvkmemory.h', + 'gstvkqueue.h', + 'gstvkutils.h', + 'gstvkwindow.h', + 'vulkan-prelude.h', + 'vulkan.h', +] + +vulkan_xcb_headers = [] +vulkan_wayland_headers = [] + +vulkan_windowing = false +vulkan_objc_args = [] +vulkan_defines = [] +optional_deps = [] + +vulkan_conf = configuration_data() +vulkan_conf_options = [ + 'GST_VULKAN_HAVE_WINDOW_XCB', + 'GST_VULKAN_HAVE_WINDOW_WAYLAND', + 'GST_VULKAN_HAVE_WINDOW_COCOA', + 'GST_VULKAN_HAVE_WINDOW_IOS', +] + +foreach option : vulkan_conf_options + vulkan_conf.set10(option, false) +endforeach + +if host_system == 'ios' + vulkan_dep = cc.find_library('MoltenVK', required : get_option('vulkan')) +else + vulkan_dep = cc.find_library('vulkan', required : get_option('vulkan')) +endif +has_vulkan_header = cc.has_header('vulkan/vulkan.h') +if not has_vulkan_header and get_option('vulkan').enabled() + error('vulkan plugin enabled, but vulkan.h not found') +endif + +xcb_dep = dependency('xcb', version : '>=1.10', required : get_option('x11')) +if xcb_dep.found() + vulkan_sources += [ + 'xcb/gstvkdisplay_xcb.c', + 'xcb/gstvkwindow_xcb.c', + 'xcb/xcb_event_source.c', + ] + vulkan_xcb_headers += [ + 'xcb/gstvkdisplay_xcb.h' + ] + + optional_deps += xcb_dep + vulkan_windowing = true + vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_XCB', 1) + endif + +wayland_client_dep = dependency('wayland-client', version : '>=1.4', required : get_option('wayland')) +if wayland_client_dep.found() + vulkan_sources += [ + 'wayland/gstvkdisplay_wayland.c', + 'wayland/gstvkwindow_wayland.c', + 'wayland/wayland_event_source.c', + ] + vulkan_wayland_headers += [ + 'wayland/gstvkdisplay_wayland.h' + ] + + optional_deps += wayland_client_dep + vulkan_windowing = true + vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_WAYLAND', 1) +endif + +if ['darwin', 'ios'].contains(host_system) + objc = meson.get_compiler('objc') + if not objc.has_argument('-fobjc-arc') + error('ARC is required for building') + endif + + vulkan_objc_args += ['-fobjc-arc'] + + foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : get_option('vulkan')) + quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : get_option('vulkan')) + corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : get_option('vulkan')) + if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found() + optional_deps += [foundation_dep, corefoundation_dep, quartzcore_dep] + endif +endif + +if host_system == 'darwin' + cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : get_option('vulkan')) + + if cocoa_dep.found() + vulkan_sources += [ + 'cocoa/gstvkdisplay_cocoa.m', + 'cocoa/gstvkwindow_cocoa.m', + ] + optional_deps += [cocoa_dep] + vulkan_windowing = true + vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_COCOA', 1) + endif +endif + +if host_system == 'ios' + uikit_dep = dependency('appleframeworks', modules : ['UIKit'], required : get_option('vulkan')) + + if uikit_dep.found() + vulkan_sources += [ + 'ios/gstvkdisplay_ios.m', + 'ios/gstvkwindow_ios.m', + ] + optional_deps += [uikit_dep] + vulkan_windowing = true + vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_IOS', 1) + endif +endif + +if not vulkan_windowing + warning('No Windowing system found. vulkansink will not work') +endif + +if vulkan_dep.found() and has_vulkan_header + gen_sources = [] + + install_headers(vulkan_headers, subdir : 'gstreamer-1.0/gst/vulkan') + install_headers(vulkan_xcb_headers, subdir : 'gstreamer-1.0/gst/vulkan/xcb') + install_headers(vulkan_wayland_headers, subdir : 'gstreamer-1.0/gst/vulkan/wayland') + + configure_file(input : 'gstvkconfig.h.meson', + output : 'gstvkconfig.h', + install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan'), + configuration : vulkan_conf) + + vulkan_enums = gnome.mkenums_simple('vulkan-enumtypes', + sources : vulkan_headers, + body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif', + header_prefix : '#include ', + decorator : 'GST_VULKAN_API', + install_header: true, + install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan')) + vulkan_enumtypes_c = vulkan_enums[0] + vulkan_enumtypes_h = vulkan_enums[1] + gen_sources += [vulkan_enumtypes_h] + + gstvulkan = library('gstvulkan-' + api_version, + vulkan_sources, vulkan_enumtypes_c, vulkan_enumtypes_h, + c_args : gst_plugins_bad_args + vulkan_defines + ['-DBUILDING_GST_VULKAN'], + objc_args : gst_plugins_bad_args + vulkan_defines + vulkan_objc_args + ['-DBUILDING_GST_VULKAN'], + include_directories : [configinc, libsinc], + version : libversion, + soversion : soversion, + darwin_versions : osxversion, + install : true, + dependencies : [gstbase_dep, gstvideo_dep, vulkan_dep] + optional_deps) + + if build_gir + vulkan_gir = gnome.generate_gir(gstvulkan, + sources : vulkan_sources + [vulkan_enumtypes_h, vulkan_enumtypes_c], + namespace : 'GstVulkan', + nsversion : api_version, + identifier_prefix : 'Gst', + symbol_prefix : 'gst', + export_packages : 'gstreamer-vulkan-1.0', + includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'], + install : true, + extra_args : gir_init_section + ['--c-include=gst/vulkan/vulkan.h'], + dependencies : [gstvideo_dep, gst_dep, gstbase_dep] + optional_deps + ) + gen_sources += vulkan_gir + endif + + gstvulkan_dep = declare_dependency(link_with : gstvulkan, + include_directories : [libsinc], + sources: gen_sources, + dependencies : [gstvideo_dep, gstbase_dep] + optional_deps) +elif get_option('vulkan').enabled() + error('GStreamer Vulkan integration required via options, but needed dependencies not found.') +else + gstvulkan_dep = dependency('', required : false) +endif diff --git a/ext/vulkan/vkutils_private.h b/gst-libs/gst/vulkan/vulkan-prelude.h similarity index 66% rename from ext/vulkan/vkutils_private.h rename to gst-libs/gst/vulkan/vulkan-prelude.h index d861d29..18c8a91 100644 --- a/ext/vulkan/vkutils_private.h +++ b/gst-libs/gst/vulkan/vulkan-prelude.h @@ -1,6 +1,7 @@ -/* - * GStreamer - * Copyright (C) 2015 Matthew Waters +/* GStreamer Vulkan Library + * Copyright (C) 2019 GStreamer developers + * + * vulkan-prelude.h: prelude include header for gst-vulkan library * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -17,14 +18,16 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#ifndef _VK_UTILS_PRIVATE_H_ -#define _VK_UTILS_PRIVATE_H_ -#include -#include "vk.h" +#ifndef __GST_VULKAN_PRELUDE_H__ +#define __GST_VULKAN_PRELUDE_H__ -G_BEGIN_DECLS +#include -G_END_DECLS +#ifdef BUILDING_GST_VULKAN +#define GST_VULKAN_API GST_API_EXPORT /* from config.h */ +#else +#define GST_VULKAN_API GST_API_IMPORT +#endif -#endif /*_VK_UTILS_H_ */ +#endif /* __GST_VULKAN_PRELUDE_H__ */ diff --git a/ext/vulkan/vk.h b/gst-libs/gst/vulkan/vulkan.h similarity index 58% rename from ext/vulkan/vk.h rename to gst-libs/gst/vulkan/vulkan.h index d50f2cc..aaeb315 100644 --- a/ext/vulkan/vk.h +++ b/gst-libs/gst/vulkan/vulkan.h @@ -18,26 +18,25 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_H_ -#define _VK_H_ +#ifndef __GST_VULKAN_H__ +#define __GST_VULKAN_H__ #include -#include "vkapi.h" +#include +#include -#include "vkerror.h" -#include "vkinstance.h" -#include "vkdevice.h" -#include "vkqueue.h" -#include "vkfence.h" -#include "vktrash.h" -#include "vkdisplay.h" -#include "vkwindow.h" -#include "vkswapper.h" -#include "vkmemory.h" -#include "vkbuffermemory.h" -#include "vkimagememory.h" -#include "vkbufferpool.h" -#include "vkutils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#endif /* _VK_H_ */ +#endif /* __GST_VULKAN_H__ */ diff --git a/ext/vulkan/vk_fwd.h b/gst-libs/gst/vulkan/vulkan_fwd.h similarity index 90% rename from ext/vulkan/vk_fwd.h rename to gst-libs/gst/vulkan/vulkan_fwd.h index c861833..4ccdbf4 100644 --- a/ext/vulkan/vk_fwd.h +++ b/gst-libs/gst/vulkan/vulkan_fwd.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _VK_FWD_H_ -#define _VK_FWD_H_ +#ifndef __GST_VULKAN_FWD_H__ +#define __GST_VULKAN_FWD_H__ #include @@ -46,12 +46,6 @@ typedef struct _GstVulkanWindow GstVulkanWindow; typedef struct _GstVulkanWindowClass GstVulkanWindowClass; typedef struct _GstVulkanWindowPrivate GstVulkanWindowPrivate; -typedef struct _GstVulkanSwapper GstVulkanSwapper; -typedef struct _GstVulkanSwapperClass GstVulkanSwapperClass; -typedef struct _GstVulkanSwapperPrivate GstVulkanSwapperPrivate; - -typedef struct _GstVulkanTrash GstVulkanTrash; - typedef struct _GstVulkanFence GstVulkanFence; typedef struct _GstVulkanMemory GstVulkanMemory; @@ -72,4 +66,4 @@ typedef struct _GstVulkanBufferPoolPrivate GstVulkanBufferPoolPrivate; G_END_DECLS -#endif /* _VK_FWD_H_ */ +#endif /* __GST_VULKAN_FWD_H__ */ diff --git a/ext/vulkan/wayland/vkdisplay_wayland.c b/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.c similarity index 99% rename from ext/vulkan/wayland/vkdisplay_wayland.c rename to gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.c index 2a7b623..ddb09d7 100644 --- a/ext/vulkan/wayland/vkdisplay_wayland.c +++ b/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.c @@ -22,7 +22,8 @@ #include "config.h" #endif -#include "wayland/vkdisplay_wayland.h" +#include + #include "wayland_event_source.h" GST_DEBUG_CATEGORY_STATIC (gst_vulkan_display_wayland_debug); diff --git a/ext/vulkan/wayland/vkdisplay_wayland.h b/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h similarity index 96% rename from ext/vulkan/wayland/vkdisplay_wayland.h rename to gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h index 44c1340..5d38568 100644 --- a/ext/vulkan/wayland/vkdisplay_wayland.h +++ b/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h @@ -25,13 +25,14 @@ #include -#include +#include G_BEGIN_DECLS +#define GST_TYPE_VULKAN_DISPLAY_WAYLAND (gst_vulkan_display_wayland_get_type()) +GST_VULKAN_API GType gst_vulkan_display_wayland_get_type (void); -#define GST_TYPE_VULKAN_DISPLAY_WAYLAND (gst_vulkan_display_wayland_get_type()) #define GST_VULKAN_DISPLAY_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VULKAN_DISPLAY_WAYLAND,GstVulkanDisplayWayland)) #define GST_VULKAN_DISPLAY_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VULKAN_DISPLAY_WAYLAND,GstVulkanDisplayWaylandClass)) #define GST_IS_VULKAN_DISPLAY_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VULKAN_DISPLAY_WAYLAND)) @@ -68,11 +69,11 @@ struct _GstVulkanDisplayWaylandClass #define GST_VULKAN_DISPLAY_WAYLAND_DISPLAY(display_) (GST_VULKAN_DISPLAY_WAYLAND (display_)->display) +GST_VULKAN_API GstVulkanDisplayWayland *gst_vulkan_display_wayland_new (const gchar * name); +GST_VULKAN_API GstVulkanDisplayWayland *gst_vulkan_display_wayland_new_with_display (struct wl_display *display); -void gst_vulkan_display_wayland_roundtrip_async (GstVulkanDisplayWayland * display); - G_END_DECLS #endif /* __GST_VULKAN_DISPLAY_WAYLAND_H__ */ diff --git a/ext/vulkan/wayland/vkwindow_wayland.c b/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.c similarity index 99% rename from ext/vulkan/wayland/vkwindow_wayland.c rename to gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.c index 40df44f..15cf0c2 100644 --- a/ext/vulkan/wayland/vkwindow_wayland.c +++ b/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.c @@ -26,10 +26,10 @@ #include -#include "wayland_event_source.h" +#include +#include "gstvkwindow_wayland.h" -#include "vkdisplay_wayland.h" -#include "vkwindow_wayland.h" +#include "wayland_event_source.h" #define GST_CAT_DEFAULT gst_vulkan_window_wayland_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); diff --git a/ext/vulkan/wayland/vkwindow_wayland.h b/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h similarity index 98% rename from ext/vulkan/wayland/vkwindow_wayland.h rename to gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h index 3d181f8..ee9d4e4 100644 --- a/ext/vulkan/wayland/vkwindow_wayland.h +++ b/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h @@ -24,11 +24,13 @@ #include #include -#include +#include G_BEGIN_DECLS #define GST_TYPE_VULKAN_WINDOW_WAYLAND (gst_vulkan_window_wayland_get_type()) +GType gst_vulkan_window_wayland_get_type (void); + #define GST_VULKAN_WINDOW_WAYLAND(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_WINDOW_WAYLAND, GstVulkanWindowWayland)) #define GST_VULKAN_WINDOW_WAYLAND_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_VULKAN_WINDOW_WAYLAND, GstVulkanWindowWaylandClass)) #define GST_IS_VULKAN_WINDOW_WAYLAND(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_WINDOW_WAYLAND)) @@ -65,8 +67,6 @@ struct _GstVulkanWindowWaylandClass { gpointer _reserved[GST_PADDING]; }; -GType gst_vulkan_window_wayland_get_type (void); - GstVulkanWindowWayland * gst_vulkan_window_wayland_new (GstVulkanDisplay * display); G_END_DECLS diff --git a/ext/vulkan/wayland/wayland_event_source.c b/gst-libs/gst/vulkan/wayland/wayland_event_source.c similarity index 99% rename from ext/vulkan/wayland/wayland_event_source.c rename to gst-libs/gst/vulkan/wayland/wayland_event_source.c index e1ae1ef..12c03bb 100644 --- a/ext/vulkan/wayland/wayland_event_source.c +++ b/gst-libs/gst/vulkan/wayland/wayland_event_source.c @@ -37,6 +37,8 @@ #include #include +#include + #include "wayland_event_source.h" static void diff --git a/ext/vulkan/wayland/wayland_event_source.h b/gst-libs/gst/vulkan/wayland/wayland_event_source.h similarity index 67% rename from ext/vulkan/wayland/wayland_event_source.h rename to gst-libs/gst/vulkan/wayland/wayland_event_source.h index 25ffe7b..68ce0f1 100644 --- a/ext/vulkan/wayland/wayland_event_source.h +++ b/gst-libs/gst/vulkan/wayland/wayland_event_source.h @@ -25,10 +25,14 @@ #include -GSource * wayland_event_source_new (struct wl_display *display, - struct wl_event_queue *queue); +GSource * wayland_event_source_new (struct wl_display *display, + struct wl_event_queue *queue); -G_GNUC_INTERNAL gint gst_vulkan_wl_display_roundtrip_queue (struct wl_display *display, - struct wl_event_queue *queue); +G_GNUC_INTERNAL +void gst_vulkan_display_wayland_roundtrip_async (GstVulkanDisplayWayland * display); + +G_GNUC_INTERNAL +gint gst_vulkan_wl_display_roundtrip_queue (struct wl_display *display, + struct wl_event_queue *queue); #endif /* __WAYLAND_EVENT_SOURCE_H__ */ diff --git a/ext/vulkan/xcb/vkdisplay_xcb.c b/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.c similarity index 98% rename from ext/vulkan/xcb/vkdisplay_xcb.c rename to gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.c index 625d593..4703988 100644 --- a/ext/vulkan/xcb/vkdisplay_xcb.c +++ b/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.c @@ -22,7 +22,9 @@ #include "config.h" #endif -#include "vkdisplay_xcb.h" +#include + +#include #include "xcb_event_source.h" #define GST_CAT_DEFAULT gst_vulkan_display_debug diff --git a/ext/vulkan/xcb/vkdisplay_xcb.h b/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h similarity index 97% rename from ext/vulkan/xcb/vkdisplay_xcb.h rename to gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h index 7c0f1ec..4a6cb9c 100644 --- a/ext/vulkan/xcb/vkdisplay_xcb.h +++ b/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h @@ -25,15 +25,17 @@ #include -#include #ifndef VK_USE_PLATFORM_XCB_KHR #error "VK_USE_PLATFORM_XCB_KHR not defined before including this header" #error "Either include vkapi.h or define VK_USE_PLATFORM_XCB_KHR before including this header" #endif #include +#include + G_BEGIN_DECLS +GST_VULKAN_API GType gst_vulkan_display_xcb_get_type (void); #define GST_TYPE_VULKAN_DISPLAY_XCB (gst_vulkan_display_xcb_get_type()) @@ -75,7 +77,9 @@ struct _GstVulkanDisplayXCBClass GstVulkanDisplayClass object_class; }; +GST_VULKAN_API GstVulkanDisplayXCB * gst_vulkan_display_xcb_new (const gchar * name); +GST_VULKAN_API GstVulkanDisplayXCB * gst_vulkan_display_xcb_new_with_connection (xcb_connection_t * connection, int screen_no); diff --git a/ext/vulkan/xcb/vkwindow_xcb.c b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c similarity index 99% rename from ext/vulkan/xcb/vkwindow_xcb.c rename to gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c index f62b31d..047c276 100644 --- a/ext/vulkan/xcb/vkwindow_xcb.c +++ b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c @@ -25,8 +25,8 @@ #include #include -#include "vkwindow_xcb.h" -#include "vkdisplay_xcb.h" +#include "gstvkwindow_xcb.h" +#include "gstvkdisplay_xcb.h" #define GST_VULKAN_WINDOW_XCB_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_VULKAN_WINDOW_XCB, GstVulkanWindowXCBPrivate)) diff --git a/ext/vulkan/xcb/vkwindow_xcb.h b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h similarity index 98% rename from ext/vulkan/xcb/vkwindow_xcb.h rename to gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h index db012bb..255898b 100644 --- a/ext/vulkan/xcb/vkwindow_xcb.h +++ b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h @@ -23,7 +23,7 @@ #include -#include +#include G_BEGIN_DECLS diff --git a/ext/vulkan/xcb/xcb_event_source.c b/gst-libs/gst/vulkan/xcb/xcb_event_source.c similarity index 98% rename from ext/vulkan/xcb/xcb_event_source.c rename to gst-libs/gst/vulkan/xcb/xcb_event_source.c index 3368f19..18b01ba 100644 --- a/ext/vulkan/xcb/xcb_event_source.c +++ b/gst-libs/gst/vulkan/xcb/xcb_event_source.c @@ -25,9 +25,12 @@ #include #include +#include + +#include +#include "gstvkwindow_xcb.h" + #include "xcb_event_source.h" -#include "vkdisplay_xcb.h" -#include "vkwindow_xcb.h" static gint _compare_xcb_window (GstVulkanWindowXCB * window_xcb, xcb_window_t * window_id) diff --git a/ext/vulkan/xcb/xcb_event_source.h b/gst-libs/gst/vulkan/xcb/xcb_event_source.h similarity index 97% rename from ext/vulkan/xcb/xcb_event_source.h rename to gst-libs/gst/vulkan/xcb/xcb_event_source.h index cd9b41c..2ef7217 100644 --- a/ext/vulkan/xcb/xcb_event_source.h +++ b/gst-libs/gst/vulkan/xcb/xcb_event_source.h @@ -22,7 +22,6 @@ #define __VULKAN_XCB_EVENT_SOURCE_H__ #include -#include "vkdisplay_xcb.h" GSource * xcb_event_source_new (GstVulkanDisplayXCB *display_xcb); diff --git a/pkgconfig/gstreamer-vulkan-uninstalled.pc.in b/pkgconfig/gstreamer-vulkan-uninstalled.pc.in new file mode 100644 index 0000000..b9a7704 --- /dev/null +++ b/pkgconfig/gstreamer-vulkan-uninstalled.pc.in @@ -0,0 +1,12 @@ +prefix= +exec_prefix= +libdir=@vulkanlibdir@ +includedir=@abs_top_srcdir@/gst-libs + +Name: GStreamer Vulkan, Uninstalled +Description: GStreamer Vulkan support, uninstalled +Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@ gstreamer-video-@GST_API_VERSION@ +Version: @VERSION@ +Libs: -L${libdir} -lgstvulkan-@GST_API_VERSION@ +Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs + diff --git a/pkgconfig/gstreamer-vulkan.pc.in b/pkgconfig/gstreamer-vulkan.pc.in new file mode 100644 index 0000000..00eca52 --- /dev/null +++ b/pkgconfig/gstreamer-vulkan.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/gstreamer-@GST_API_VERSION@ + +Name: GStreamer Vulkan +Description: GStreamer Vulkan support +Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@ gstreamer-video-@GST_API_VERSION@ +Version: @VERSION@ +Libs: -L${libdir} -lgstvulkan-@GST_API_VERSION@ +Cflags: -I${includedir} + diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build index 7ddfafb..5bebe2f 100644 --- a/pkgconfig/meson.build +++ b/pkgconfig/meson.build @@ -37,6 +37,11 @@ pkg_libs = [ # pkg_libs += 'wayland' #endif +if gstvulkan_dep.found() + pkgconf.set('vulkanlibdir', join_paths(meson.build_root(), gstvulkan.outdir())) + pkg_libs += 'vulkan' +endif + foreach p : pkg_libs infile = 'gstreamer-@0@.pc.in'.format(p) outfile = 'gstreamer-@0@-@1@.pc'.format(p, api_version) -- 2.7.4