summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_vulkan.h
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2021-11-07 08:16:11 +0100
committerLynne <dev@lynne.ee>2021-11-12 05:23:36 +0100
commit6bf9a6539e3db94ee88dd2a8e4816fadf10a4970 (patch)
treed56025f67ab520d3b9d92ef0a8bc7df5f912a579 /libavutil/hwcontext_vulkan.h
parentdfc61800a26747dc91bf00b0d841fc88a5d7473d (diff)
vulkan: add support for encode and decode queues and refactor queue code
This simplifies and makes queue family picking simpler and more robust. The requirements on the device context are relaxed. They made no sense in the first place. The video encode/decode extension is still in beta, at least on paper, but I really doubt they'd change needing a separate queue family.
Diffstat (limited to 'libavutil/hwcontext_vulkan.h')
-rw-r--r--libavutil/hwcontext_vulkan.h40
1 files changed, 26 insertions, 14 deletions
diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
index 9ac01e3b46..c83fe3fb1d 100644
--- a/libavutil/hwcontext_vulkan.h
+++ b/libavutil/hwcontext_vulkan.h
@@ -94,32 +94,44 @@ typedef struct AVVulkanDeviceContext {
int nb_enabled_dev_extensions;
/**
- * Queue family index for graphics
- * @note av_hwdevice_create() will set all 3 queue indices if unset
- * If there is no dedicated queue for compute or transfer operations,
- * they will be set to the graphics queue index which can handle both.
- * nb_graphics_queues indicates how many queues were enabled for the
- * graphics queue (must be at least 1)
+ * Queue family index for graphics operations, and the number of queues
+ * enabled for it. If unavaiable, will be set to -1. Not required.
+ * av_hwdevice_create() will attempt to find a dedicated queue for each
+ * queue family, or pick the one with the least unrelated flags set.
+ * Queue indices here may overlap if a queue has to share capabilities.
*/
int queue_family_index;
int nb_graphics_queues;
/**
- * Queue family index to use for transfer operations, and the amount of queues
- * enabled. In case there is no dedicated transfer queue, nb_tx_queues
- * must be 0 and queue_family_tx_index must be the same as either the graphics
- * queue or the compute queue, if available.
+ * Queue family index for transfer operations and the number of queues
+ * enabled. Required.
*/
int queue_family_tx_index;
int nb_tx_queues;
/**
- * Queue family index for compute ops, and the amount of queues enabled.
- * In case there are no dedicated compute queues, nb_comp_queues must be
- * 0 and its queue family index must be set to the graphics queue.
+ * Queue family index for compute operations and the number of queues
+ * enabled. Required.
*/
int queue_family_comp_index;
int nb_comp_queues;
+
+ /**
+ * Queue family index for video encode ops, and the amount of queues enabled.
+ * If the device doesn't support such, queue_family_encode_index will be -1.
+ * Not required.
+ */
+ int queue_family_encode_index;
+ int nb_encode_queues;
+
+ /**
+ * Queue family index for video decode ops, and the amount of queues enabled.
+ * If the device doesn't support such, queue_family_decode_index will be -1.
+ * Not required.
+ */
+ int queue_family_decode_index;
+ int nb_decode_queues;
} AVVulkanDeviceContext;
/**
@@ -158,7 +170,7 @@ typedef struct AVVulkanFramesContext {
* All frames, imported or allocated, will be created with the
* VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if needed.
*
- * If all three queue family indices in the device context are the same,
+ * If all queue family indices in the device context are the same,
* images will be created with the EXCLUSIVE sharing mode. Otherwise, all images
* will be created using the CONCURRENT sharing mode.
*