1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-03 14:32:16 +02:00

vulkan: add ff_vk_qf_fill()

This commit is contained in:
Lynne 2022-11-23 13:03:58 +01:00
parent b5e333bba7
commit e8fce74abf
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
2 changed files with 34 additions and 0 deletions

View File

@ -108,6 +108,31 @@ const char *ff_vk_ret2str(VkResult res)
#undef CASE
}
void ff_vk_qf_fill(FFVulkanContext *s)
{
s->nb_qfs = 0;
/* Simply fills in all unique queues into s->qfs */
if (s->hwctx->queue_family_index >= 0)
s->qfs[s->nb_qfs++] = s->hwctx->queue_family_index;
if (!s->nb_qfs || s->qfs[0] != s->hwctx->queue_family_tx_index)
s->qfs[s->nb_qfs++] = s->hwctx->queue_family_tx_index;
if (!s->nb_qfs || (s->qfs[0] != s->hwctx->queue_family_comp_index &&
s->qfs[1] != s->hwctx->queue_family_comp_index))
s->qfs[s->nb_qfs++] = s->hwctx->queue_family_comp_index;
if (s->hwctx->queue_family_decode_index >= 0 &&
(s->qfs[0] != s->hwctx->queue_family_decode_index &&
s->qfs[1] != s->hwctx->queue_family_decode_index &&
s->qfs[2] != s->hwctx->queue_family_decode_index))
s->qfs[s->nb_qfs++] = s->hwctx->queue_family_decode_index;
if (s->hwctx->queue_family_encode_index >= 0 &&
(s->qfs[0] != s->hwctx->queue_family_encode_index &&
s->qfs[1] != s->hwctx->queue_family_encode_index &&
s->qfs[2] != s->hwctx->queue_family_encode_index &&
s->qfs[3] != s->hwctx->queue_family_encode_index))
s->qfs[s->nb_qfs++] = s->hwctx->queue_family_encode_index;
}
void ff_vk_qf_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf,
VkQueueFlagBits dev_family, int nb_queues)
{

View File

@ -207,6 +207,9 @@ typedef struct FFVulkanContext {
AVHWFramesContext *frames;
AVVulkanFramesContext *hwfc;
uint32_t qfs[5];
int nb_qfs;
FFVkSPIRVCompiler *spirv_compiler;
/* Properties */
@ -249,6 +252,12 @@ int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt);
*/
const char *ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt);
/**
* Setup the queue families from the hardware device context.
* Necessary for image creation to work.
*/
void ff_vk_qf_fill(FFVulkanContext *s);
/**
* Initialize a queue family with a specific number of queues.
* If nb_queues == 0, use however many queues the queue family has.