vulkan: add ff_vk_qf_fill()

pull/389/head
Lynne 2 years ago
parent b5e333bba7
commit e8fce74abf
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 25
      libavutil/vulkan.c
  2. 9
      libavutil/vulkan.h

@ -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)
{

@ -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.

Loading…
Cancel
Save