diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/core.cpp | 34 | ||||
| -rw-r--r-- | src/core/core.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | 8 |
3 files changed, 27 insertions, 19 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 4abf037e2..3042d611b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -163,19 +163,19 @@ struct System::Impl { | |||
| 163 | return status; | 163 | return status; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | void stallForGPU(bool pause) { | 166 | std::unique_lock<std::mutex> StallCPU() { |
| 167 | if (pause) { | 167 | std::unique_lock<std::mutex> lk(suspend_guard); |
| 168 | suspend_guard.lock(); | 168 | kernel.Suspend(true); |
| 169 | kernel.Suspend(pause); | 169 | core_timing.SyncPause(true); |
| 170 | core_timing.SyncPause(pause); | 170 | cpu_manager.Pause(true); |
| 171 | cpu_manager.Pause(pause); | 171 | return lk; |
| 172 | } else { | 172 | } |
| 173 | if (!is_paused) { | 173 | |
| 174 | core_timing.SyncPause(pause); | 174 | void UnstallCPU() { |
| 175 | kernel.Suspend(pause); | 175 | if (!is_paused) { |
| 176 | cpu_manager.Pause(pause); | 176 | core_timing.SyncPause(false); |
| 177 | } | 177 | kernel.Suspend(false); |
| 178 | suspend_guard.unlock(); | 178 | cpu_manager.Pause(false); |
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| 181 | 181 | ||
| @@ -487,8 +487,12 @@ void System::Shutdown() { | |||
| 487 | impl->Shutdown(); | 487 | impl->Shutdown(); |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | void System::stallForGPU(bool pause) { | 490 | std::unique_lock<std::mutex> System::StallCPU() { |
| 491 | impl->stallForGPU(pause); | 491 | return impl->StallCPU(); |
| 492 | } | ||
| 493 | |||
| 494 | void System::UnstallCPU() { | ||
| 495 | impl->UnstallCPU(); | ||
| 492 | } | 496 | } |
| 493 | 497 | ||
| 494 | SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, | 498 | SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, |
diff --git a/src/core/core.h b/src/core/core.h index 8b21816cc..1cfe1bba6 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <cstddef> | 7 | #include <cstddef> |
| 8 | #include <functional> | 8 | #include <functional> |
| 9 | #include <memory> | 9 | #include <memory> |
| 10 | #include <mutex> | ||
| 10 | #include <string> | 11 | #include <string> |
| 11 | #include <vector> | 12 | #include <vector> |
| 12 | 13 | ||
| @@ -160,7 +161,8 @@ public: | |||
| 160 | /// Shutdown the emulated system. | 161 | /// Shutdown the emulated system. |
| 161 | void Shutdown(); | 162 | void Shutdown(); |
| 162 | 163 | ||
| 163 | void stallForGPU(bool pause); | 164 | std::unique_lock<std::mutex> StallCPU(); |
| 165 | void UnstallCPU(); | ||
| 164 | 166 | ||
| 165 | /** | 167 | /** |
| 166 | * Load an executable application. | 168 | * Load an executable application. |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index b59eae55c..f9b82b504 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -150,9 +150,11 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector | |||
| 150 | params.value |= event_id; | 150 | params.value |= event_id; |
| 151 | event.event->GetWritableEvent().Clear(); | 151 | event.event->GetWritableEvent().Clear(); |
| 152 | if (events_interface.failed[event_id]) { | 152 | if (events_interface.failed[event_id]) { |
| 153 | system.stallForGPU(true); | 153 | { |
| 154 | gpu.WaitFence(params.syncpt_id, target_value); | 154 | auto lk = system.StallCPU(); |
| 155 | system.stallForGPU(false); | 155 | gpu.WaitFence(params.syncpt_id, target_value); |
| 156 | system.UnstallCPU(); | ||
| 157 | } | ||
| 156 | std::memcpy(output.data(), ¶ms, sizeof(params)); | 158 | std::memcpy(output.data(), ¶ms, sizeof(params)); |
| 157 | events_interface.failed[event_id] = false; | 159 | events_interface.failed[event_id] = false; |
| 158 | return NvResult::Success; | 160 | return NvResult::Success; |