summaryrefslogtreecommitdiffstats
path: root/video/out/vulkan/ra_vk.h
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2018-09-29 17:56:07 -0700
committersfan5 <sfan5@live.de>2018-10-22 21:35:48 +0200
commit93f800a00f3f8ef416082e0a3f9d34d979a1e9a6 (patch)
treeb5108b3c2f4f4357adf0f9921c6b59a6c8e162e6 /video/out/vulkan/ra_vk.h
parent6fbd933108a74bbd3a375be1456692320a97380e (diff)
downloadmpv-93f800a00f3f8ef416082e0a3f9d34d979a1e9a6.tar.bz2
mpv-93f800a00f3f8ef416082e0a3f9d34d979a1e9a6.tar.xz
vo_gpu: vulkan: Add support for exporting buffer memory
The CUDA/Vulkan interop works on the basis of memory being exported from Vulkan and then imported by CUDA. To enable this, we add a way to declare a buffer as being intended for export, and then add a function to do the export. For now, we support the fd and Handle based exports on Linux and Windows respectively. There are others, which we can support when a need arises. Also note that this is just for exporting buffers, rather than textures (VkImages). Image import on the CUDA side is supposed to work, but it is currently buggy and waiting for a new driver release. Finally, at least with my nvidia hardware and drivers, everything seems to work even if we don't initialise the buffer with the right exportability options. Nevertheless I'm enforcing it so that we're following the spec.
Diffstat (limited to 'video/out/vulkan/ra_vk.h')
-rw-r--r--video/out/vulkan/ra_vk.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/video/out/vulkan/ra_vk.h b/video/out/vulkan/ra_vk.h
index da613c7f5b..89eb310146 100644
--- a/video/out/vulkan/ra_vk.h
+++ b/video/out/vulkan/ra_vk.h
@@ -29,3 +29,17 @@ struct vk_cmd *ra_vk_submit(struct ra *ra, struct ra_tex *tex);
// May be called on a struct ra of any type. Returns NULL if the ra is not
// a vulkan ra.
struct mpvk_ctx *ra_vk_get(struct ra *ra);
+
+struct vk_external_mem {
+#if HAVE_WIN32_DESKTOP
+ HANDLE mem_handle;
+#else
+ int mem_fd;
+#endif
+ size_t mem_size;
+ size_t size;
+ size_t offset;
+};
+
+// Export an ra_buf for importing by another api.
+bool ra_vk_buf_get_external_info(struct ra *ra, struct ra_buf *buf, struct vk_external_mem *ret);