OSD stuck while paused when using dxinterop
mpv version and platform
fdd75f90a Window 10
Reproduction steps
- Set
opengl-backend=dxinterop - Open any audio file with
force-window(a paused video or image also works) - Trigger an OSD message or OSC display
Expected behavior
OSD/OSC eventually fades out.
Actual behavior
OSD/OSC does not fade out.
Log file
http://sprunge.us/RRiU
The issue seems to only occur when there is no video frame being rendered.
Doesn't have to do with the backend. It's how the OSD/OSC are implemented that depend too much on the mouse moving on the screen if there's no video.
It works fine with opengl-backend=win and vo=direct3d though.
I think the issue might not be due to the OSD/OSC implementation.
Toggling fullscreen on and off with a still image causes issues with dxinterop. The windowed display is squashed while the fullscreen display is stretched. The presented image seems to be a single frame late.
Moving the DXLockObjectsNV call to after IDirect3DDevice9Ex_PresentEx in context_dxinterop.c fixes the issue for me. It might be be due to the IDirect3DDevice9Ex_StretchRect call not being flushed before the render target was locked.
Hmm, I also have Nvidia on Windows 10, but I can't repro this.
Moving the
DXLockObjectsNVcall to afterIDirect3DDevice9Ex_PresentExincontext_dxinterop.cfixes the issue for me. It might be be due to theIDirect3DDevice9Ex_StretchRectcall not being flushed before the render target was locked.
This looks reasonable though. I assumed that DXLockObjectsNV did the appropriate synchronisation because it seemed to block under some conditions, but maybe it doesn't. I tested this change on my machine and there doesn't seem to be any impact on performance, so I'm okay with it.
https://www.khronos.org/registry/OpenGL/extensions/NV/WGL_NV_DX_interop.txt
DISCUSSION: The Lock/Unlock calls serve as synchronization points between OpenGL and DirectX. They ensure that any rendering operations that affect the resource on one driver are complete before the other driver takes ownership of it.
It should provide synchronization according to the spec. Maybe it is a bug with the latest Nvidia drivers. We might also be running different versions of Windows 10 as I have not been updated to the Creators Update.
Yeah, it seems like no GPU vendor implements the DX_interop spec correctly, though it's more surprising to see a bug with Nvidia, since they wrote the spec. Our dxinterop code contains some workarounds for Intel bugs, so this should be fine too.