[FFmpeg-cvslog] hwcontext_vulkan: enable VK_KHR_video_maintenance1
Lynne
git at videolan.org
Fri Aug 16 02:22:37 EEST 2024
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Aug 14 17:10:42 2024 +0200| [46c13834b6a08d4e7d9b2c457805bfdca55f4613] | committer: Lynne
hwcontext_vulkan: enable VK_KHR_video_maintenance1
We require it for encoding.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46c13834b6a08d4e7d9b2c457805bfdca55f4613
---
libavutil/hwcontext_vulkan.c | 12 +++++++++++-
libavutil/vulkan_functions.h | 1 +
libavutil/vulkan_loader.h | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2679e4d027..b897a54621 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -94,6 +94,7 @@ typedef struct VulkanDevicePriv {
VkPhysicalDeviceCooperativeMatrixFeaturesKHR coop_matrix_features;
VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features;
VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features;
+ VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features;
/* Queues */
pthread_mutex_t **qf_mutex;
@@ -422,6 +423,7 @@ static const VulkanOptExtension optional_device_exts[] = {
{ VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME, FF_VK_EXT_COOP_MATRIX },
{ VK_NV_OPTICAL_FLOW_EXTENSION_NAME, FF_VK_EXT_OPTICAL_FLOW },
{ VK_EXT_SHADER_OBJECT_EXTENSION_NAME, FF_VK_EXT_SHADER_OBJECT },
+ { VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME, FF_VK_EXT_VIDEO_MAINTENANCE_1 },
/* Imports/exports */
{ VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY },
@@ -1401,9 +1403,13 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES,
};
+ VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR,
+ .pNext = &timeline_features,
+ };
VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT,
- .pNext = &timeline_features,
+ .pNext = &video_maint_1_features,
};
VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV,
@@ -1498,6 +1504,8 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
p->device_features_1_3.shaderZeroInitializeWorkgroupMemory = dev_features_1_3.shaderZeroInitializeWorkgroupMemory;
p->device_features_1_3.dynamicRendering = dev_features_1_3.dynamicRendering;
+ p->video_maint_1_features.videoMaintenance1 = video_maint_1_features.videoMaintenance1;
+
p->desc_buf_features.descriptorBuffer = desc_buf_features.descriptorBuffer;
p->desc_buf_features.descriptorBufferPushDescriptors = desc_buf_features.descriptorBufferPushDescriptors;
@@ -1547,6 +1555,8 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT);
OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV);
+ OPT_CHAIN(FF_VK_EXT_VIDEO_MAINTENANCE_1, &p->video_maint_1_features,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR);
#undef OPT_CHAIN
/* Add the enabled features into the pnext chain of device creation */
diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h
index 5fbde96cfe..d4697ec34c 100644
--- a/libavutil/vulkan_functions.h
+++ b/libavutil/vulkan_functions.h
@@ -49,6 +49,7 @@ typedef enum FFVulkanExtensions {
FF_VK_EXT_OPTICAL_FLOW = 1ULL << 17, /* VK_NV_optical_flow */
FF_VK_EXT_SHADER_OBJECT = 1ULL << 18, /* VK_EXT_shader_object */
+ FF_VK_EXT_VIDEO_MAINTENANCE_1 = 1ULL << 27, /* VK_KHR_video_maintenance1 */
FF_VK_EXT_VIDEO_ENCODE_QUEUE = 1ULL << 28, /* VK_KHR_video_encode_queue */
FF_VK_EXT_VIDEO_ENCODE_H264 = 1ULL << 29, /* VK_KHR_video_encode_h264 */
FF_VK_EXT_VIDEO_ENCODE_H265 = 1ULL << 30, /* VK_KHR_video_encode_h265 */
diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h
index f75569340f..82ed16c1f0 100644
--- a/libavutil/vulkan_loader.h
+++ b/libavutil/vulkan_loader.h
@@ -51,6 +51,7 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions,
{ VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME, FF_VK_EXT_COOP_MATRIX },
{ VK_NV_OPTICAL_FLOW_EXTENSION_NAME, FF_VK_EXT_OPTICAL_FLOW },
{ VK_EXT_SHADER_OBJECT_EXTENSION_NAME, FF_VK_EXT_SHADER_OBJECT },
+ { VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME, FF_VK_EXT_VIDEO_MAINTENANCE_1 },
#ifdef _WIN32
{ VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_MEMORY },
{ VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_SEM },
More information about the ffmpeg-cvslog
mailing list