You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user