Project

General

Profile

Actions

Emulator Issues #9723

closed

Dolphin hanging forever when launching any Wii games in full screen + DX11

Added by Kyogre over 7 years ago. Updated over 7 years ago.

Status:
Fixed
Priority:
High
Assignee:
-
% Done:

0%

Operating system:
Windows
Issue type:
Bug
Milestone:
Current
Regression:
Yes
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
5.0-76
Fixed in:
5.0-1281

Description

Emulator hanging forever if launch any Wii games in full screen + DX11.
It doesn't hang if you launch game in windowed mode and then switch to full screen.
It applies only to dev builds 5.0+ but doesn't applies to stable 5.0.
Also it doesn't hang with DX12 at all.
Tried delete profile folder - doesn't help.

Specs: i7-4770, gtx760, win10 x64


Related issues 3 (0 open3 closed)

Has duplicate Emulator - Emulator Issues #9698: Gecko OS crashes Dolphin when started with D3D11 and fullscreenDuplicate

Actions
Has duplicate Emulator - Emulator Issues #9863: Booting any VC/WiiWare title with "Fullscreen" checked on Direct3D 11, will crash DolphinDuplicate

Actions
Has duplicate Emulator - Emulator Issues #9880: D3D11 Black Screen on Every GameDuplicate

Actions
Actions #1

Updated by Kyogre over 7 years ago

*Emulator hanging forever WHEN launch

Actions #2

Updated by seapancake over 7 years ago

Tested 5.0-349 and not seeing this, using Geforce GTX 970 (368.81), Windows 10 x64.

Actions #3

Updated by Kyogre over 7 years ago

seapancake, tested on 349 - still hangs

Actions #4

Updated by Kyogre over 7 years ago

Windows says: "dolphin doesn't unswer: wait for respond or close the programm?"

Actions #5

Updated by seapancake over 7 years ago

What other processes are you running? Which version Nvidia driver are you using?

Do you see anything in Event Viewer? (Start -> type 'Event Viewer' then click System)

Actions #6

Updated by Kyogre over 7 years ago

  1. no foreground processes
  2. 368.81 driver, Windows 10 Pro Anniversary update
  3. nothing interesting in system and application tabs except of "application hang" event when I force closed Dolphin
Actions #7

Updated by seapancake over 7 years ago

Can't think of anything that it might be, I'd suggest bi-secting the issue. You can use this tool to make it a bit easier: https://github.com/Helios747/DolphinBisectTool

Actions #8

Updated by Kyogre over 7 years ago

I had done some research:
build 5.0-72 - no hanging
build 5.0-76 - hanging exist

Actions #10

Updated by seapancake over 7 years ago

Good fine, this narrows it down to https://github.com/dolphin-emu/dolphin/pull/3510 possibly having an infinite. I'm locked out of the forums due to bad password attempts, would suggest contacting akyryz to get him to put debugging information here. and badkarma12 so we can compare your exact setups.

Also worth contacting JMC47 (IRC or forums) to see if he replicate it.

Actions #11

Updated by JosJuice over 7 years ago

  • Subject changed from Dolphin hanging forever when launch any games in full screen + DX11 to Dolphin hanging forever when launching any Wii games in full screen + DX11
  • Status changed from New to Accepted
  • Priority changed from Normal to High
  • Regression changed from No to Yes
  • Regression start set to 5.0-76
  • Operating system Windows added
  • Operating system deleted (N/A)

This has been bisected down to PR 3510 for a while already.

There are some more criteria for triggering the bug than what's described in this issue report. I think it was something like exclusive fullscreen on, or render to main window off, or both.

Actions #12

Updated by JosJuice over 7 years ago

  • Has duplicate Emulator Issues #9698: Gecko OS crashes Dolphin when started with D3D11 and fullscreen added
Actions #13

Updated by JosJuice over 7 years ago

  • Milestone set to Current
Actions #14

Updated by Kyogre over 7 years ago

JosJuice,
you are right about criteria.
Render to main window OFF + Borderless full screen OFF = hangs
Render to main window ON + Borderless full screen OFF = doesn't hang
Render to main window OFF + Borderless full screen ON = hangs
Render to main window ON + Borderless full screen ON = doesn't hang

Actions #15

Updated by JosJuice over 7 years ago

  • Has duplicate Emulator Issues #9863: Booting any VC/WiiWare title with "Fullscreen" checked on Direct3D 11, will crash Dolphin added
Actions #16

Updated by JosJuice over 7 years ago

Actions #17

Updated by Armada over 7 years ago

The problem here is that Dolphin violates the DXGI: Best Practices, which states that you should never lock the UI thread on the GPU thread. The reason for that is because DXGI (which runs on the GPU thread) will also send messages to the UI thread. This means there is a lot of potential for rare race conditions that deadlock the emulator.

This race condition has been known since exclusive fullscreen was first implemented, however it seems PR 3510 has exposed it due to changes in the initialization order. Here's what's happening:

  1. The GPU thread is initialized and DXGI sends some messages to the UI thread for initialization.
  2. The UI thread triggers a switch to fullscreen as the "Use Fullscreen" option is enabled.
  3. The GPU thread switches to exclusive fullscreen and DXGI sends some message to the UI thread to change its style.
  4. The UI thread calls UpdateGUI() which is called numerous times and includes a LockAndPause() which locks on the GPU thread.
  5. Both threads are now deadlocked with the GUI thread waiting on the UI thread to handle the message and the UI thread waiting on the GPU thread to pause.

There are two ways to solve this as documented in the DXGI Best Practices:

Hard way: "To avoid this, never block the message pump."

This requires we make any interaction with the GPU thread asynchronous, which is difficult given the numerous usages of LockAndPause(). Though never blocking the UI thread is generally good practice.

Easy way: "If a block is unavoidable, then all DXGI interaction should occur on the same thread as the message pump."

This would either involve moving the Render Window to the GPU thread (which means render-to-main is no longer possible) or making sure that after initialization of the backend all DXGI calls are done by the UI thread. I'll make an attempt at implementing the latter option.

Actions #18

Updated by Armada over 7 years ago

  • Status changed from Accepted to Fix pending

A workaround is available in my new PR: https://github.com/dolphin-emu/dolphin/pull/4433

I'm also working on a PR for exclusive mode that has some of the stability improvements I outlined in my previous comment.

Actions #19

Updated by Armada over 7 years ago

  • Status changed from Fix pending to Fixed
  • Fixed in set to 5.0-1281
Actions

Also available in: Atom PDF