summaryrefslogtreecommitdiffstats
path: root/video/out/vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vulkan')
-rw-r--r--video/out/vulkan/context.c58
-rw-r--r--video/out/vulkan/context.h6
-rw-r--r--video/out/vulkan/context_android.c1
-rw-r--r--video/out/vulkan/context_display.c1
-rw-r--r--video/out/vulkan/context_mac.m1
-rw-r--r--video/out/vulkan/context_wayland.c1
-rw-r--r--video/out/vulkan/context_win.c1
-rw-r--r--video/out/vulkan/context_xlib.c1
8 files changed, 45 insertions, 25 deletions
diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c
index 82c878afec..196f6f468d 100644
--- a/video/out/vulkan/context.c
+++ b/video/out/vulkan/context.c
@@ -28,7 +28,6 @@
#include "video/out/placebo/utils.h"
#include "context.h"
-#include "utils.h"
struct vulkan_opts {
char *device; // force a specific GPU
@@ -174,19 +173,11 @@ void ra_vk_ctx_uninit(struct ra_ctx *ctx)
TA_FREEP(&ctx->swapchain);
}
-bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk,
- struct ra_vk_ctx_params params,
- VkPresentModeKHR preferred_mode)
+pl_vulkan mppl_create_vulkan(struct vulkan_opts *opts,
+ pl_vk_inst vkinst,
+ pl_log pllog,
+ VkSurfaceKHR surface)
{
- struct ra_swapchain *sw = ctx->swapchain = talloc_zero(NULL, struct ra_swapchain);
- sw->ctx = ctx;
- sw->fns = &vulkan_swapchain;
-
- struct priv *p = sw->priv = talloc_zero(sw, struct priv);
- p->vk = vk;
- p->params = params;
- p->opts = mp_get_config_group(p, ctx->global, &vulkan_conf);
-
VkPhysicalDeviceFeatures2 features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
};
@@ -224,30 +215,47 @@ bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk,
#endif
AVUUID param_uuid = { 0 };
- bool is_uuid = p->opts->device &&
- av_uuid_parse(p->opts->device, param_uuid) == 0;
+ bool is_uuid = opts->device &&
+ av_uuid_parse(opts->device, param_uuid) == 0;
- assert(vk->pllog);
- assert(vk->vkinst);
+ assert(pllog);
+ assert(vkinst);
struct pl_vulkan_params device_params = {
- .instance = vk->vkinst->instance,
- .get_proc_addr = vk->vkinst->get_proc_addr,
- .surface = vk->surface,
- .async_transfer = p->opts->async_transfer,
- .async_compute = p->opts->async_compute,
- .queue_count = p->opts->queue_count,
+ .instance = vkinst->instance,
+ .get_proc_addr = vkinst->get_proc_addr,
+ .surface = surface,
+ .async_transfer = opts->async_transfer,
+ .async_compute = opts->async_compute,
+ .queue_count = opts->queue_count,
#if HAVE_VULKAN_INTEROP
.extra_queues = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
.opt_extensions = opt_extensions,
.num_opt_extensions = MP_ARRAY_SIZE(opt_extensions),
#endif
.features = &features,
- .device_name = is_uuid ? NULL : p->opts->device,
+ .device_name = is_uuid ? NULL : opts->device,
};
if (is_uuid)
av_uuid_copy(device_params.device_uuid, param_uuid);
- vk->vulkan = pl_vulkan_create(vk->pllog, &device_params);
+ return pl_vulkan_create(pllog, &device_params);
+
+}
+
+bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk,
+ struct ra_vk_ctx_params params,
+ VkPresentModeKHR preferred_mode)
+{
+ struct ra_swapchain *sw = ctx->swapchain = talloc_zero(NULL, struct ra_swapchain);
+ sw->ctx = ctx;
+ sw->fns = &vulkan_swapchain;
+
+ struct priv *p = sw->priv = talloc_zero(sw, struct priv);
+ p->vk = vk;
+ p->params = params;
+ p->opts = mp_get_config_group(p, ctx->global, &vulkan_conf);
+
+ vk->vulkan = mppl_create_vulkan(p->opts, vk->vkinst, vk->pllog, vk->surface);
if (!vk->vulkan)
goto error;
diff --git a/video/out/vulkan/context.h b/video/out/vulkan/context.h
index c846942b0e..32f08bf2d8 100644
--- a/video/out/vulkan/context.h
+++ b/video/out/vulkan/context.h
@@ -21,6 +21,12 @@ bool ra_vk_ctx_init(struct ra_ctx *ctx, struct mpvk_ctx *vk,
struct ra_vk_ctx_params params,
VkPresentModeKHR preferred_mode);
+// Helper for initializing mpvk_ctx->vulkan
+pl_vulkan mppl_create_vulkan(struct vulkan_opts *opts,
+ pl_vk_inst vkinst,
+ pl_log pllog,
+ VkSurfaceKHR surface);
+
// Handles a resize request, and updates ctx->vo->dwidth/dheight
bool ra_vk_ctx_resize(struct ra_ctx *ctx, int width, int height);
diff --git a/video/out/vulkan/context_android.c b/video/out/vulkan/context_android.c
index ddab3917f1..d668bb4b94 100644
--- a/video/out/vulkan/context_android.c
+++ b/video/out/vulkan/context_android.c
@@ -89,6 +89,7 @@ static int android_control(struct ra_ctx *ctx, int *events, int request, void *a
const struct ra_ctx_fns ra_ctx_vulkan_android = {
.type = "vulkan",
.name = "androidvk",
+ .description = "Android/Vulkan",
.reconfig = android_reconfig,
.control = android_control,
.init = android_init,
diff --git a/video/out/vulkan/context_display.c b/video/out/vulkan/context_display.c
index 72f73adb20..7e3bc8ea2f 100644
--- a/video/out/vulkan/context_display.c
+++ b/video/out/vulkan/context_display.c
@@ -486,6 +486,7 @@ static void display_wait_events(struct ra_ctx *ctx, int64_t until_time_ns)
const struct ra_ctx_fns ra_ctx_vulkan_display = {
.type = "vulkan",
.name = "displayvk",
+ .description = "VK_KHR_display",
.reconfig = display_reconfig,
.control = display_control,
.wakeup = display_wakeup,
diff --git a/video/out/vulkan/context_mac.m b/video/out/vulkan/context_mac.m
index bedd0d4f9e..66093dd110 100644
--- a/video/out/vulkan/context_mac.m
+++ b/video/out/vulkan/context_mac.m
@@ -128,6 +128,7 @@ static int mac_vk_control(struct ra_ctx *ctx, int *events, int request, void *ar
const struct ra_ctx_fns ra_ctx_vulkan_mac = {
.type = "vulkan",
.name = "macvk",
+ .description = "mac/Vulkan (via Metal)",
.reconfig = mac_vk_reconfig,
.control = mac_vk_control,
.init = mac_vk_init,
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index cdf1ba60b8..3af644ab8a 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -157,6 +157,7 @@ static void wayland_vk_update_render_opts(struct ra_ctx *ctx)
const struct ra_ctx_fns ra_ctx_vulkan_wayland = {
.type = "vulkan",
.name = "waylandvk",
+ .description = "Wayland/Vulkan",
.reconfig = wayland_vk_reconfig,
.control = wayland_vk_control,
.wakeup = wayland_vk_wakeup,
diff --git a/video/out/vulkan/context_win.c b/video/out/vulkan/context_win.c
index 328753fa69..6484a31355 100644
--- a/video/out/vulkan/context_win.c
+++ b/video/out/vulkan/context_win.c
@@ -107,6 +107,7 @@ static void win_update_render_opts(struct ra_ctx *ctx)
const struct ra_ctx_fns ra_ctx_vulkan_win = {
.type = "vulkan",
.name = "winvk",
+ .description = "Win32/Vulkan",
.reconfig = win_reconfig,
.control = win_control,
.update_render_opts = win_update_render_opts,
diff --git a/video/out/vulkan/context_xlib.c b/video/out/vulkan/context_xlib.c
index 673dc312b7..dadfabdeb8 100644
--- a/video/out/vulkan/context_xlib.c
+++ b/video/out/vulkan/context_xlib.c
@@ -134,6 +134,7 @@ static void xlib_wait_events(struct ra_ctx *ctx, int64_t until_time_ns)
const struct ra_ctx_fns ra_ctx_vulkan_xlib = {
.type = "vulkan",
.name = "x11vk",
+ .description = "X11/Vulkan",
.reconfig = xlib_reconfig,
.control = xlib_control,
.wakeup = xlib_wakeup,