[FFmpeg-cvslog] vulkan: load queue families upon loading properties
Lynne
git at videolan.org
Sun Aug 11 06:21:27 EEST 2024
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sat Aug 10 21:51:32 2024 +0200| [d6c08a41cb576ad2e160761a0bfd44cf9e3b6232] | committer: Lynne
vulkan: load queue families upon loading properties
Avoids the need to call ff_vk_qf_init if manually filling in
a queue family structure.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6c08a41cb576ad2e160761a0bfd44cf9e3b6232
---
libavutil/vulkan.c | 41 +++++++++++++++++++++++------------------
1 file 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));
}
More information about the ffmpeg-cvslog
mailing list