aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libavutil/vulkan.c25
-rw-r--r--libavutil/vulkan.h9
2 files changed, 34 insertions, 0 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index ae6adc5104..eceef295a8 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -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)
{
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index c6cfb779fc..4540c3eda1 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -207,6 +207,9 @@ typedef struct FFVulkanContext {
AVHWFramesContext *frames;
AVVulkanFramesContext *hwfc;
+ uint32_t qfs[5];
+ int nb_qfs;
+
FFVkSPIRVCompiler *spirv_compiler;
/* Properties */
@@ -250,6 +253,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.
*/