vulkan: remove GST_VULKAN_HAVE_VIDEO_ENCODERS

Use 2.3.275 as first supported SDK version

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6992>
This commit is contained in:
Stéphane Cerveau 2024-06-04 09:55:26 +02:00 committed by GStreamer Marge Bot
parent b9633cb766
commit 21ee264d65
12 changed files with 11 additions and 68 deletions

View file

@ -17,7 +17,6 @@ G_BEGIN_DECLS
#mesondefine GST_VULKAN_HAVE_WINDOW_WIN32
#mesondefine GST_VULKAN_HAVE_WINDOW_ANDROID
#mesondefine GST_VULKAN_HAVE_VIDEO_EXTENSIONS
#mesondefine GST_VULKAN_HAVE_VIDEO_ENCODERS
G_END_DECLS

View file

@ -191,11 +191,9 @@ gst_vulkan_device_constructed (GObject * object)
VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME,
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_ENCODE_H264_EXTENSION_NAME,
VK_KHR_VIDEO_ENCODE_H265_EXTENSION_NAME,
#endif
#endif
};
int i;

View file

@ -214,7 +214,6 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool,
priv->n_profiles++;
}
gst_clear_caps (&decode_caps);
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
if (encode_caps && ((priv->usage
& (VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR
| VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR)) != 0)) {
@ -224,7 +223,6 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool,
priv->n_profiles++;
}
gst_clear_caps (&encode_caps);
#endif
if (priv->n_profiles != n)
goto missing_profile;

View file

@ -1249,12 +1249,10 @@ gst_vulkan_operation_enable_query (GstVulkanOperation * self,
if (priv->has_video)
stride = sizeof (guint32);
break;
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
case VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR:
if (priv->has_video)
stride = sizeof (GstVulkanEncodeQueryResult);
break;
#endif
#endif
default:
@ -1299,10 +1297,7 @@ gst_vulkan_operation_get_query (GstVulkanOperation * self, gpointer * result,
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
if (priv->has_video
&& (priv->query_type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
|| priv->query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR
#endif
)) {
|| priv->query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR)) {
flags |= VK_QUERY_RESULT_WITH_STATUS_BIT_KHR;
}
#endif

View file

@ -37,7 +37,6 @@ const VkExtensionProperties _vk_codec_extensions[] = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION,
},
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
[GST_VK_VIDEO_EXTENSION_ENCODE_H264] = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION,
@ -46,7 +45,6 @@ const VkExtensionProperties _vk_codec_extensions[] = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION,
}
#endif
};
const VkComponentMapping _vk_identity_component_map = {
@ -76,9 +74,6 @@ gst_vulkan_video_get_vk_functions (GstVulkanInstance * instance,
} \
} G_STMT_END;
GST_VULKAN_VIDEO_FN_LIST (GET_PROC_ADDRESS_REQUIRED)
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
GST_VULKAN_VIDEO_ENCODING_FN_LIST (GET_PROC_ADDRESS_REQUIRED)
#endif
#undef GET_PROC_ADDRESS_REQUIRED
ret = TRUE;

View file

@ -61,21 +61,14 @@ typedef enum {
V(CmdBeginVideoCoding) \
V(CmdControlVideoCoding) \
V(CmdEndVideoCoding) \
V(CmdDecodeVideo)
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
#define GST_VULKAN_VIDEO_ENCODING_FN_LIST(V) \
V(CmdEncodeVideo) \
V(CmdDecodeVideo) \
V(CmdEncodeVideo) \
V(GetEncodedVideoSessionParameters)
#endif
struct _GstVulkanVideoFunctions
{
#define DEFINE_FUNCTION(name) G_PASTE(G_PASTE(PFN_vk, name), KHR) name;
GST_VULKAN_VIDEO_FN_LIST (DEFINE_FUNCTION)
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
GST_VULKAN_VIDEO_ENCODING_FN_LIST (DEFINE_FUNCTION)
#endif
#undef DEFINE_FUNCTION
};

View file

@ -36,12 +36,10 @@ static const struct {
VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR },
{ GST_VULKAN_VIDEO_OPERATION_DECODE, VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, "video/x-h265",
VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR },
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
{ GST_VULKAN_VIDEO_OPERATION_ENCODE, VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, "video/x-h264",
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_KHR },
{ GST_VULKAN_VIDEO_OPERATION_ENCODE, VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, "video/x-h265",
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_INFO_KHR },
#endif
};
static const struct {
@ -152,7 +150,6 @@ gst_vulkan_video_profile_to_caps (const GstVulkanVideoProfile * profile)
}
}
break;
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR:
if (profile->codec.h264enc.sType == video_codecs_map[i].stype) {
int j;
@ -173,7 +170,6 @@ gst_vulkan_video_profile_to_caps (const GstVulkanVideoProfile * profile)
}
}
break;
#endif
default:
break;
}
@ -310,7 +306,6 @@ gst_vulkan_video_profile_from_caps (GstVulkanVideoProfile * profile,
}
break;
}
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR:{
int j;
@ -347,7 +342,6 @@ gst_vulkan_video_profile_from_caps (GstVulkanVideoProfile * profile,
}
break;
}
#endif
default:
profile->usage.decode.pNext = NULL;
break;

View file

@ -39,19 +39,15 @@ struct _GstVulkanVideoProfile
VkVideoProfileInfoKHR profile;
union {
VkVideoDecodeUsageInfoKHR decode;
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
VkVideoEncodeUsageInfoKHR encode;
#endif
} usage;
union {
VkBaseInStructure base;
VkVideoDecodeH264ProfileInfoKHR h264dec;
VkVideoDecodeH265ProfileInfoKHR h265dec;
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
VkVideoEncodeH264ProfileInfoKHR h264enc;
VkVideoEncodeH265ProfileInfoKHR h265enc;
#endif
} codec;
#endif
gpointer _reserved[GST_PADDING];
@ -72,10 +68,8 @@ struct _GstVulkanVideoCapabilities
VkBaseInStructure base;
VkVideoDecodeH264CapabilitiesKHR h264dec;
VkVideoDecodeH265CapabilitiesKHR h265dec;
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
VkVideoEncodeH264CapabilitiesKHR h264enc;
VkVideoEncodeH265CapabilitiesKHR h265enc;
#endif
} codec;
#endif
gpointer _reserved[GST_PADDING];

View file

@ -310,8 +310,8 @@ 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"
#if !(defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 275))
#error "Need at least Vulkan 1.3.275"
#endif
/* vk_video/vulkan_video_codec_h264std.h */
@ -321,6 +321,9 @@ static StdVideoH264PictureParameterSet h264_pps;
/* vk_video/vulkan_video_codec_h265std.h */
static StdVideoH265SequenceParameterSet h265_sps;
static StdVideoH265PictureParameterSet h265_pps;
static VkVideoEncodeH264ProfileInfoKHR h264_profile;
static VkVideoEncodeH265ProfileInfoKHR h265_profile;
'''
if vulkan_inc_dir != ''
@ -333,30 +336,8 @@ static StdVideoH265PictureParameterSet h265_pps;
vulkan_priv_sources += files(
'gstvkvideo-private.c',
'gstvkdecoder-private.c',
'gstvkencoder-private.c',
)
encoder_test = '''
#include <vulkan/vulkan.h>
#if !(defined(VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 275))
#error "Need at least Vulkan 1.3.275"
#endif
static VkVideoEncodeH264ProfileInfoKHR h264_profile;
static VkVideoEncodeH265ProfileInfoKHR h265_profile;
'''
if vulkan_inc_dir != ''
have_vk_encoder = cc.compiles(encoder_test, dependencies : vulkan_dep, args: '-I' + vulkan_inc_dir)
else
have_vk_encoder = cc.compiles(encoder_test, dependencies : vulkan_dep)
endif
if have_vk_encoder
vulkan_conf.set('GST_VULKAN_HAVE_VIDEO_ENCODERS', 1)
vulkan_sources += files(
'gstvkencoder-private.c',
)
endif
elif get_option('vulkan-video').enabled()
error('Vulkan Video extensions headers not found')
endif

View file

@ -968,11 +968,9 @@ vkvideo_suite (void)
have_instance = gst_vulkan_instance_open (instance, NULL);
gst_object_unref (instance);
if (have_instance) {
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
tcase_add_test (tc_basic, test_encoder_h264_i);
tcase_add_test (tc_basic, test_encoder_h264_i_p);
tcase_add_test (tc_basic, test_encoder_h264_i_p_b);
#endif
}
return s;

View file

@ -1140,11 +1140,9 @@ vkvideo_suite (void)
have_instance = gst_vulkan_instance_open (instance, NULL);
gst_object_unref (instance);
if (have_instance) {
#if GST_VULKAN_HAVE_VIDEO_ENCODERS
tcase_add_test (tc_basic, test_encoder_h265_i);
tcase_add_test (tc_basic, test_encoder_h265_i_p);
tcase_add_test (tc_basic, test_encoder_h265_i_p_b);
#endif
}
return s;

View file

@ -110,8 +110,8 @@ base_tests = [
[['libs/vkinstance.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
[['libs/vkimagebufferpool.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
[['libs/vkvideodecode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_EXTENSIONS') != 1, [gstvulkan_dep]],
[['libs/vkvideoh264encode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_ENCODERS') != 1, [gstvulkan_dep, gstcodecparsers_dep]],
[['libs/vkvideoh265encode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_ENCODERS') != 1, [gstvulkan_dep, gstcodecparsers_dep]],
[['libs/vkvideoh264encode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_EXTENSIONS') != 1, [gstvulkan_dep, gstcodecparsers_dep]],
[['libs/vkvideoh265encode.c'], not gstvulkan_dep.found() or vulkan_conf.get('GST_VULKAN_HAVE_VIDEO_EXTENSIONS') != 1, [gstvulkan_dep, gstcodecparsers_dep]],
[['libs/d3d11device.cpp'], not gstd3d11_dep.found(), [gstd3d11_dep]],
[['libs/d3d11memory.c'], not gstd3d11_dep.found(), [gstd3d11_dep]],
[['libs/cudamemory.c'], not gstcuda_dep.found(), [gstcuda_dep, gstcuda_stub_dep]],