[FFmpeg-devel] [PATCH 1/2] hwcontext_vulkan: add workaround for BROKEN nvidia crap

Lynne dev at lynne.ee
Mon Jun 16 22:30:22 EEST 2025


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

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 51be0c0d3b..f05b75110d 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2828,6 +2828,12 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
             return err;
     }
 
+    /* Nvidia is violating the spec because they thought no one would use this. */
+    if (p->dev_is_nvidia &&
+        (((fmt->nb_images == 1) && (fmt->vk_planes > 1)) ||
+         (av_pix_fmt_desc_get(hwfc->sw_format)->nb_components == 1)))
+        supported_usage &= ~VK_IMAGE_USAGE_HOST_TRANSFER_BIT;
+
     /* Image usage flags */
     if (!hwctx->usage) {
         hwctx->usage = supported_usage & (VK_IMAGE_USAGE_TRANSFER_DST_BIT |
-- 
2.49.0


More information about the ffmpeg-devel mailing list