summaryrefslogtreecommitdiffstats
path: root/video/vaapi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-02 04:27:02 +0100
committerwm4 <wm4@nowhere>2017-12-02 04:53:51 +0100
commit23a9efd124042e7c97f8317bcd8ae5903d039ef7 (patch)
tree8af4a34bd494abe51608d3648de612d5af920314 /video/vaapi.c
parent0780d3832997056b581cdecb29e605132fae9417 (diff)
downloadmpv-23a9efd124042e7c97f8317bcd8ae5903d039ef7.tar.bz2
mpv-23a9efd124042e7c97f8317bcd8ae5903d039ef7.tar.xz
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.
Diffstat (limited to 'video/vaapi.c')
-rw-r--r--video/vaapi.c14
1 files changed, 12 insertions, 2 deletions
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,
};