From d03df074f7920203c6f880ad0fce3fecb7669f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 4 Jan 2023 13:23:45 +0100 Subject: [PATCH] vulkan: detect vulkan video extensions Also adds a meson option to enable them. The symbol GST_VULKAN_HAVE_VIDEO_EXTENSIONS is an alias of defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 238 if the option is allowed. Part-of: --- .../gst-libs/gst/vulkan/gstvkconfig.h.meson | 1 + .../gst-libs/gst/vulkan/meson.build | 30 +++++++++++++++++++ subprojects/gst-plugins-bad/meson_options.txt | 4 +++ 3 files changed, 35 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkconfig.h.meson b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkconfig.h.meson index 638543edbc..ea03906bc6 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkconfig.h.meson +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkconfig.h.meson @@ -16,6 +16,7 @@ G_BEGIN_DECLS #mesondefine GST_VULKAN_HAVE_WINDOW_IOS #mesondefine GST_VULKAN_HAVE_WINDOW_WIN32 #mesondefine GST_VULKAN_HAVE_WINDOW_ANDROID +#mesondefine GST_VULKAN_HAVE_VIDEO_EXTENSIONS G_END_DECLS diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/meson.build b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/meson.build index f2b34e377e..d3c1c5e971 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/meson.build +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/meson.build @@ -95,6 +95,7 @@ vulkan_conf_options = [ 'GST_VULKAN_HAVE_WINDOW_IOS', 'GST_VULKAN_HAVE_WINDOW_WIN32', 'GST_VULKAN_HAVE_WINDOW_ANDROID', + 'GST_VULKAN_HAVE_VIDEO_EXTENSIONS', ] foreach option : vulkan_conf_options @@ -304,6 +305,35 @@ if not vulkan_dep.found() or not has_vulkan_header or not glslc.found() endif endif +if get_option('vulkan-video').allowed() + video_test = ''' +#include + +#if !(defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 238)) +#error "Need at least Vulkan 1.3.238" +#endif + +/* vk_video/vulkan_video_codec_h264std.h */ +static StdVideoH264SequenceParameterSet h264_sps; +static StdVideoH264PictureParameterSet h264_pps; + +/* vk_video/vulkan_video_codec_h265std.h */ +static StdVideoH265SequenceParameterSet h265_sps; +static StdVideoH265PictureParameterSet h265_pps; +''' + + if vulkan_inc_dir != '' + have_vk_video = cc.compiles(video_test, dependencies : vulkan_dep, args: '-I' + vulkan_inc_dir) + else + have_vk_video = cc.compiles(video_test, dependencies : vulkan_dep) + endif + if have_vk_video + vulkan_conf.set('GST_VULKAN_HAVE_VIDEO_EXTENSIONS', 1) + elif get_option('vulkan-video').enabled() + error('Vulkan Video extensions headers not found') + endif +endif + gen_sources = [] install_headers(vulkan_headers, subdir : 'gstreamer-1.0/gst/vulkan') diff --git a/subprojects/gst-plugins-bad/meson_options.txt b/subprojects/gst-plugins-bad/meson_options.txt index 16c594b07f..74d02791dc 100644 --- a/subprojects/gst-plugins-bad/meson_options.txt +++ b/subprojects/gst-plugins-bad/meson_options.txt @@ -214,6 +214,10 @@ option('mfx_api', type : 'combo', choices : ['MSDK', 'oneVPL', 'auto'], value : option('mfx-modules-dir', type: 'string', value : '', description : 'libmfx runtime module dir, linux only') +# Vulkan plugin options +option('vulkan-video', type: 'feature', value: 'auto', + description: 'Whether to use Vulkan Video Extensions') + # License-related feature options option('gpl', type: 'feature', value: 'disabled', yield: true, description: 'Allow build plugins that have (A)GPL-licensed dependencies')