Hello, I am using Vulkan hardware accelerated video decoding and I am setting up the AVVulkanFramesContext myself. However when "VkImageCreateFlags img_flags" is unset, a default set of flags (including VK_IMAGE_CREATE_ALIAS_BIT and others) is applied. (https://github.com/FFmpeg/FFmpeg/blob/6cdd2cbe323e04cb4bf88bea50c32aad60cba26e/libavutil/hwcontext_vulkan.h#L261C3-L261C23)
The resulting images generate a Vulkan validation error VUID-VkImageCreateInfo-pNext-06811 on my hardware (Nvidia RTX 2070 super) as it doesn't support this default set of flags for the requested images of format VK_FORMAT_G8_B8R8_2PLANE_420_UNORM. It actually requires img_flags to equal 0. However that is interpreted by ffmpeg as being unset. Hence the issue The offending code in ffmpeg seems to be here: (https://github.com/FFmpeg/FFmpeg/blob/6cdd2cbe323e04cb4bf88bea50c32aad60cba26e/libavutil/hwcontext_vulkan.c#L2937) * Image creation flags. * Only fill them in automatically if the image is not going to be used as * a DPB-only image, and we have SAMPLED/STORAGE bits set. */ if (!hwctx->img_flags) { int is_lone_dpb = ((hwctx->usage & VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR) || ((hwctx->usage & VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR) && !(hwctx->usage & VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR))); int sampleable = hwctx->usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT); hwctx->img_flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; if (sampleable && !is_lone_dpb) { hwctx->img_flags |= VK_IMAGE_CREATE_ALIAS_BIT; if ((fmt->vk_planes > 1) && (hwctx->format[0] == fmt->vkf)) hwctx->img_flags |= VK_IMAGE_CREATE_EXTENDED_USAGE_BIT; } } A possible solution would be to modify the logic to differentiate between an intentionally set 0 and an uninitialized state. -- Secured with Tuta Mail: https://tuta.com/free-email _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
