diff options
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/gl_hwdec_vaglx.c | 6 | ||||
-rw-r--r-- | video/out/vo_vaapi.c | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/video/out/gl_hwdec_vaglx.c b/video/out/gl_hwdec_vaglx.c index 08c7f4957f..665b800efb 100644 --- a/video/out/gl_hwdec_vaglx.c +++ b/video/out/gl_hwdec_vaglx.c @@ -42,7 +42,9 @@ static void destroy_texture(struct gl_hwdec *hw) VAStatus status; if (p->vaglx_surface) { + va_lock(p->ctx); status = vaDestroySurfaceGLX(p->display, p->vaglx_surface); + va_unlock(p->ctx); CHECK_VA_STATUS(p, "vaDestroySurfaceGLX()"); p->vaglx_surface = NULL; } @@ -98,8 +100,10 @@ static int reinit(struct gl_hwdec *hw, const struct mp_image_params *params) GL_RGBA, GL_UNSIGNED_BYTE, NULL); gl->BindTexture(GL_TEXTURE_2D, 0); + va_lock(p->ctx); status = vaCreateSurfaceGLX(p->display, GL_TEXTURE_2D, p->gl_texture, &p->vaglx_surface); + va_unlock(p->ctx); return CHECK_VA_STATUS(p, "vaCreateSurfaceGLX()") ? 0 : -1; } @@ -112,9 +116,11 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, if (!p->vaglx_surface) return -1; + va_lock(p->ctx); status = vaCopySurfaceGLX(p->display, p->vaglx_surface, va_surface_id(hw_image), va_get_colorspace_flag(hw_image->params.colorspace)); + va_unlock(p->ctx); if (!CHECK_VA_STATUS(p, "vaCopySurfaceGLX()")) return -1; diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index 3c760ac07c..fa23c931c6 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -212,6 +212,8 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) if (surface == VA_INVALID_ID) return false; + va_lock(p->mpvaapi); + for (int n = 0; n < MAX_OSD_PARTS; n++) { struct vaapi_osd_part *part = &p->osd_parts[n]; if (part->active) { @@ -261,6 +263,8 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) } } + va_unlock(p->mpvaapi); + return true; } @@ -427,6 +431,8 @@ static void draw_osd(struct vo *vo) if (!p->osd_format.fourcc) return; + va_lock(p->mpvaapi); + struct mp_osd_res vid_res = osd_res_from_image_params(vo->params); struct mp_osd_res *res; @@ -439,6 +445,8 @@ static void draw_osd(struct vo *vo) for (int n = 0; n < MAX_OSD_PARTS; n++) p->osd_parts[n].active = false; osd_draw(vo->osd, *res, pts, 0, osd_formats, draw_osd_cb, p); + + va_unlock(p->mpvaapi); } static int get_displayattribtype(const char *name) @@ -495,7 +503,9 @@ static int set_equalizer(struct priv *p, const char *name, int value) return VO_NOTIMPL; attr->value = ((value + 100) * r) / 200 + attr->min_value; + va_lock(p->mpvaapi); status = vaSetDisplayAttributes(p->display, attr, 1); + va_unlock(p->mpvaapi); if (!CHECK_VA_STATUS(p, "vaSetDisplayAttributes()")) return VO_FALSE; return VO_TRUE; |