summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2019-12-18 17:11:36 -0800
committerPhilip Langdale <github.philipl@overt.org>2021-06-11 09:54:16 -0700
commitdbf0fd7d60fa7b4996a3dd96101abd627768e9df (patch)
tree3f95c32edc783d8948920c170d5a44e3445cb9a8 /video/out
parent1b8f10f54af115e5c8a103282d9c8e6066709161 (diff)
downloadmpv-dbf0fd7d60fa7b4996a3dd96101abd627768e9df.tar.bz2
mpv-dbf0fd7d60fa7b4996a3dd96101abd627768e9df.tar.xz
vo_gpu: vulkan: provide a helper to access device name option
The VkDisplayKHR context type requires making calls against the physical device before the libplacebo context is initialised. That means we can't simply use the physical device object that libplacebo would create - instead we have to create a separate one, but make sure it's referring to the same physical device. To that end, we need the device name that the user may have requested so we can pass it on.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vulkan/context.c14
-rw-r--r--video/out/vulkan/context.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c
index 9bdeb14d9b..efc62a2552 100644
--- a/video/out/vulkan/context.c
+++ b/video/out/vulkan/context.c
@@ -221,6 +221,20 @@ bool ra_vk_ctx_resize(struct ra_ctx *ctx, int width, int height)
return ok;
}
+char *ra_vk_ctx_get_device_name(struct ra_ctx *ctx)
+{
+ /*
+ * This implementation is a bit odd because it has to work even if the
+ * ctx hasn't been initialised yet. A context implementation may need access
+ * to the device name before it can fully initialise the ctx.
+ */
+ struct vulkan_opts *opts = mp_get_config_group(NULL, ctx->global,
+ &vulkan_conf);
+ char *device_name = talloc_strdup(NULL, opts->device);
+ talloc_free(opts);
+ return device_name;
+}
+
static int color_depth(struct ra_swapchain *sw)
{
return 0; // TODO: implement this somehow?
diff --git a/video/out/vulkan/context.h b/video/out/vulkan/context.h
index 6ae64bb0f5..d85b3fe193 100644
--- a/video/out/vulkan/context.h
+++ b/video/out/vulkan/context.h
@@ -25,3 +25,6 @@ bool ra_vk_ctx_resize(struct ra_ctx *ctx, int width, int height);
// May be called on a ra_ctx of any type.
struct mpvk_ctx *ra_vk_ctx_get(struct ra_ctx *ctx);
+
+// Get the user requested Vulkan device name.
+char *ra_vk_ctx_get_device_name(struct ra_ctx *ctx); \ No newline at end of file