Vulkan: add configure check for VK_KHR_display extension

This allows building directly against ICDs that don't implement this extension.
This commit is contained in:
rcombs 2023-02-19 20:23:33 -06:00
parent 9a752e8b26
commit d1cf89b655
5 changed files with 18 additions and 2 deletions

View File

@ -1248,7 +1248,6 @@ features += {'vulkan': vulkan.found()}
if features['vulkan']
dependencies += vulkan
sources += files('video/out/vulkan/context.c',
'video/out/vulkan/context_display.c',
'video/out/vulkan/utils.c')
endif
@ -1268,6 +1267,13 @@ if features['vulkan'] and features['x11']
sources += files('video/out/vulkan/context_xlib.c')
endif
features += {'vk_khr_display': cc.has_function('vkCreateDisplayPlaneSurfaceKHR', prefix: '#include <vulkan/vulkan_core.h>',
dependencies: [vulkan])}
if features['vk_khr_display']
sources += files('video/out/vulkan/context_display.c')
endif
# hwaccel
ffnvcodec = dependency('ffnvcodec', version: '>= 8.2.15.7', required: false)

View File

@ -800,8 +800,10 @@ static const m_option_t mp_opts[] = {
#if HAVE_VULKAN
{"", OPT_SUBSTRUCT(vulkan_opts, vulkan_conf)},
#if HAVE_VK_KHR_DISPLAY
{"", OPT_SUBSTRUCT(vulkan_display_opts, vulkan_display_conf)},
#endif
#endif
#if HAVE_D3D11
{"", OPT_SUBSTRUCT(d3d11_opts, d3d11_conf)},

View File

@ -110,8 +110,10 @@ static const struct ra_ctx_fns *contexts[] = {
#if HAVE_X11
&ra_ctx_vulkan_xlib,
#endif
#if HAVE_VK_KHR_DISPLAY
&ra_ctx_vulkan_display,
#endif
#endif
/* No API contexts: */
#if HAVE_DMABUF_WAYLAND

View File

@ -790,6 +790,12 @@ video_output_features = [
'desc': 'Vulkan context support',
'deps': 'libplacebo',
'func': check_pkg_config('vulkan'),
}, {
'name': 'vk-khr-display',
'desc': "VK_KHR_display extension",
'deps': 'vulkan',
'func': check_statement('vulkan/vulkan_core.h', 'vkCreateDisplayPlaneSurfaceKHR(0, 0, 0, 0)',
use='vulkan')
}, {
'name': 'vaapi-libplacebo',
'desc': 'VAAPI libplacebo',

View File

@ -557,7 +557,7 @@ def build(ctx):
( "video/out/vo_x11.c" , "x11" ),
( "video/out/vo_xv.c", "xv" ),
( "video/out/vulkan/context.c", "vulkan" ),
( "video/out/vulkan/context_display.c", "vulkan" ),
( "video/out/vulkan/context_display.c", "vulkan && vk-khr-display" ),
( "video/out/vulkan/context_android.c", "vulkan && android" ),
( "video/out/vulkan/context_wayland.c", "vulkan && wayland" ),
( "video/out/vulkan/context_win.c", "vulkan && win32-desktop" ),