From 23a9efd124042e7c97f8317bcd8ae5903d039ef7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 Dec 2017 04:27:02 +0100 Subject: vd_lavc, vdpau, vaapi: restore emulated API avoidance This code is for trying to avoid using an emulation layer when using auto probing, so that we end up using the actual API the drivers provide. It was destroyed in the recent refactor. --- video/vaapi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'video/vaapi.c') diff --git a/video/vaapi.c b/video/vaapi.c index a6607b4aeb..00052cec39 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -204,12 +204,21 @@ VASurfaceID va_surface_id(struct mp_image *mpi) (VASurfaceID)(uintptr_t)mpi->planes[3] : VA_INVALID_ID; } -bool va_guess_if_emulated(struct mp_vaapi_ctx *ctx) +static bool is_emulated(struct AVBufferRef *hw_device_ctx) { - const char *s = vaQueryVendorString(ctx->display); + AVHWDeviceContext *hwctx = (void *)hw_device_ctx->data; + AVVAAPIDeviceContext *vactx = hwctx->hwctx; + + const char *s = vaQueryVendorString(vactx->display); return s && strstr(s, "VDPAU backend"); } + +bool va_guess_if_emulated(struct mp_vaapi_ctx *ctx) +{ + return is_emulated(ctx->av_device_ref); +} + struct va_native_display { void (*create)(VADisplay **out_display, void **out_native_ctx); void (*destroy)(void *native_ctx); @@ -327,4 +336,5 @@ static struct AVBufferRef *va_create_standalone(struct mpv_global *global, const struct hwcontext_fns hwcontext_fns_vaapi = { .av_hwdevice_type = AV_HWDEVICE_TYPE_VAAPI, .create_dev = va_create_standalone, + .is_emulated = is_emulated, }; -- cgit v1.2.3