[FFmpeg-devel] [PATCH 1/3] hwcontext_vulkan: fix VUID-VkPhysicalDeviceImageFormatInfo2-usage-requiredbitmask
Lynne
dev at lynne.ee
Fri Sep 20 09:23:30 EEST 2024
fmt_props.usage was initialized to 0 as create_info.usage was set later.
---
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);
--
2.45.2.753.g447d99e1c3b
More information about the ffmpeg-devel
mailing list