diff options
author | Lynne <dev@lynne.ee> | 2024-12-03 15:31:49 +0900 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-12-23 04:25:09 +0900 |
commit | 2e06b84e2747ef4ea4d9f5c20c936aa866f7647d (patch) | |
tree | ba037209826667bf2eb78796b180b673e40b36dc /libavutil/vulkan.c | |
parent | 157cd820adbbfcfd1870a6ce12d072dc0f623e9b (diff) | |
download | ffmpeg-2e06b84e2747ef4ea4d9f5c20c936aa866f7647d.tar.gz |
vulkan: do not reinvent a queue context struct
We recently introduced a public field which was a superset
of the queue context we used to have.
Switch to using it entirely.
This also allows us to get rid of the NIH function which was
valid only for video queues.
Diffstat (limited to 'libavutil/vulkan.c')
-rw-r--r-- | libavutil/vulkan.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 55b039d5ef..7315af928f 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -217,26 +217,17 @@ int ff_vk_load_props(FFVulkanContext *s) return 0; } -static int vk_qf_get_index(FFVulkanContext *s, VkQueueFlagBits dev_family, int *nb) +AVVulkanDeviceQueueFamily *ff_vk_qf_find(FFVulkanContext *s, + VkQueueFlagBits dev_family, + VkVideoCodecOperationFlagBitsKHR vid_ops) { for (int i = 0; i < s->hwctx->nb_qf; i++) { - if (s->hwctx->qf[i].flags & dev_family) { - *nb = s->hwctx->qf[i].num; - return s->hwctx->qf[i].idx; + if ((s->hwctx->qf[i].flags & dev_family) && + (s->hwctx->qf[i].video_caps & vid_ops) == vid_ops) { + return &s->hwctx->qf[i]; } } - - av_assert0(0); /* Should never happen */ -} - -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) - load_enabled_qfs(s); - - return (qf->queue_family = vk_qf_get_index(s, dev_family, &qf->nb_queues)); + return NULL; } void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool) @@ -302,7 +293,7 @@ void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool) av_free(pool->contexts); } -int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, +int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *qf, FFVkExecPool *pool, int nb_contexts, int nb_queries, VkQueryType query_type, int query_64bit, const void *query_create_pnext) @@ -330,7 +321,7 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, .flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, - .queueFamilyIndex = qf->queue_family, + .queueFamilyIndex = qf->idx, }; ret = vk->CreateCommandPool(s->hwctx->act_dev, &cqueue_create, s->hwctx->alloc, &pool->cmd_buf_pool); @@ -443,10 +434,9 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, e->buf = pool->cmd_bufs[i]; /* Queue index distribution */ - e->qi = i % qf->nb_queues; - e->qf = qf->queue_family; - vk->GetDeviceQueue(s->hwctx->act_dev, qf->queue_family, - e->qi, &e->queue); + e->qi = i % qf->num; + e->qf = qf->idx; + vk->GetDeviceQueue(s->hwctx->act_dev, qf->idx, e->qi, &e->queue); } return 0; |