From d99f30d7266aeaa13504bce181c4410b41e9cb46 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 28 May 2014 01:37:53 +0200 Subject: video: warn if an emulated hwdec API is used mpv supports two hardware decoding APIs on Linux: vdpau and vaapi. Each of these has emulation wrappers. The wrappers are usually slower and have fewer features than their native opposites. In particular the libva vdpau driver is practically unmaintained. Check the vendor string and print a warning if emulation is detected. Checking vendor strings is a very stupid thing to do, but I find the thought of people using an emulated API for no reason worse. Also, make --hwdec=auto never use an API that is detected as emulated. This doesn't work quite right yet, because once one API is loaded, vo_opengl doesn't unload it, so no hardware decoding will be used if the first probed API (usually vdpau) is rejected. But good enough. --- video/vdpau.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'video/vdpau.c') diff --git a/video/vdpau.c b/video/vdpau.c index 20fbf2566f..0cf91ffe86 100644 --- a/video/vdpau.c +++ b/video/vdpau.c @@ -426,3 +426,13 @@ struct mp_image *mp_vdpau_upload_video_surface(struct mp_vdpau_ctx *ctx, mp_image_copy_attributes(hwmpi, mpi); return hwmpi; } + +bool mp_vdpau_guess_if_emulated(struct mp_vdpau_ctx *ctx) +{ + struct vdp_functions *vdp = &ctx->vdp; + VdpStatus vdp_st; + char const* info = NULL; + vdp_st = vdp->get_information_string(&info); + CHECK_VDP_WARNING(ctx, "Error when calling vdp_get_information_string"); + return vdp_st == VDP_STATUS_OK && info && strstr(info, "VAAPI"); +} -- cgit v1.2.3