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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-01-04 13:23:45 +01:00 committed by GStreamer Marge Bot
parent 3f4bfa097a
commit d03df074f7
3 changed files with 35 additions and 0 deletions

View file

@ -16,6 +16,7 @@ G_BEGIN_DECLS
#mesondefine GST_VULKAN_HAVE_WINDOW_IOS #mesondefine GST_VULKAN_HAVE_WINDOW_IOS
#mesondefine GST_VULKAN_HAVE_WINDOW_WIN32 #mesondefine GST_VULKAN_HAVE_WINDOW_WIN32
#mesondefine GST_VULKAN_HAVE_WINDOW_ANDROID #mesondefine GST_VULKAN_HAVE_WINDOW_ANDROID
#mesondefine GST_VULKAN_HAVE_VIDEO_EXTENSIONS
G_END_DECLS G_END_DECLS

View file

@ -95,6 +95,7 @@ vulkan_conf_options = [
'GST_VULKAN_HAVE_WINDOW_IOS', 'GST_VULKAN_HAVE_WINDOW_IOS',
'GST_VULKAN_HAVE_WINDOW_WIN32', 'GST_VULKAN_HAVE_WINDOW_WIN32',
'GST_VULKAN_HAVE_WINDOW_ANDROID', 'GST_VULKAN_HAVE_WINDOW_ANDROID',
'GST_VULKAN_HAVE_VIDEO_EXTENSIONS',
] ]
foreach option : vulkan_conf_options 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
endif endif
if get_option('vulkan-video').allowed()
video_test = '''
#include <vulkan/vulkan.h>
#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 = [] gen_sources = []
install_headers(vulkan_headers, subdir : 'gstreamer-1.0/gst/vulkan') install_headers(vulkan_headers, subdir : 'gstreamer-1.0/gst/vulkan')

View file

@ -214,6 +214,10 @@ option('mfx_api', type : 'combo', choices : ['MSDK', 'oneVPL', 'auto'], value :
option('mfx-modules-dir', type: 'string', value : '', option('mfx-modules-dir', type: 'string', value : '',
description : 'libmfx runtime module dir, linux only') 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 # License-related feature options
option('gpl', type: 'feature', value: 'disabled', yield: true, option('gpl', type: 'feature', value: 'disabled', yield: true,
description: 'Allow build plugins that have (A)GPL-licensed dependencies') description: 'Allow build plugins that have (A)GPL-licensed dependencies')