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/decode/vaapi.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'video/decode/vaapi.c') diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c index d9267936d0..2b951fd1bb 100644 --- a/video/decode/vaapi.c +++ b/video/decode/vaapi.c @@ -409,6 +409,8 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, return HWDEC_ERR_NO_CTX; if (!hwdec_check_codec_support(decoder, profiles)) return HWDEC_ERR_NO_CODEC; + if (va_guess_if_emulated(info->vaapi_ctx)) + return HWDEC_ERR_EMULATED; return 0; } @@ -418,9 +420,12 @@ static int probe_copy(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, struct priv dummy = {mp_null_log}; if (!create_va_dummy_ctx(&dummy)) return HWDEC_ERR_NO_CTX; + bool emulated = va_guess_if_emulated(dummy.ctx); destroy_va_dummy_ctx(&dummy); if (!hwdec_check_codec_support(decoder, profiles)) return HWDEC_ERR_NO_CODEC; + if (emulated) + return HWDEC_ERR_EMULATED; return 0; } -- cgit v1.2.3