From 2300c7509699db2a59e4bd0eee33890a2d906156 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 5 Aug 2025 16:00:59 +0200 Subject: [PATCH 12/13] a/vk: Expose video_maintenance_1 device feature --- src/xrt/auxiliary/vk/vk_bundle_init.c | 40 +++++++++++++++++++++++++-- src/xrt/auxiliary/vk/vk_helpers.h | 4 +++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/xrt/auxiliary/vk/vk_bundle_init.c b/src/xrt/auxiliary/vk/vk_bundle_init.c index b435d73dd..501cd6f3c 100644 --- a/src/xrt/auxiliary/vk/vk_bundle_init.c +++ b/src/xrt/auxiliary/vk/vk_bundle_init.c @@ -1098,6 +1098,13 @@ filter_device_features(struct vk_bundle *vk, }; #endif +#ifdef VK_KHR_video_maintenance1 + VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maintenance_1_info = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, + .pNext = NULL, + }; +#endif + #ifdef VK_ANDROID_external_format_resolve VkPhysicalDeviceExternalFormatResolveFeaturesANDROID ext_fmt_resolve_info = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID, @@ -1148,6 +1155,13 @@ filter_device_features(struct vk_bundle *vk, } #endif +#ifdef VK_KHR_video_maintenance1 + if (vk->has_KHR_video_maintenance1) { + vk_append_to_pnext_chain((VkBaseInStructure *)&physical_device_features, + (VkBaseInStructure *)&video_maintenance_1_info); + } +#endif + #ifdef VK_ANDROID_external_format_resolve if (vk->has_ANDROID_external_format_resolve) { vk_append_to_pnext_chain((VkBaseInStructure *)&physical_device_features, @@ -1187,6 +1201,10 @@ filter_device_features(struct vk_bundle *vk, CHECK(synchronization_2, synchronization_2_info.synchronization2); #endif +#ifdef VK_KHR_video_maintenance1 + CHECK(video_maintenance_1, video_maintenance_1_info.videoMaintenance1); +#endif + #ifdef VK_ANDROID_external_format_resolve CHECK(ext_fmt_resolve, ext_fmt_resolve_info.externalFormatResolve); #endif @@ -1207,14 +1225,16 @@ filter_device_features(struct vk_bundle *vk, "\n\tshader_storage_image_write_without_format: %i" "\n\tstorage_buffer_8bit_access: %i" "\n\tsynchronization_2: %i" - "\n\ttimeline_semaphore: %i", // + "\n\ttimeline_semaphore: %i" + "\n\tvideo_maintenance_1: %i", // device_features->ext_fmt_resolve, // device_features->null_descriptor, // device_features->shader_image_gather_extended, // device_features->shader_storage_image_write_without_format, // device_features->storage_buffer_8bit_access, // device_features->synchronization_2, // - device_features->timeline_semaphore); // + device_features->timeline_semaphore, // + device_features->video_maintenance_1); // } @@ -1262,6 +1282,7 @@ vk_create_device(struct vk_bundle *vk, vk->features.timeline_semaphore = device_features.timeline_semaphore; vk->features.synchronization_2 = device_features.synchronization_2; vk->features.present_wait = device_features.present_wait; + vk->features.video_maintenance_1 = device_features.video_maintenance_1; /* @@ -1384,6 +1405,14 @@ vk_create_device(struct vk_bundle *vk, }; #endif +#ifdef VK_KHR_video_maintenance1 + VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maintenance_1_info = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, + .pNext = NULL, + .videoMaintenance1 = device_features.video_maintenance_1, + }; +#endif + #ifdef VK_ANDROID_external_format_resolve VkPhysicalDeviceExternalFormatResolveFeaturesANDROID ext_fmt_resolve_info = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID, @@ -1444,6 +1473,13 @@ vk_create_device(struct vk_bundle *vk, } #endif +#ifdef VK_KHR_video_maintenance1 + if (vk->has_KHR_video_maintenance1) { + vk_append_to_pnext_chain((VkBaseInStructure *)&device_create_info, + (VkBaseInStructure *)&video_maintenance_1_info); + } +#endif + #ifdef VK_ANDROID_external_format_resolve if (vk->has_ANDROID_external_format_resolve) { vk_append_to_pnext_chain((VkBaseInStructure *)&device_create_info, diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h index 3b5cbb9c8..748c06dac 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.h +++ b/src/xrt/auxiliary/vk/vk_helpers.h @@ -179,6 +179,9 @@ struct vk_bundle //! Was KHR_present_wait requested, available, and enabled? bool present_wait; + + //! Was KHR_video_maintenance1 requested, available, and enabled? + bool video_maintenance_1; } features; //! Is the GPU a tegra device. @@ -1030,6 +1033,7 @@ struct vk_device_features bool ext_fmt_resolve; bool storage_buffer_8bit_access; bool present_wait; + bool video_maintenance_1; }; /*! -- 2.50.1