summaryrefslogtreecommitdiffstats
path: root/video/out/vulkan
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2018-12-30 14:59:48 -0800
committersfan5 <sfan5@live.de>2019-07-08 01:57:02 +0200
commitb70ed35ba4ea8c08632e585b7027090ac00a0bb8 (patch)
tree3f3f749e3750a81d0eb5b5b02bda63d6bcf4e1bc /video/out/vulkan
parent6842755feb04a7a9e0820b3e999586cb54e329e3 (diff)
downloadmpv-b70ed35ba4ea8c08632e585b7027090ac00a0bb8.tar.bz2
mpv-b70ed35ba4ea8c08632e585b7027090ac00a0bb8.tar.xz
vo_gpu: hwdec_vaapi: Add Vulkan interop
This change introduces a vulkan interop path for the vaapi hwdec. The basic principles are mostly the same as for EGL, with the exported dma_buf being imported by Vukan. The biggest difference is that we cannot reuse the texture as we do with OpenGL - there's no way to rebind a VkImage to a different piece of memory, as far as I can see. So, a new texture is created on each map call. I did not bother implementing a code path for the old libva API as I think it's safe to assume any system with a working vulkan driver will have access to a newer libva. Note that we are using separate layers for the vaapi surface, just as is done for EGL. This is because libplacebo doesn't support multiplane images. This change does not include format negotiation because no driver implements the vk_ext_image_drm_format_modifier extension that would be required to do that. In practice, the two formats we care about (nv12, p010) work correctly, so we are not blocked. A separate change had to be made in libplacebo to filter out non-fatal validation errors related to surface sizes due to the lack of format negotiation.
Diffstat (limited to 'video/out/vulkan')
-rw-r--r--video/out/vulkan/context_wayland.c2
-rw-r--r--video/out/vulkan/context_xlib.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index f1091a534f..160e8f9da4 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -69,6 +69,8 @@ static bool wayland_vk_init(struct ra_ctx *ctx)
if (!ra_vk_ctx_init(ctx, vk, VK_PRESENT_MODE_MAILBOX_KHR))
goto error;
+ ra_add_native_resource(ctx->ra, "wl", ctx->vo->wl->display);
+
return true;
error:
diff --git a/video/out/vulkan/context_xlib.c b/video/out/vulkan/context_xlib.c
index 9baa7c4dc4..e2fc732e00 100644
--- a/video/out/vulkan/context_xlib.c
+++ b/video/out/vulkan/context_xlib.c
@@ -66,6 +66,8 @@ static bool xlib_init(struct ra_ctx *ctx)
if (!ra_vk_ctx_init(ctx, vk, VK_PRESENT_MODE_FIFO_KHR))
goto error;
+ ra_add_native_resource(ctx->ra, "x11", ctx->vo->x11->display);
+
return true;
error: