ffmpeg | branch: master | Lynne <d...@lynne.ee> | Sat Aug 31 23:27:21 2024 
+0000| [c41ef7f2ff809fe3cd47188d0bb95db1f15cf3bd] | committer: Lynne

hwcontext_vulkan: add PREP_MODE_GENERAL for non-transfer_dst images

Vulkan filters don't need images which can be transferred into.

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

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

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index e4f155db6e..383e75397e 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2187,6 +2187,7 @@ static int alloc_bind_mem(AVHWFramesContext *hwfc, 
AVVkFrame *f,
 }
 
 enum PrepMode {
+    PREP_MODE_GENERAL,
     PREP_MODE_WRITE,
     PREP_MODE_EXTERNAL_EXPORT,
     PREP_MODE_EXTERNAL_IMPORT,
@@ -2232,6 +2233,10 @@ static int prepare_frame(AVHWFramesContext *hwfc, 
FFVkExecPool *ectx,
         return err;
 
     switch (pmode) {
+    case PREP_MODE_GENERAL:
+        new_layout = VK_IMAGE_LAYOUT_GENERAL;
+        new_access = VK_ACCESS_TRANSFER_WRITE_BIT;
+        break;
     case PREP_MODE_WRITE:
         new_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
         new_access = VK_ACCESS_TRANSFER_WRITE_BIT;
@@ -2520,8 +2525,10 @@ static AVBufferRef *vulkan_pool_alloc(void *opaque, 
size_t size)
         err = prepare_frame(hwfc, &fp->compute_exec, f, 
PREP_MODE_DECODING_DST);
     else if (hwctx->usage & VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR)
         err = prepare_frame(hwfc, &fp->compute_exec, f, 
PREP_MODE_ENCODING_DPB);
-    else
+    else if (hwctx->usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT)
         err = prepare_frame(hwfc, &fp->compute_exec, f, PREP_MODE_WRITE);
+    else
+        err = prepare_frame(hwfc, &fp->compute_exec, f, PREP_MODE_GENERAL);
     if (err)
         goto fail;
 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to