[FFmpeg-cvslog] hwcontext_vulkan: fix p->img_qfs

Lynne git at videolan.org
Wed Sep 18 06:59:55 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Sep 18 05:36:43 2024 +0200| [32d47166c84dc2c636ec6830b07dc0ff3b566d25] | committer: Lynne

hwcontext_vulkan: fix p->img_qfs

The array was tied to our old queue API, which meant that if users
set it, it was never set.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32d47166c84dc2c636ec6830b07dc0ff3b566d25
---

 libavutil/hwcontext_vulkan.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 4fd321cd5c..8d050b823c 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1759,7 +1759,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
         tx_index    = (ctx_qf == tx_index)    ? -1 : tx_index;                                  \
         enc_index   = (ctx_qf == enc_index)   ? -1 : enc_index;                                 \
         dec_index   = (ctx_qf == dec_index)   ? -1 : dec_index;                                 \
-        p->img_qfs[p->nb_img_qfs++] = ctx_qf;                                                   \
     } while (0)
 
     CHECK_QUEUE("graphics", 0, graph_index, hwctx->queue_family_index,        hwctx->nb_graphics_queues);
@@ -1802,6 +1801,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    /* Setup array for pQueueFamilyIndices with used queue families */
+    p->nb_img_qfs = 0;
+    for (int i = 0; i < hwctx->nb_qf; i++) {
+        int seen = 0;
+        /* Make sure each entry is unique
+         * (VUID-VkBufferCreateInfo-sharingMode-01419) */
+        for (int j = (i - 1); j >= 0; j--) {
+            if (hwctx->qf[i].idx == hwctx->qf[j].idx) {
+                seen = 1;
+                break;
+            }
+        }
+        if (!seen)
+            p->img_qfs[p->nb_img_qfs++] = hwctx->qf[i].idx;
+    }
+
     if (!hwctx->lock_queue)
         hwctx->lock_queue = lock_queue;
     if (!hwctx->unlock_queue)



More information about the ffmpeg-cvslog mailing list