summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2023-06-03 18:32:02 -0700
committerPhilip Langdale <philipl@overt.org>2023-06-03 18:37:43 -0700
commitba6af0fb15c65ac1d8ca468b5d3aa29a32e9f8cc (patch)
tree3d6f9cda6cabba368fbc0567b8224ea10d5d9a36 /video/out
parentc8790a91730c78dda35194ed8ed28ebed8d2fafd (diff)
downloadmpv-ba6af0fb15c65ac1d8ca468b5d3aa29a32e9f8cc.tar.bz2
mpv-ba6af0fb15c65ac1d8ca468b5d3aa29a32e9f8cc.tar.xz
vulkan: don't assume all ra_ctx implementations have a swapchain
The dmabuf-wayland vo has a stub ra implementation that doesn't have a swapchain. That means that it's currently not safe to call ra_vk_ctx_get on that ra_ctx, but it must be safe to call on all ra implementations as this is how we discover if it is a vulkan ra. This hasn't been an issue before because no Vulkan code paths would be triggered when using dmabuf-wayland, but with the new vulkan hwdec, it becomes possible to trigger when hwdecs are probed.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vulkan/context.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c
index eb122d3a67..a478024233 100644
--- a/video/out/vulkan/context.c
+++ b/video/out/vulkan/context.c
@@ -121,7 +121,7 @@ static const struct ra_swapchain_fns vulkan_swapchain;
struct mpvk_ctx *ra_vk_ctx_get(struct ra_ctx *ctx)
{
- if (ctx->swapchain->fns != &vulkan_swapchain)
+ if (!ctx->swapchain || ctx->swapchain->fns != &vulkan_swapchain)
return NULL;
struct priv *p = ctx->swapchain->priv;