[FFmpeg-cvslog] configure: add option to statically link to libvulkan
Lynne
git at videolan.org
Sun Dec 22 21:26:03 EET 2024
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Dec 18 17:27:46 2024 +0900| [1b8cd00da62617bf5e8f2cdac67d99ea6e34404f] | committer: Lynne
configure: add option to statically link to libvulkan
This may be useful in weird setups and on platforms where
static linking to libvulkan is supported.
libplacebo also has this fallback.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b8cd00da62617bf5e8f2cdac67d99ea6e34404f
---
configure | 7 ++++++-
libavutil/hwcontext_vulkan.c | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index a6ac2c8b0b..0a7ce31e09 100755
--- a/configure
+++ b/configure
@@ -363,6 +363,7 @@ External library support:
--disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
--disable-videotoolbox disable VideoToolbox code [autodetect]
--disable-vulkan disable Vulkan code [autodetect]
+ --enable-vulkan-static statically link to libvulkan [no]
Toolchain options:
--arch=ARCH select architecture [$arch]
@@ -1987,6 +1988,7 @@ EXTERNAL_LIBRARY_LIST="
openssl
pocketsphinx
vapoursynth
+ vulkan_static
"
HWACCEL_AUTODETECT_LIBRARY_LIST="
@@ -7379,7 +7381,10 @@ enabled vdpau &&
enabled vdpau &&
check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
-if enabled vulkan; then
+if enabled_all vulkan vulkan_static; then
+ check_pkg_config vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
+ check_lib vulkan "vulkan/vulkan.h" vkGetInstanceProcAddr -lvulkan
+elif enabled vulkan; then
check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)"
fi
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index d32a685383..bc7c258ebb 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -533,11 +533,19 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p,
return AVERROR(EINVAL);
}
+#if CONFIG_VULKAN_STATIC
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance,
+ const char *pName);
+#endif
+
static int load_libvulkan(AVHWDeviceContext *ctx)
{
VulkanDevicePriv *p = ctx->hwctx;
AVVulkanDeviceContext *hwctx = &p->p;
+#if CONFIG_VULKAN_STATIC
+ hwctx->get_proc_addr = vkGetInstanceProcAddr;
+#else
static const char *lib_names[] = {
#if defined(_WIN32)
"vulkan-1.dll",
@@ -563,6 +571,7 @@ static int load_libvulkan(AVHWDeviceContext *ctx)
}
hwctx->get_proc_addr = (PFN_vkGetInstanceProcAddr)dlsym(p->libvulkan, "vkGetInstanceProcAddr");
+#endif /* CONFIG_VULKAN_STATIC */
return 0;
}
More information about the ffmpeg-cvslog
mailing list