mpv-player / mpv

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

gpu-context should auto switch when switch hwdec #13926

Open Andarwinux opened 6 months ago

Andarwinux commented 6 months ago

Before requesting a new feature make sure it hasn't been requested yet. https://github.com/mpv-player/mpv/labels/meta%3Afeature-request

Expected behavior of the wanted feature

Example:

gpu-context=d3d11,winvk
hwdec=d3d11va

Then switch hwdec to nvdec at runtime (set hwdec nvdec) , then gpu-context should auto switch to winvk to allow hwdec=nvdec to work without error.

kasper93 commented 6 months ago

@na-na-hi What do you think?

Hrxn commented 6 months ago

hwdec=nvdec requires gpu-context=winvk now? At least on Windows. Is this by design?

philipl commented 6 months ago

There are interops for egl and vulkan, so it doesn't have to be winvk but that is the better choice. It is possible to write a d3d11 interop but someone has to do the work

Hrxn commented 6 months ago

I see.. So, not some recent change mandated by newer versions of NVIDIA's Windows drivers?

philipl commented 6 months ago

No. Egl should still work fine but I haven't touched windows for ages.

na-na-hi commented 6 months ago

Note that this should also be applied when --hwdec-codecs change when --hwdec=auto is set.

To avoid unnecessary vo reconfigs, the switching meshanism needs to know which hwdec methods are compatible with which GPU contexts. AFAIK mpv doesn't maintain such a list.

I think such functionality can be done with a script. It only needs to do the following:

hwdec=nvdec requires gpu-context=winvk now? At least on Windows. Is this by design?

NVDEC works with OpenGL on Windows.