[FFmpeg-devel] [PATCH] Keep compatibility with old Vulkan headers (PR #20177)

Lynne code at ffmpeg.org
Fri Aug 8 16:14:44 EEST 2025


PR #20177 opened by Lynne
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20177
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20177.patch

This allows to compile the Vulkan code with headers from January 2023 (debian stable).


From caf46528f92c1d616322274a609e24f77c4a18d1 Mon Sep 17 00:00:00 2001
From: Lynne <dev at lynne.ee>
Date: Fri, 8 Aug 2025 21:15:56 +0900
Subject: [PATCH 1/2] vulkan_decode: add ifdefs around the profile struct and
 privatize

The struct is not referenced anywhere else.
---
 libavcodec/vulkan_decode.c | 19 +++++++++++++++++++
 libavcodec/vulkan_decode.h | 10 ----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index a62ad5bc90..0056838d04 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -68,6 +68,25 @@ static const FFVulkanDecodeDescriptor *dec_descs[] = {
 #endif
 };
 
+typedef struct FFVulkanDecodeProfileData {
+#if CONFIG_H264_VULKAN_HWACCEL
+     VkVideoDecodeH264ProfileInfoKHR h264_profile;
+#endif
+#if CONFIG_HEVC_VULKAN_HWACCEL
+     VkVideoDecodeH265ProfileInfoKHR h265_profile;
+#endif
+#if CONFIG_VP9_VULKAN_HWACCEL
+     VkVideoDecodeVP9ProfileInfoKHR vp9_profile;
+#endif
+#if CONFIG_AV1_VULKAN_HWACCEL
+     VkVideoDecodeAV1ProfileInfoKHR av1_profile;
+#endif
+
+    VkVideoDecodeUsageInfoKHR usage;
+    VkVideoProfileInfoKHR profile;
+    VkVideoProfileListInfoKHR profile_list;
+} FFVulkanDecodeProfileData;
+
 static const FFVulkanDecodeDescriptor *get_codecdesc(enum AVCodecID codec_id)
 {
     for (size_t i = 0; i < FF_ARRAY_ELEMS(dec_descs); i++)
diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h
index bf51d5a170..96c330bdc9 100644
--- a/libavcodec/vulkan_decode.h
+++ b/libavcodec/vulkan_decode.h
@@ -35,16 +35,6 @@ typedef struct FFVulkanDecodeDescriptor {
     VkExtensionProperties ext_props;
 } FFVulkanDecodeDescriptor;
 
-typedef struct FFVulkanDecodeProfileData {
-    VkVideoDecodeH264ProfileInfoKHR h264_profile;
-    VkVideoDecodeH265ProfileInfoKHR h265_profile;
-    VkVideoDecodeVP9ProfileInfoKHR vp9_profile;
-    VkVideoDecodeAV1ProfileInfoKHR av1_profile;
-    VkVideoDecodeUsageInfoKHR usage;
-    VkVideoProfileInfoKHR profile;
-    VkVideoProfileListInfoKHR profile_list;
-} FFVulkanDecodeProfileData;
-
 typedef struct FFVulkanDecodeShared {
     FFVulkanContext s;
     FFVkVideoCommon common;
-- 
2.49.1


From b278c29c19c947b71d531ba32a1330f336c37577 Mon Sep 17 00:00:00 2001
From: Lynne <dev at lynne.ee>
Date: Fri, 8 Aug 2025 22:12:57 +0900
Subject: [PATCH 2/2] configure: enable Vulkan VP9 decoding and AV1 encoding if
 the headers support it

---
 configure | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 6d8ad94b57..638c4d96f8 100755
--- a/configure
+++ b/configure
@@ -2660,6 +2660,7 @@ CONFIG_EXTRA="
     tpeldsp
     vaapi_1
     vaapi_encode
+    vulkan_1_4
     vc1dsp
     videodsp
     vp3dsp
@@ -3330,7 +3331,7 @@ vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9"
 vp9_vdpau_hwaccel_select="vp9_decoder"
 vp9_videotoolbox_hwaccel_deps="videotoolbox"
 vp9_videotoolbox_hwaccel_select="vp9_decoder"
-vp9_vulkan_hwaccel_deps="vulkan"
+vp9_vulkan_hwaccel_deps="vulkan vulkan_1_4"
 vp9_vulkan_hwaccel_select="vp9_decoder"
 vvc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVVC"
 vvc_vaapi_hwaccel_select="vvc_decoder"
@@ -3352,6 +3353,7 @@ qsvdec_select="qsv"
 qsvenc_select="qsv"
 qsvvpp_select="qsv"
 vaapi_encode_deps="vaapi"
+vulkan_1_4_deps="vulkan"
 vulkan_encode_deps="vulkan"
 v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
 
@@ -3404,6 +3406,7 @@ av1_qsv_encoder_deps="libvpl"
 av1_qsv_encoder_select="qsvenc"
 av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
 av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
+av1_vulkan_encoder_deps="vulkan_1_4"
 av1_vulkan_encoder_select="cbs_av1 vulkan_encode"
 h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
 h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
@@ -7515,6 +7518,9 @@ fi
 
 if disabled vulkan; then
     disable libglslang libshaderc spirv_compiler
+elif
+    check_pkg_config_header_only vulkan_1_4 "vulkan >= 1.4.317" "vulkan/vulkan.h" "defined VK_VERSION_1_4" ||
+        check_cpp_condition vulkan_1_4 "vulkan/vulkan.h" "defined(VK_VERSION_1_5) || (defined(VK_VERSION_1_4) && VK_HEADER_VERSION >= 317)"
 fi
 
 if enabled x86; then
-- 
2.49.1



More information about the ffmpeg-devel mailing list