diff options
| author | 2021-10-15 16:14:32 -0700 | |
|---|---|---|
| committer | 2021-10-15 16:14:32 -0700 | |
| commit | aef3ae1cb93f962165b1f9596b95e4ffa4a5e9c5 (patch) | |
| tree | 9ae1d8b30878562389498bd9f3b8ced582b6661d /src/core/core.cpp | |
| parent | Merge pull request #7189 from FearlessTobi/translation-ci (diff) | |
| parent | NvHost/Core: Address Feedback. (diff) | |
| download | yuzu-aef3ae1cb93f962165b1f9596b95e4ffa4a5e9c5.tar.gz yuzu-aef3ae1cb93f962165b1f9596b95e4ffa4a5e9c5.tar.xz yuzu-aef3ae1cb93f962165b1f9596b95e4ffa4a5e9c5.zip | |
Merge pull request #7187 from FernandoS27/boy-i-say-boy
NVHost_Ctrl: Force wait if the gpu falls behind too long.
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 3532839df..3042d611b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -140,25 +140,45 @@ struct System::Impl { | |||
| 140 | cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} | 140 | cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} |
| 141 | 141 | ||
| 142 | SystemResultStatus Run() { | 142 | SystemResultStatus Run() { |
| 143 | std::unique_lock<std::mutex> lk(suspend_guard); | ||
| 143 | status = SystemResultStatus::Success; | 144 | status = SystemResultStatus::Success; |
| 144 | 145 | ||
| 145 | kernel.Suspend(false); | 146 | kernel.Suspend(false); |
| 146 | core_timing.SyncPause(false); | 147 | core_timing.SyncPause(false); |
| 147 | cpu_manager.Pause(false); | 148 | cpu_manager.Pause(false); |
| 149 | is_paused = false; | ||
| 148 | 150 | ||
| 149 | return status; | 151 | return status; |
| 150 | } | 152 | } |
| 151 | 153 | ||
| 152 | SystemResultStatus Pause() { | 154 | SystemResultStatus Pause() { |
| 155 | std::unique_lock<std::mutex> lk(suspend_guard); | ||
| 153 | status = SystemResultStatus::Success; | 156 | status = SystemResultStatus::Success; |
| 154 | 157 | ||
| 155 | core_timing.SyncPause(true); | 158 | core_timing.SyncPause(true); |
| 156 | kernel.Suspend(true); | 159 | kernel.Suspend(true); |
| 157 | cpu_manager.Pause(true); | 160 | cpu_manager.Pause(true); |
| 161 | is_paused = true; | ||
| 158 | 162 | ||
| 159 | return status; | 163 | return status; |
| 160 | } | 164 | } |
| 161 | 165 | ||
| 166 | std::unique_lock<std::mutex> StallCPU() { | ||
| 167 | std::unique_lock<std::mutex> lk(suspend_guard); | ||
| 168 | kernel.Suspend(true); | ||
| 169 | core_timing.SyncPause(true); | ||
| 170 | cpu_manager.Pause(true); | ||
| 171 | return lk; | ||
| 172 | } | ||
| 173 | |||
| 174 | void UnstallCPU() { | ||
| 175 | if (!is_paused) { | ||
| 176 | core_timing.SyncPause(false); | ||
| 177 | kernel.Suspend(false); | ||
| 178 | cpu_manager.Pause(false); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 162 | SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { | 182 | SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { |
| 163 | LOG_DEBUG(Core, "initialized OK"); | 183 | LOG_DEBUG(Core, "initialized OK"); |
| 164 | 184 | ||
| @@ -367,6 +387,9 @@ struct System::Impl { | |||
| 367 | return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs()); | 387 | return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs()); |
| 368 | } | 388 | } |
| 369 | 389 | ||
| 390 | std::mutex suspend_guard; | ||
| 391 | bool is_paused{}; | ||
| 392 | |||
| 370 | Timing::CoreTiming core_timing; | 393 | Timing::CoreTiming core_timing; |
| 371 | Kernel::KernelCore kernel; | 394 | Kernel::KernelCore kernel; |
| 372 | /// RealVfsFilesystem instance | 395 | /// RealVfsFilesystem instance |
| @@ -464,6 +487,14 @@ void System::Shutdown() { | |||
| 464 | impl->Shutdown(); | 487 | impl->Shutdown(); |
| 465 | } | 488 | } |
| 466 | 489 | ||
| 490 | std::unique_lock<std::mutex> System::StallCPU() { | ||
| 491 | return impl->StallCPU(); | ||
| 492 | } | ||
| 493 | |||
| 494 | void System::UnstallCPU() { | ||
| 495 | impl->UnstallCPU(); | ||
| 496 | } | ||
| 497 | |||
| 467 | SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, | 498 | SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, |
| 468 | u64 program_id, std::size_t program_index) { | 499 | u64 program_id, std::size_t program_index) { |
| 469 | return impl->Load(*this, emu_window, filepath, program_id, program_index); | 500 | return impl->Load(*this, emu_window, filepath, program_id, program_index); |