[FFmpeg-cvslog] hwcontext_vulkan: use GPU memcpy when copying to system RAM

Lynne git at videolan.org
Sat Aug 14 01:54:39 EEST 2021


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Tue Aug 10 12:47:06 2021 +0200| [1c5610824a035604b32cb90d371f29e9d7e23607] | committer: Lynne

hwcontext_vulkan: use GPU memcpy when copying to system RAM

This should speed it up significantly on systems where it matters.

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

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

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index b7da6a7e32..94fdad7f06 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -3424,7 +3424,7 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf,
     }
 
     if (!from) {
-        /* Map, copy image to buffer, unmap */
+        /* Map, copy image TO buffer (which then goes to the VkImage), unmap */
         if ((err = map_buffers(dev_ctx, bufs, tmp.data, planes, 0)))
             goto end;
 
@@ -3449,7 +3449,7 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf,
                              swf->width, swf->height, swf->format, from);
 
     if (from) {
-        /* Map, copy image to buffer, unmap */
+        /* Map, copy buffer (which came FROM the VkImage) to the frame, unmap */
         if ((err = map_buffers(dev_ctx, bufs, tmp.data, planes, 0)))
             goto end;
 
@@ -3459,10 +3459,10 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf,
 
             get_plane_wh(&p_w, &p_h, swf->format, swf->width, swf->height, i);
 
-            av_image_copy_plane(swf->data[i], swf->linesize[i],
-                                (const uint8_t *)tmp.data[i], tmp.linesize[i],
-                                FFMIN(tmp.linesize[i], FFABS(swf->linesize[i])),
-                                p_h);
+            av_image_copy_plane_uc_from(swf->data[i], swf->linesize[i],
+                                        (const uint8_t *)tmp.data[i], tmp.linesize[i],
+                                        FFMIN(tmp.linesize[i], FFABS(swf->linesize[i])),
+                                        p_h);
         }
 
         if ((err = unmap_buffers(dev_ctx, bufs, planes, 1)))



More information about the ffmpeg-cvslog mailing list