summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Boxer <boxerab@protonmail.com>2022-11-01 14:17:50 -0400
committerDudemanguy <random342@airmail.cc>2022-11-07 16:42:01 +0000
commit259eda4e2f5c02eef979123903c7661b0201fb44 (patch)
treeeb049efbcd2adf36976f86880c48a5375ffceda2
parent25906514c3aec87589833043f6281584946c98b4 (diff)
downloadmpv-259eda4e2f5c02eef979123903c7661b0201fb44.tar.bz2
mpv-259eda4e2f5c02eef979123903c7661b0201fb44.tar.xz
hwdec_vaapi: only set VADisplay resource if entire init process has succeeded
This resource is used by dmabuf_waland to decide if it should manage vaapi buffers, so it should not be set if vaapi init has failed
-rw-r--r--video/out/hwdec/hwdec_vaapi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c
index 9b1d191fb4..4b3a598ad7 100644
--- a/video/out/hwdec/hwdec_vaapi.c
+++ b/video/out/hwdec/hwdec_vaapi.c
@@ -52,11 +52,8 @@ static VADisplay *create_x11_va_display(struct ra *ra)
static VADisplay *create_wayland_va_display(struct ra *ra)
{
struct wl_display *wl = ra_get_native_resource(ra, "wl");
- VADisplay rc = wl ? vaGetDisplayWl(wl) : NULL;
- if (rc)
- ra_add_native_resource(ra, "VADisplay", rc);
- return rc;
+ return wl ? vaGetDisplayWl(wl) : NULL;
}
#endif
@@ -174,6 +171,9 @@ static int init(struct ra_hwdec *hw)
return -1;
}
+ // it's now safe to set the display resource
+ ra_add_native_resource(hw->ra, "VADisplay", p->display);
+
p->ctx->hwctx.hw_imgfmt = IMGFMT_VAAPI;
p->ctx->hwctx.supported_formats = p->formats;
p->ctx->hwctx.driver_name = hw->driver->name;