Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on exit with hwdec=d3d11va after b46eaa3 #3348

Closed
igv opened this issue Jul 19, 2016 · 9 comments
Closed

Crash on exit with hwdec=d3d11va after b46eaa3 #3348

igv opened this issue Jul 19, 2016 · 9 comments

Comments

@igv
Copy link
Contributor

igv commented Jul 19, 2016

mpv version and platform

mpv git-77e1e8e Win 10

Reproduction steps

Open any h.264 video from command line with --hwdec=d3d11va option

Expected behavior

No errors after mpv shut down

Actual behavior

There is a message "mpv has stopped working"

Log files

From Administrative Events:

Faulting application name: mpv.exe, version: 2.0.0.0, time stamp: 0x578c8c10
Faulting module name: d3d11.dll_unloaded, version: 10.0.10586.494, time stamp: 0x5775e29e
Exception code: 0xc0000005
Fault offset: 0x000000000006445b
Faulting process id: 0xd64
Faulting application start time: 0x01d1e18922b16390
Faulting application path: e:\Programs\mpv\mpv.exe
Faulting module path: d3d11.dll
@ghost
Copy link

ghost commented Jul 19, 2016

Is this with HEVC on Intel? I can't reproduce with h264, but I know there are weird HEVC issues, for which I'm blaming the drivers.

@igv
Copy link
Contributor Author

igv commented Jul 19, 2016

Codec doesn't matter, happens always when hardware decoding is used. nVidia 660.

@rossy
Copy link
Member

rossy commented Jul 19, 2016

Not sure if it's related, but I had consistent crashes on exit until I updated my drivers (from 368.39 to 368.69.) I can't remember if d3d11va was involved or not.

@igv
Copy link
Contributor Author

igv commented Jul 19, 2016

I have latest driver version 368.81.
Actually not sure if it happens with every video, so here is a sample , crashes every time with it.

@igv
Copy link
Contributor Author

igv commented Jul 19, 2016

Also note that if you run mpv not from command line it will crash silently, you won't see "mpv has stopped working" message.

@igv
Copy link
Contributor Author

igv commented Oct 29, 2016

Still crashes on a fresh Windows installation with a latest drivers and mpv. There is a message "mpv has stopped working" now even if mpv wasn't started from command line.
But I will probably stop using hwdec.

@rossy
Copy link
Member

rossy commented Nov 22, 2016

Btw I can repro this consistently now. For some reason, the error reporting dialog doesn't show when I launch mpv normally and then close it, but a werfault.exe process will appear briefly in the task manager. When I launch mpv in a debugger, play some video with hwdec=d3d11va and close it, it will almost always crash with an EXCEPTION_ACCESS_VIOLATION.

It always happens after d3d11.dll is unloaded. When decoding with hwdec_d3d11egl, only ANGLE has a reference to d3d11.dll, so d3d11.dll is unloaded when ANGLE calls FreeLibrary. It seems like a thread owned by the Nvidia driver (nvwgf2umx.dll) tries to call functions in d3d11.dll after it's unloaded (RIP is set to an address where d3d11.dll used to be.)

I have no idea why this is happening though. If hwdec uninit happens before vo uninit, ANGLE's reference to d3d11.dll should still be alive while any hwdec-related objects are alive. That said, we might be able to fix this by calling d3d_load_dlls() in all cases, even when only ANGLE has to call into d3d11.dll directly. That way, d3d11.dll will never be unloaded.

@ghost
Copy link

ghost commented Nov 22, 2016

Sounds good enough.

rossy added a commit to rossy/mpv that referenced this issue Nov 22, 2016
At least with Nvidia drivers, some thread tries to access D3D11 objects
after ANGLE unloads d3d11.dll. Fix this by holding a reference to
d3d11.dll ourselves.

Might fix the crash in mpv-player#3348. (I wish I knew why though.)
rossy added a commit that referenced this issue Nov 22, 2016
At least with Nvidia drivers, some thread tries to access D3D11 objects
after ANGLE unloads d3d11.dll. Fix this by holding a reference to
d3d11.dll ourselves.

Might fix the crash in #3348. (I wish I knew why though.)
@igv
Copy link
Contributor Author

igv commented Nov 23, 2016

Seems fixed.

@igv igv closed this as completed Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants