From: Lynne via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Lynne <dev@lynne.ee> Subject: [FFmpeg-devel] [PATCH 4/4] hwcontext_vulkan: setup extensions before features Date: Wed, 14 Aug 2024 16:33:45 +0200 Message-ID: <20240814143351.841585-4-dev@lynne.ee> (raw) In-Reply-To: <20240814143351.841585-1-dev@lynne.ee> The issue is that enabling features requires that the device extension is supported. The extensions bitfield was set later, so it was always 0, leading to no features being added. --- libavutil/hwcontext_vulkan.c | 73 +++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 2c958b86bb..18148353c2 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1440,35 +1440,6 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, }; - hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; - hwctx->device_features.pNext = &p->device_features_1_1; - p->device_features_1_1.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; - p->device_features_1_1.pNext = &p->device_features_1_2; - p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; - p->device_features_1_2.pNext = &p->device_features_1_3; - p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; - p->device_features_1_3.pNext = NULL; - -#define OPT_CHAIN(EXT_FLAG, STRUCT_P, TYPE) \ - do { \ - if (p->vkctx.extensions & EXT_FLAG) { \ - (STRUCT_P)->sType = TYPE; \ - ff_vk_link_struct(hwctx->device_features.pNext, STRUCT_P); \ - } \ - } while (0) - - OPT_CHAIN(FF_VK_EXT_DESCRIPTOR_BUFFER, &p->desc_buf_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT); - OPT_CHAIN(FF_VK_EXT_ATOMIC_FLOAT, &p->atomic_float_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT); - OPT_CHAIN(FF_VK_EXT_COOP_MATRIX, &p->coop_matrix_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR); - OPT_CHAIN(FF_VK_EXT_SHADER_OBJECT, &p->shader_object_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); - OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV); -#undef OPT_CHAIN - ctx->free = vulkan_device_free; /* Create an instance if not given one */ @@ -1537,12 +1508,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, p->shader_object_features.shaderObject = shader_object_features.shaderObject; - dev_info.pNext = &hwctx->device_features; - - /* Setup queue family */ - if ((err = setup_queue_families(ctx, &dev_info))) - goto end; - + /* Find and enable extensions */ if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames, &dev_info.enabledExtensionCount, 0))) { for (int i = 0; i < dev_info.queueCreateInfoCount; i++) @@ -1551,6 +1517,43 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, goto end; } + /* Setup enabled device features */ + hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + hwctx->device_features.pNext = &p->device_features_1_1; + p->device_features_1_1.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; + p->device_features_1_1.pNext = &p->device_features_1_2; + p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; + p->device_features_1_2.pNext = &p->device_features_1_3; + p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; + p->device_features_1_3.pNext = NULL; + +#define OPT_CHAIN(EXT_FLAG, STRUCT_P, TYPE) \ + do { \ + if (p->vkctx.extensions & EXT_FLAG) { \ + (STRUCT_P)->sType = TYPE; \ + ff_vk_link_struct(hwctx->device_features.pNext, STRUCT_P); \ + } \ + } while (0) + + OPT_CHAIN(FF_VK_EXT_DESCRIPTOR_BUFFER, &p->desc_buf_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT); + OPT_CHAIN(FF_VK_EXT_ATOMIC_FLOAT, &p->atomic_float_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT); + OPT_CHAIN(FF_VK_EXT_COOP_MATRIX, &p->coop_matrix_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR); + OPT_CHAIN(FF_VK_EXT_SHADER_OBJECT, &p->shader_object_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); + OPT_CHAIN(FF_VK_EXT_OPTICAL_FLOW, &p->optical_flow_features, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV); +#undef OPT_CHAIN + + /* Add the enabled features into the pnext chain of device creation */ + dev_info.pNext = &hwctx->device_features; + + /* Setup enabled queue families */ + if ((err = setup_queue_families(ctx, &dev_info))) + goto end; + ret = vk->CreateDevice(hwctx->phys_dev, &dev_info, hwctx->alloc, &hwctx->act_dev); -- 2.45.2.753.g447d99e1c3b _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2024-08-14 14:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-08-14 14:33 [FFmpeg-devel] [PATCH 1/4] vulkan_decode: use the correct queue family for decoding ops Lynne via ffmpeg-devel 2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 2/4] hwcontext_vulkan: fix user layers, add support for different debug modes Lynne via ffmpeg-devel 2024-08-14 14:33 ` [FFmpeg-devel] [PATCH 3/4] hwcontext_vulkan: don't enable deprecated VK_KHR_sampler_ycbcr_conversion extension Lynne via ffmpeg-devel 2024-08-14 14:33 ` Lynne via ffmpeg-devel [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240814143351.841585-4-dev@lynne.ee \ --to=ffmpeg-devel@ffmpeg.org \ --cc=dev@lynne.ee \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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