PR #24627 opened by timblechmann
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24627
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24627.patch

vkGetDeviceQueue2 is core since Vulkan 1.1 and is always loaded by
ff_vk_load_functions() regardless of which extensions are enabled, but
some drivers/loaders can still return a non-functional dispatch entry
for it depending on how the instance/device were set up (e.g. an
imported device from an app that declared an insufficient
VkApplicationInfo::apiVersion). Calling it then crashes instead of
failing cleanly. Guard the call and return AVERROR_EXTERNAL if the
function pointer is unavailable.

# Summary of changes

fixe crash seen when not setting `VkApplicationInfo::apiVersion` appropriately 
(windows, alder lake intel iris xe graphics driver)


>From 6f994731ba5e77d4881e705d642ef7b330d99561 Mon Sep 17 00:00:00 2001
From: Tim Blechmann <[email protected]>
Date: Tue, 22 Sep 2026 11:40:08 +0800
Subject: [PATCH] avutil/vulkan: avoid crash on null vkGetDeviceQueue2

vkGetDeviceQueue2 is core since Vulkan 1.1 and is always loaded by
ff_vk_load_functions() regardless of which extensions are enabled, but
some drivers/loaders can still return a non-functional dispatch entry
for it depending on how the instance/device were set up (e.g. an
imported device from an app that declared an insufficient
VkApplicationInfo::apiVersion). Calling it then crashes instead of
failing cleanly. Guard the call and return AVERROR_EXTERNAL if the
function pointer is unavailable.
---
 libavutil/vulkan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index e9e914dab8..37cff13348 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -581,6 +581,10 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, 
AVVulkanDeviceQueueFamily *qf,
             .queueFamilyIndex = qf->idx,
             .queueIndex       = e->qi,
         };
+        if (!vk->GetDeviceQueue2) {
+            av_log(s, AV_LOG_ERROR, "vkGetDeviceQueue2 is unavailable on this 
device\n");
+            return AVERROR_EXTERNAL;
+        }
         vk->GetDeviceQueue2(s->hwctx->act_dev, &qinfo, &e->queue);
     }
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to