summaryrefslogtreecommitdiffstats
path: root/video/vaapi.c
diff options
context:
space:
mode:
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,
};