mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.06k stars 2.88k forks source link

Libmpv hwdec uses dxva2-copy instead of dxva2 #6386

Open doubleaa93 opened 5 years ago

doubleaa93 commented 5 years ago

mpv version and platform

0.29.1 windows 10x64

Reproduction steps

Run the SDL example from https://github.com/mpv-player/mpv-examples/blob/master/libmpv/sdl/main.c

When I add mpv_set_option_string(mpv, "hwdec", "dxva2");

mpv_get_property_string(mpv, "hwdec-current") says its using dxva2-copy which uses more cpu then dxva2 (zero copy)

I tried adding

mpv_set_option_string(mpv, "gpu-context", "angle");
mpv_set_option_string(mpv, "vd-lavc-dr", "yes");

but still shows dxva2-copy

Expected behavior

To use dxva2 hwdec

Actual behavior

Uses dxva2-copy

morphogo commented 4 years ago

I can duplicate the issue with mpv git master compiled against the libangle git master on windows 10 64 + msys2 with the player too, not only libmpv. Libangle is a debug build compiled with visual studio 2019. hwdec=dxva2 works fine with gpu-context=d3d11 with the player.

morphogo commented 4 years ago

I did some digging in the libangle code. It seems that the format selected by eglChooseConfig should now match the format of the texture pass to eglCreatePbufferFromClientBuffer. In my case, eglChooseConfig returns the format D3DFMT_A2B10G10R10 and passing a texture of D3DFMT_A8B8G8R8 fails with an error "Invalid texture parameters in share handle texture." with the current code in video/out/opengl/hwdec_dxva2egl.c.