[FFmpeg-cvslog] hwcontext_vulkan: add the mapped software frame as an upload dependency

Lynne git at videolan.org
Mon Nov 18 08:55:25 EET 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Mon Nov 18 06:16:45 2024 +0100| [d0ab49e3e74e07dce6c3b8b0567812fdd9a708a5] | committer: Lynne

hwcontext_vulkan: add the mapped software frame as an upload dependency

We do uploads asynchronously, and we map the software frames in
order to avoid 2-stage copying. However, whilst we added a dependency
upon the mapped buffers, we did not add the original frame backing
those buffers as a dependency.

This caused issues on RADV, particularly with RGB images.

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

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

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index c2abaf8466..6a3f015031 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -4154,8 +4154,18 @@ static int vulkan_transfer_frame(AVHWFramesContext *hwfc,
     if (err < 0)
         goto end;
 
-    /* No need to declare buf deps for synchronous transfers */
+    /* No need to declare buf deps for synchronous transfers (downloads) */
     if (upload) {
+        /* Add the software frame backing the buffers if we're host mapping */
+        if (host_mapped) {
+            err = ff_vk_exec_add_dep_sw_frame(&p->vkctx, exec, swf);
+            if (err < 0) {
+                ff_vk_exec_discard_deps(&p->vkctx, exec);
+                goto end;
+            }
+        }
+
+        /* Add the buffers as a dependency */
         err = ff_vk_exec_add_dep_buf(&p->vkctx, exec, bufs, nb_bufs, 1);
         if (err < 0) {
             ff_vk_exec_discard_deps(&p->vkctx, exec);



More information about the ffmpeg-cvslog mailing list