diff options
author | Lynne <dev@lynne.ee> | 2024-08-10 21:51:32 +0200 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-08-11 05:13:16 +0200 |
commit | d6c08a41cb576ad2e160761a0bfd44cf9e3b6232 (patch) | |
tree | 966ab506ccabea79fea2d21fe41c98d1bbba0e59 | |
parent | 0b25f0bc1d17a7759120e0ac1bcf901258a93cf9 (diff) | |
download | ffmpeg-d6c08a41cb576ad2e160761a0bfd44cf9e3b6232.tar.gz |
vulkan: load queue families upon loading properties
Avoids the need to call ff_vk_qf_init if manually filling in
a queue family structure.
-rw-r--r-- | libavutil/vulkan.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 13344b7aed..4e275bc7af 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -83,6 +83,25 @@ const char *ff_vk_ret2str(VkResult res) #undef CASE } +static void load_enabled_qfs(FFVulkanContext *s) +{ + s->nb_qfs = 0; + for (int i = 0; i < s->hwctx->nb_qf; i++) { + /* Skip duplicates */ + int skip = 0; + for (int j = 0; j < s->nb_qfs; j++) { + if (s->qfs[j] == s->hwctx->qf[i].idx) { + skip = 1; + break; + } + } + if (skip) + continue; + + s->qfs[s->nb_qfs++] = s->hwctx->qf[i].idx; + } +} + int ff_vk_load_props(FFVulkanContext *s) { FFVulkanFunctions *vk = &s->vkfn; @@ -131,6 +150,8 @@ int ff_vk_load_props(FFVulkanContext *s) vk->GetPhysicalDeviceMemoryProperties(s->hwctx->phys_dev, &s->mprops); vk->GetPhysicalDeviceFeatures2(s->hwctx->phys_dev, &s->feats); + load_enabled_qfs(s); + if (s->qf_props) return 0; @@ -207,24 +228,8 @@ int ff_vk_qf_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, VkQueueFlagBits dev_family) { /* Fill in queue families from context if not done yet */ - if (!s->nb_qfs) { - s->nb_qfs = 0; - - for (int i = 0; i < s->hwctx->nb_qf; i++) { - /* Skip duplicates */ - int skip = 0; - for (int j = 0; j < s->nb_qfs; j++) { - if (s->qfs[j] == s->hwctx->qf[i].idx) { - skip = 1; - break; - } - } - if (skip) - continue; - - s->qfs[s->nb_qfs++] = s->hwctx->qf[i].idx; - } - } + if (!s->nb_qfs) + load_enabled_qfs(s); return (qf->queue_family = vk_qf_get_index(s, dev_family, &qf->nb_queues)); } |