Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [Vulkan HWAccel] Incorrect default img_flags causes VUID-06811 validation error
@ 2025-11-13 16:56 titatovenaar76--- via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: titatovenaar76--- via ffmpeg-devel @ 2025-11-13 16:56 UTC (permalink / raw)
  To: Ffmpeg Devel; +Cc: titatovenaar76

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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-13 16:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-13 16:56 [FFmpeg-devel] [Vulkan HWAccel] Incorrect default img_flags causes VUID-06811 validation error titatovenaar76--- via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git