[FFmpeg-cvslog] hwcontext_vulkan: fix VUID-VkPhysicalDeviceImageFormatInfo2-usage-requiredbitmask

Lynne git at videolan.org
Sun Sep 22 03:11:32 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Fri Sep 20 05:08:16 2024 +0200| [1445102e68561b17c6f97f27ede37414c938e808] | committer: Lynne

hwcontext_vulkan: fix VUID-VkPhysicalDeviceImageFormatInfo2-usage-requiredbitmask

fmt_props.usage was initialized to 0 as create_info.usage was set later.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1445102e68561b17c6f97f27ede37414c938e808
---

 libavutil/hwcontext_vulkan.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index d6899df159..1de08c6181 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2929,7 +2929,16 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f
             .pNext = &props_drm_mod,
             .handleType = ext_img_spec.handleTypes,
         };
-        VkPhysicalDeviceImageFormatInfo2 fmt_props = {
+        VkPhysicalDeviceImageFormatInfo2 fmt_props;
+
+        if (flags & AV_HWFRAME_MAP_READ)
+            create_info.usage |= VK_IMAGE_USAGE_SAMPLED_BIT |
+                                 VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+        if (flags & AV_HWFRAME_MAP_WRITE)
+            create_info.usage |= VK_IMAGE_USAGE_STORAGE_BIT |
+                                 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+
+        fmt_props = (VkPhysicalDeviceImageFormatInfo2) {
             .sType  = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
             .pNext  = &props_ext,
             .format = create_info.format,
@@ -2939,13 +2948,6 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f
             .flags  = create_info.flags,
         };
 
-        if (flags & AV_HWFRAME_MAP_READ)
-            create_info.usage |= VK_IMAGE_USAGE_SAMPLED_BIT |
-                                 VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
-        if (flags & AV_HWFRAME_MAP_WRITE)
-            create_info.usage |= VK_IMAGE_USAGE_STORAGE_BIT |
-                                 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
-
         /* Check if importing is possible for this combination of parameters */
         ret = vk->GetPhysicalDeviceImageFormatProperties2(hwctx->phys_dev,
                                                           &fmt_props, &props_ret);



More information about the ffmpeg-cvslog mailing list