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
D3D: Move exclusive mode switching to UI thread. #4443
Conversation
This prevents deadlocks when switching to exclusive mode. And it also allows the CPU thread to block until we've completed the switch.
These weren't actually settings, they were used as a bad way to communicate with the GPU thread.
No longer needed, since the exclusive mode switch is now handled synchronously on the CPU thread.
This allows us to regain exclusive mode directly from OnActive().
Source/Core/DolphinWX/Frame.cpp, line 523 at r1 (raw file):
The You should probably extract this kind of thing to a helper function or something, this is pasted almost verbatim in two other places. Something like: // Name condition to something more applicable
void DoThing(bool condition, bool set_fullscreen)
{
if (!condition)
return;
const bool was_unpaused = Core::PauseAndLock(true);
g_renderer->SetFullscreen(set_fullscreen);
Core::PauseAndLock(false, was_unpaused);
} or whatever would keep it reasonably self-contained. Comments from Reviewable |
Source/Core/VideoCommon/RenderBase.h, line 76 at r1 (raw file):
Comments from Reviewable |
Review status: 0 of 19 files reviewed at latest revision, 2 unresolved discussions. Source/Core/DolphinWX/Frame.cpp, line 523 at r1 (raw file):
|
Source/Core/VideoCommon/RenderBase.h, line 76 at r1 (raw file):
|
Review status: 0 of 20 files reviewed at latest revision, 3 unresolved discussions. Source/Core/DolphinWX/Frame.cpp, line 1183 at r2 (raw file):
You can just do if (!g_renderer || g_renderer->IsFullscreen() == enable_fullscreen)
return; which moves the main body back an indentation level. Source/Core/DolphinWX/Frame.h, line 109 at r2 (raw file):
Comments from Reviewable |
Review status: 0 of 20 files reviewed at latest revision, 3 unresolved discussions. Source/Core/VideoCommon/RenderBase.h, line 76 at r1 (raw file):
|
Source/Core/VideoCommon/RenderBase.h, line 76 at r1 (raw file):
|
Review status: 0 of 20 files reviewed at latest revision, 3 unresolved discussions. Source/Core/DolphinWX/Frame.h, line 109 at r2 (raw file):
|
Source/Core/VideoCommon/RenderBase.h, line 76 at r1 (raw file):
|
Review status: 0 of 20 files reviewed at latest revision, 3 unresolved discussions. Source/Core/VideoCommon/RenderBase.h, line 76 at r1 (raw file):
|
Review status: 0 of 20 files reviewed at latest revision, 3 unresolved discussions. Source/Core/DolphinWX/Frame.cpp, line 1183 at r2 (raw file):
|
Review status: 0 of 20 files reviewed at latest revision, all discussions resolved. Source/Core/DolphinWX/Frame.h, line 109 at r2 (raw file):
|
This PR cleans up the implementation of exclusive fullscreen significantly by putting the UI thread in control of exclusive fullscreen switching. This eliminates all fullscreen switching code from
SwapImpl()
and moves it toDoFullscreen()
andOnActive()
where it can be implemented with significantly less code.This should also take care of exclusive mode loops some people were encountering. And it allows you to enter/exit exclusive fullscreen even while paused.
To prevent concurrency errors with the backbuffer swap, this PR takes advantage of the deadlock fixes in PR #4439 by calling
PauseAndLock()
around exclusive fullscreen switching calls.This change is