diff options
author | Philip Langdale <philipl@overt.org> | 2023-05-29 12:40:35 -0700 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2023-05-29 13:26:29 -0700 |
commit | 0131ae4133a2f442fe1906d1632c4b84954c4140 (patch) | |
tree | a61f88aefaa2e4b475a323491a23ff0b93b9f080 | |
parent | ba5370e82a1139a249f27b78d22e8fe4092ad024 (diff) | |
download | mpv-0131ae4133a2f442fe1906d1632c4b84954c4140.tar.bz2 mpv-0131ae4133a2f442fe1906d1632c4b84954c4140.tar.xz |
hwdec_vulkan: simplify requirement checks for Vulkan interop
I originally wrote this trying to avoid doing an explicit version check
on the headers, but it just makes things more confusing, and the
requirements harder to understand.
So, Vulkan interop now takes a dependency on the header release where
they finalised the video decode headers. VK_EXT_descriptor_buffer was
added in 1.3.235, so that's covered as well.
Along the way I fixed a bug in the waf build where it was depending
on libplacebo-next instead of libplacebo-decode.
-rw-r--r-- | meson.build | 7 | ||||
-rw-r--r-- | video/out/vulkan/context.c | 20 | ||||
-rw-r--r-- | wscript | 7 |
3 files changed, 17 insertions, 17 deletions
diff --git a/meson.build b/meson.build index d03fe823a4..812f97cc98 100644 --- a/meson.build +++ b/meson.build @@ -933,8 +933,6 @@ if features['libplacebo-next'] 'video/out/gpu_next/context.c') endif -features += {'libplacebo-decode': features['libplacebo'] and libplacebo.version().version_compare('>=5.275.0')} - sdl2_video = get_option('sdl2-video').require( features['sdl2'], error_message: 'sdl2 was not found!', @@ -1312,9 +1310,10 @@ if features['cuda-interop'] and features['vulkan'] endif vulkan_interop = get_option('vulkan-interop').require( - vulkan.found() and features['libplacebo-decode'] and + features['vulkan'] and vulkan.version().version_compare('>=1.3.238') and + features['libplacebo'] and libplacebo.version().version_compare('>=5.278.0') and libavutil.version().version_compare('>=58.11.100'), - error_message: 'Vulkan Interop requires vulkan, libplacebo >= 5.275.0, and libavutil >= 58.11.100', + error_message: 'Vulkan Interop requires vulkan headers >= 1.3.238, libplacebo >= 5.278.0, and libavutil >= 58.11.100', ) features += {'vulkan-interop': vulkan_interop.allowed()} if vulkan_interop.allowed() diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c index 8bec39cf8c..003515cf32 100644 --- a/video/out/vulkan/context.c +++ b/video/out/vulkan/context.c @@ -161,7 +161,11 @@ bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk, p->params = params; p->opts = mp_get_config_group(p, ctx->global, &vulkan_conf); -#if HAVE_VULKAN_INTEROP && defined(VK_EXT_descriptor_buffer) + VkPhysicalDeviceFeatures2 features = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, + }; + +#if HAVE_VULKAN_INTEROP /* * Request the additional extensions and features required to make full use * of the ffmpeg Vulkan hwcontext and video decoding capability. @@ -189,16 +193,8 @@ bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk, .shaderBufferFloat32AtomicAdd = true, }; - VkPhysicalDeviceFeatures2 features = { - .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, - .pNext = &atomic_float_feature, - }; - -#else - VkPhysicalDeviceFeatures2 features = { - .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, - }; -#endif // HAVE_VULKAN_INTEROP && defined(VK_EXT_descriptor_buffer) + features.pNext = &atomic_float_feature; +#endif assert(vk->pllog); assert(vk->vkinst); @@ -210,7 +206,7 @@ bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk, .async_compute = p->opts->async_compute, .queue_count = p->opts->queue_count, .device_name = p->opts->device, -#if HAVE_VULKAN_INTEROP && defined(VK_EXT_descriptor_buffer) +#if HAVE_VULKAN_INTEROP .extra_queues = VK_QUEUE_VIDEO_DECODE_BIT_KHR, .opt_extensions = opt_extensions, .num_opt_extensions = MP_ARRAY_SIZE(opt_extensions), @@ -815,9 +815,14 @@ video_output_features = [ 'func': check_statement('vulkan/vulkan_core.h', 'vkCreateDisplayPlaneSurfaceKHR(0, 0, 0, 0)', use='vulkan') }, { + 'name': 'vulkan-decode-headers', + 'desc': 'Vulkan headers with decode support', + 'deps': 'vulkan', + 'func': check_pkg_config('vulkan', '>= 1.3.238'), + }, { 'name': '--vulkan-interop', 'desc': 'Vulkan graphics interop', - 'deps': 'vulkan && libplacebo-next', + 'deps': 'vulkan-decode-headers && libplacebo-decode', 'func': check_pkg_config('libavutil', '>= 58.11.100'), }, { 'name': 'vaapi-libplacebo', |