diff mbox series

[FFmpeg-devel] avutil/hwcontext_vulkan: disable multiplane when deriving from cuda

Message ID 20230602233027.136273-1-philipl@overt.org
State New
Headers show
Series [FFmpeg-devel] avutil/hwcontext_vulkan: disable multiplane when deriving from cuda | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Philip Langdale June 2, 2023, 11:30 p.m. UTC
Today, cuda is not able to import multiplane images, and cuda requires
images to be imported whether you trying to import to cuda or export
from cuda (in the later case, the image is imported and then copied
into on the cuda side). So any interop between cuda and vulkan requires
that multiplane be disabled.

The existing option for this is not sufficient, because when deriving
devices it is not possible to specify any options.

And, it is necessary to derive the Vulkan device, because any pipeline
that involves uploading from cuda to vulkan and then back to cuda must
use the same cuda context on both sides, and the only way to propagate
the cuda context all the way through is to derive the device at each
stage.

ie:

-vf hwupload=derive_device=vulkan,<filters>,hwupload=derive_device=cuda

Signed-off-by: Philip Langdale <philipl@overt.org>
---
 libavutil/hwcontext_vulkan.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index e8241638d9..2c594317f9 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1589,6 +1589,11 @@  static int vulkan_device_derive(AVHWDeviceContext *ctx,
 
         dev_select.has_uuid = 1;
 
+        /*
+         * CUDA is not able to import multiplane images, so always derive a
+         * Vulkan device with multiplane disabled.
+         */
+        av_dict_set(&opts, "disable_multiplane", "1", 0);
         return vulkan_device_create_internal(ctx, &dev_select, opts, flags);
     }
 #endif