diff options
author | Niklas Haas <git@haasn.xyz> | 2018-11-10 12:53:33 +0100 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2019-04-21 23:55:22 +0300 |
commit | 7006d6752d7da21870dfdb2b0d7640a3734f748c (patch) | |
tree | 035ca58d22de438e834d212e97b73d03a4248d98 /video/out/vulkan/context_wayland.c | |
parent | 9f7dcc0726ab635fb34fb7310e54b1aec9467f14 (diff) | |
download | mpv-7006d6752d7da21870dfdb2b0d7640a3734f748c.tar.bz2 mpv-7006d6752d7da21870dfdb2b0d7640a3734f748c.tar.xz |
vo_gpu: vulkan: use libplacebo instead
This commit rips out the entire mpv vulkan implementation in favor of
exposing lightweight wrappers on top of libplacebo instead, which
provides much of the same except in a more up-to-date and polished form.
This (finally) unifies the code base between mpv and libplacebo, which
is something I've been hoping to do for a long time.
Note: The ra_pl wrappers are abstract enough from the actual libplacebo
device type that we can in theory re-use them for other devices like
d3d11 or even opengl in the future, so I moved them to a separate
directory for the time being. However, the rest of the code is still
vulkan-specific, so I've kept the "vulkan" naming and file paths, rather
than introducing a new `--gpu-api` type. (Which would have been ended up
with significantly more code duplicaiton)
Plus, the code and functionality is similar enough that for most users
this should just be a straight-up drop-in replacement.
Note: This commit excludes some changes; specifically, the updates to
context_win and hwdec_cuda are deferred to separate commits for
authorship reasons.
Diffstat (limited to 'video/out/vulkan/context_wayland.c')
-rw-r--r-- | video/out/vulkan/context_wayland.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c index 7276775242..f1091a534f 100644 --- a/video/out/vulkan/context_wayland.c +++ b/video/out/vulkan/context_wayland.c @@ -41,8 +41,7 @@ static bool wayland_vk_init(struct ra_ctx *ctx) struct mpvk_ctx *vk = &p->vk; int msgl = ctx->opts.probing ? MSGL_V : MSGL_ERR; - if (!mpvk_instance_init(vk, ctx->log, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, - ctx->opts.debug)) + if (!mpvk_init(vk, ctx, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME)) goto error; if (!vo_wayland_init(ctx->vo)) @@ -54,10 +53,10 @@ static bool wayland_vk_init(struct ra_ctx *ctx) .surface = ctx->vo->wl->surface, }; - VkResult res = vkCreateWaylandSurfaceKHR(vk->inst, &wlinfo, MPVK_ALLOCATOR, - &vk->surf); + VkInstance inst = vk->vkinst->instance; + VkResult res = vkCreateWaylandSurfaceKHR(inst, &wlinfo, NULL, &vk->surface); if (res != VK_SUCCESS) { - MP_MSG(ctx, msgl, "Failed creating Wayland surface: %s\n", vk_err(res)); + MP_MSG(ctx, msgl, "Failed creating Wayland surface\n"); goto error; } @@ -77,7 +76,7 @@ error: return false; } -static void resize(struct ra_ctx *ctx) +static bool resize(struct ra_ctx *ctx) { struct vo_wayland_state *wl = ctx->vo->wl; @@ -87,9 +86,7 @@ static void resize(struct ra_ctx *ctx) const int32_t height = wl->scaling*mp_rect_h(wl->geometry); wl_surface_set_buffer_scale(wl->surface, wl->scaling); - - wl->vo->dwidth = width; - wl->vo->dheight = height; + return ra_vk_ctx_resize(ctx, width, height); } static bool wayland_vk_reconfig(struct ra_ctx *ctx) @@ -104,8 +101,7 @@ static int wayland_vk_control(struct ra_ctx *ctx, int *events, int request, void { int ret = vo_wayland_control(ctx->vo, events, request, arg); if (*events & VO_EVENT_RESIZE) { - resize(ctx); - if (ra_vk_ctx_resize(ctx->swapchain, ctx->vo->dwidth, ctx->vo->dheight)) + if (!resize(ctx)) return VO_ERROR; } return ret; |