]> git.sesse.net Git - ffmpeg/commitdiff
hwcontext_vulkan: expose the amount of queues for each queue family
authorLynne <dev@lynne.ee>
Wed, 13 May 2020 15:20:15 +0000 (16:20 +0100)
committerLynne <dev@lynne.ee>
Sat, 23 May 2020 18:07:29 +0000 (19:07 +0100)
This, along with the next patch, are the last missing pieces to being
interoperable with libplacebo.

libavutil/hwcontext_vulkan.c
libavutil/hwcontext_vulkan.h

index b40974dce4643ebb6f43f2579690e6685a0416d0..2fb9c5dbfa1006bbfeed1077296c5b7b871c1646 100644 (file)
@@ -679,16 +679,19 @@ static int search_queue_families(AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd)
     hwctx->queue_family_index      = graph_index;
     hwctx->queue_family_comp_index = graph_index;
     hwctx->queue_family_tx_index   = graph_index;
+    hwctx->nb_graphics_queues      = qs[graph_index].queueCount;
 
     if (comp_index != -1) {
         ADD_QUEUE(comp_index, 0, 1, tx_index < 0)
         hwctx->queue_family_tx_index   = comp_index;
         hwctx->queue_family_comp_index = comp_index;
+        hwctx->nb_comp_queues          = qs[comp_index].queueCount;
     }
 
     if (tx_index != -1) {
         ADD_QUEUE(tx_index, 0, 0, 1)
         hwctx->queue_family_tx_index = tx_index;
+        hwctx->nb_tx_queues          = qs[tx_index].queueCount;
     }
 
 #undef ADD_QUEUE
index c3fc14af70514d9a10306466fd53c214f5f6694f..9fbe8b9dcbc9f2e34c6433d1be0d6ce5e0f0b7ad 100644 (file)
@@ -55,16 +55,26 @@ typedef struct AVVulkanDeviceContext {
      * @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)
      */
     int queue_family_index;
+    int nb_graphics_queues;
     /**
-     * Queue family index for transfer ops only
+     * 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.
      */
     int queue_family_tx_index;
+    int nb_tx_queues;
     /**
-     * Queue family index for compute ops
+     * 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.
      */
     int queue_family_comp_index;
+    int nb_comp_queues;
     /**
      * Enabled instance extensions. By default, VK_KHR_surface is enabled if found.
      * If supplying your own device context, set this to an array of strings, with