summaryrefslogtreecommitdiffstats
path: root/video/decode/vaapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/decode/vaapi.c')
-rw-r--r--video/decode/vaapi.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index 5f9002762f..de26ac2955 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -187,6 +187,8 @@ static void destroy_decoder(struct lavc_ctx *ctx)
{
struct priv *p = ctx->hwdec_priv;
+ va_lock(p->ctx);
+
if (p->va_context->context_id != VA_INVALID_ID) {
vaDestroyContext(p->display, p->va_context->context_id);
p->va_context->context_id = VA_INVALID_ID;
@@ -197,6 +199,8 @@ static void destroy_decoder(struct lavc_ctx *ctx)
p->va_context->config_id = VA_INVALID_ID;
}
+ va_unlock(p->ctx);
+
mp_image_pool_clear(p->pool);
}
@@ -219,6 +223,8 @@ static int init_decoder(struct lavc_ctx *ctx, int fmt, int w, int h)
destroy_decoder(ctx);
+ va_lock(p->ctx);
+
const struct hwdec_profile_entry *pe = hwdec_find_profile(ctx, profiles);
if (!pe) {
MP_ERR(p, "Unsupported codec or profile.\n");
@@ -300,6 +306,7 @@ static int init_decoder(struct lavc_ctx *ctx, int fmt, int w, int h)
res = 0;
error:
+ va_unlock(p->ctx);
talloc_free(tmp);
return res;
}
@@ -455,6 +462,18 @@ static struct mp_image *copy_image(struct lavc_ctx *ctx, struct mp_image *img)
return img;
}
+static void intel_shit_lock(struct lavc_ctx *ctx)
+{
+ struct priv *p = ctx->hwdec_priv;
+ va_lock(p->ctx);
+}
+
+static void intel_crap_unlock(struct lavc_ctx *ctx)
+{
+ struct priv *p = ctx->hwdec_priv;
+ va_unlock(p->ctx);
+}
+
const struct vd_lavc_hwdec mp_vd_lavc_vaapi = {
.type = HWDEC_VAAPI,
.image_format = IMGFMT_VAAPI,
@@ -463,6 +482,8 @@ const struct vd_lavc_hwdec mp_vd_lavc_vaapi = {
.uninit = uninit,
.init_decoder = init_decoder,
.allocate_image = allocate_image,
+ .lock = intel_shit_lock,
+ .unlock = intel_crap_unlock,
};
const struct vd_lavc_hwdec mp_vd_lavc_vaapi_copy = {