diff options
-rw-r--r-- | video/decode/hw_vaapi.c | 14 | ||||
-rw-r--r-- | video/decode/hw_vaapi_old.c | 21 | ||||
-rw-r--r-- | video/out/opengl/hwdec_vaegl.c | 8 | ||||
-rw-r--r-- | video/out/opengl/hwdec_vaglx.c | 2 | ||||
-rw-r--r-- | video/out/vo_vaapi.c | 10 | ||||
-rw-r--r-- | video/vaapi.c | 28 | ||||
-rw-r--r-- | video/vaapi.h | 4 |
7 files changed, 2 insertions, 85 deletions
diff --git a/video/decode/hw_vaapi.c b/video/decode/hw_vaapi.c index 45558cd6e7..2dba5a99bd 100644 --- a/video/decode/hw_vaapi.c +++ b/video/decode/hw_vaapi.c @@ -142,18 +142,6 @@ static int init_copy(struct lavc_ctx *ctx) return init(ctx, false); } -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, @@ -162,8 +150,6 @@ const struct vd_lavc_hwdec mp_vd_lavc_vaapi = { .init = init_direct, .uninit = uninit, .init_decoder = init_decoder, - .lock = intel_shit_lock, - .unlock = intel_crap_unlock, }; const struct vd_lavc_hwdec mp_vd_lavc_vaapi_copy = { diff --git a/video/decode/hw_vaapi_old.c b/video/decode/hw_vaapi_old.c index 9c0907d0d4..88379dfed8 100644 --- a/video/decode/hw_vaapi_old.c +++ b/video/decode/hw_vaapi_old.c @@ -170,8 +170,6 @@ 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; @@ -182,8 +180,6 @@ 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); } @@ -206,8 +202,6 @@ static int init_decoder(struct lavc_ctx *ctx, 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"); @@ -282,7 +276,6 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h) res = 0; error: - va_unlock(p->ctx); talloc_free(tmp); return res; } @@ -404,18 +397,6 @@ 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, @@ -424,8 +405,6 @@ 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, .process_image = update_format, }; diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c index 4b164ab407..a66ad7f390 100644 --- a/video/out/opengl/hwdec_vaegl.c +++ b/video/out/opengl/hwdec_vaegl.c @@ -146,8 +146,6 @@ static void unmap_frame(struct gl_hwdec *hw) p->images[n] = 0; } - va_lock(p->ctx); - if (p->buffer_acquired) { status = vaReleaseBufferHandle(p->display, p->current_image.buf); CHECK_VA_STATUS(p, "vaReleaseBufferHandle()"); @@ -158,8 +156,6 @@ static void unmap_frame(struct gl_hwdec *hw) CHECK_VA_STATUS(p, "vaDestroyImage()"); p->current_image.image_id = VA_INVALID_ID; } - - va_unlock(p->ctx); } static void destroy_textures(struct gl_hwdec *hw) @@ -310,8 +306,6 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image, unmap_frame(hw); - va_lock(p->ctx); - status = vaDeriveImage(p->display, va_surface_id(hw_image), va_image); if (!CHECK_VA_STATUS(p, "vaDeriveImage()")) goto err; @@ -385,11 +379,9 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image, if (va_image->format.fourcc == VA_FOURCC_YV12) MPSWAP(struct gl_hwdec_plane, out_frame->planes[1], out_frame->planes[2]); - va_unlock(p->ctx); return 0; err: - va_unlock(p->ctx); if (!p->probing_formats) MP_FATAL(p, "mapping VAAPI EGL image failed\n"); unmap_frame(hw); diff --git a/video/out/opengl/hwdec_vaglx.c b/video/out/opengl/hwdec_vaglx.c index ac817d79c4..6248a64434 100644 --- a/video/out/opengl/hwdec_vaglx.c +++ b/video/out/opengl/hwdec_vaglx.c @@ -181,14 +181,12 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image, if (!p->pixmap) return -1; - va_lock(p->ctx); status = vaPutSurface(p->display, va_surface_id(hw_image), p->pixmap, 0, 0, hw_image->w, hw_image->h, 0, 0, hw_image->w, hw_image->h, NULL, 0, va_get_colorspace_flag(hw_image->params.color.space)); CHECK_VA_STATUS(p, "vaPutSurface()"); - va_unlock(p->ctx); *out_frame = (struct gl_hwdec_frame){ .planes = { diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index 4aa1ef37df..85b8159f68 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -205,8 +205,6 @@ 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) { @@ -252,8 +250,6 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) } } - va_unlock(p->mpvaapi); - return true; } @@ -424,8 +420,6 @@ 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; @@ -438,8 +432,6 @@ 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) @@ -520,9 +512,7 @@ static int set_equalizer(struct priv *p, const char *name, int value) MP_VERBOSE(p, "Changing '%s' (range [%d, %d]) to %d\n", name, attr->max_value, attr->min_value, attr->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; diff --git a/video/vaapi.c b/video/vaapi.c index 6b3dac4b30..5c8ce4c693 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -181,7 +181,6 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog, .download_image = ctx_download_image, }, }; - mpthread_mutex_init_recursive(&res->lock); pthread_mutex_lock(&va_log_mutex); MP_TARRAY_APPEND(NULL, va_mpv_clients, num_va_mpv_clients, res); @@ -240,7 +239,6 @@ void va_destroy(struct mp_vaapi_ctx *ctx) TA_FREEP(&va_mpv_clients); // avoid triggering leak detectors pthread_mutex_unlock(&va_log_mutex); - pthread_mutex_destroy(&ctx->lock); talloc_free(ctx); } } @@ -311,13 +309,12 @@ static void release_va_surface(void *arg) { struct va_surface *surface = arg; - va_lock(surface->ctx); if (surface->id != VA_INVALID_ID) { if (surface->image.image_id != VA_INVALID_ID) vaDestroyImage(surface->display, surface->image.image_id); vaDestroySurfaces(surface->display, &surface->id, 1); } - va_unlock(surface->ctx); + talloc_free(surface); } @@ -326,9 +323,7 @@ static struct mp_image *alloc_surface(struct mp_vaapi_ctx *ctx, int rt_format, { VASurfaceID id = VA_INVALID_ID; VAStatus status; - va_lock(ctx); status = vaCreateSurfaces(ctx->display, rt_format, w, h, &id, 1, NULL, 0); - va_unlock(ctx); if (!CHECK_VA_STATUS(ctx, "vaCreateSurfaces()")) return NULL; @@ -372,7 +367,6 @@ static int va_surface_image_alloc(struct va_surface *p, VAImageFormat *format) return 0; int r = 0; - va_lock(p->ctx); va_surface_image_destroy(p); @@ -398,7 +392,6 @@ static int va_surface_image_alloc(struct va_surface *p, VAImageFormat *format) } } - va_unlock(p->ctx); return r; } @@ -428,9 +421,7 @@ bool va_image_map(struct mp_vaapi_ctx *ctx, VAImage *image, struct mp_image *mpi if (imgfmt == IMGFMT_NONE) return false; void *data = NULL; - va_lock(ctx); const VAStatus status = vaMapBuffer(ctx->display, image->buf, &data); - va_unlock(ctx); if (!CHECK_VA_STATUS(ctx, "vaMapBuffer()")) return false; @@ -453,9 +444,7 @@ bool va_image_map(struct mp_vaapi_ctx *ctx, VAImage *image, struct mp_image *mpi bool va_image_unmap(struct mp_vaapi_ctx *ctx, VAImage *image) { - va_lock(ctx); const VAStatus status = vaUnmapBuffer(ctx->display, image->buf); - va_unlock(ctx); return CHECK_VA_STATUS(ctx, "vaUnmapBuffer()"); } @@ -479,12 +468,10 @@ int va_surface_upload(struct mp_image *va_dst, struct mp_image *sw_src) va_image_unmap(p->ctx, &p->image); if (!p->is_derived) { - va_lock(p->ctx); VAStatus status = vaPutImage(p->display, p->id, p->image.image_id, 0, 0, sw_src->w, sw_src->h, 0, 0, sw_src->w, sw_src->h); - va_unlock(p->ctx); if (!CHECK_VA_STATUS(p->ctx, "vaPutImage()")) return -1; } @@ -505,10 +492,8 @@ static struct mp_image *try_download(struct va_surface *p, struct mp_image *src, return NULL; if (!p->is_derived) { - va_lock(p->ctx); status = vaGetImage(p->display, p->id, 0, 0, p->w, p->h, image->image_id); - va_unlock(p->ctx); if (status != VA_STATUS_SUCCESS) return NULL; } @@ -520,9 +505,7 @@ static struct mp_image *try_download(struct va_surface *p, struct mp_image *src, mp_image_set_size(&tmp, src->w, src->h); // copy only visible part dst = mp_image_pool_get(pool, tmp.imgfmt, tmp.w, tmp.h); if (dst) { - va_lock(p->ctx); mp_check_gpu_memcpy(p->ctx->log, &p->ctx->gpu_memcpy_message); - va_unlock(p->ctx); mp_image_copy_gpu(dst, &tmp); mp_image_copy_attributes(dst, src); @@ -549,9 +532,7 @@ struct mp_image *va_surface_download(struct mp_image *src, } struct mp_image *mpi = NULL; struct mp_vaapi_ctx *ctx = p->ctx; - va_lock(ctx); VAStatus status = vaSyncSurface(p->display, p->id); - va_unlock(ctx); if (!CHECK_VA_STATUS(ctx, "vaSyncSurface()")) goto done; @@ -598,8 +579,6 @@ void va_surface_init_subformat(struct mp_image *mpi) VAImage va_image = { .image_id = VA_INVALID_ID }; - va_lock(p->ctx); - status = vaDeriveImage(p->display, va_surface_id(mpi), &va_image); if (status != VA_STATUS_SUCCESS) goto err; @@ -609,8 +588,7 @@ void va_surface_init_subformat(struct mp_image *mpi) status = vaDestroyImage(p->display, va_image.image_id); CHECK_VA_STATUS(p->ctx, "vaDestroyImage()"); -err: - va_unlock(p->ctx); +err: ; } struct pool_alloc_ctx { @@ -643,9 +621,7 @@ void va_pool_set_allocator(struct mp_image_pool *pool, struct mp_vaapi_ctx *ctx, bool va_guess_if_emulated(struct mp_vaapi_ctx *ctx) { - va_lock(ctx); const char *s = vaQueryVendorString(ctx->display); - va_unlock(ctx); return s && strstr(s, "VDPAU backend"); } diff --git a/video/vaapi.h b/video/vaapi.h index 01fb4fa980..de7d6d98d8 100644 --- a/video/vaapi.h +++ b/video/vaapi.h @@ -36,7 +36,6 @@ struct mp_vaapi_ctx { struct AVBufferRef *av_device_ref; // AVVAAPIDeviceContext* struct va_image_formats *image_formats; bool gpu_memcpy_message; - pthread_mutex_t lock; // Internal, for va_create_standalone() void *native_ctx; void (*destroy_native_ctx)(void *native_ctx); @@ -46,9 +45,6 @@ bool check_va_status(struct mp_log *log, VAStatus status, const char *msg); #define CHECK_VA_STATUS(ctx, msg) check_va_status((ctx)->log, status, msg) -#define va_lock(ctx) (void)(ctx) -#define va_unlock(ctx) (void)(ctx) - int va_get_colorspace_flag(enum mp_csp csp); struct mp_vaapi_ctx * va_initialize(VADisplay *display, struct mp_log *plog, bool probing); |