yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

NvHost/Core: Address Feedback.

This commit is contained in:
Fernando Sahmkow 2021-10-16 00:20:19 +02:00
parent 198c6ad0d7
commit 53cf91d151
3 changed files with 27 additions and 19 deletions

View File

@ -163,19 +163,19 @@ struct System::Impl {
return status; return status;
} }
void stallForGPU(bool pause) { std::unique_lock<std::mutex> StallCPU() {
if (pause) { std::unique_lock<std::mutex> lk(suspend_guard);
suspend_guard.lock(); kernel.Suspend(true);
kernel.Suspend(pause); core_timing.SyncPause(true);
core_timing.SyncPause(pause); cpu_manager.Pause(true);
cpu_manager.Pause(pause); return lk;
} else { }
if (!is_paused) {
core_timing.SyncPause(pause); void UnstallCPU() {
kernel.Suspend(pause); if (!is_paused) {
cpu_manager.Pause(pause); core_timing.SyncPause(false);
} kernel.Suspend(false);
suspend_guard.unlock(); cpu_manager.Pause(false);
} }
} }
@ -487,8 +487,12 @@ void System::Shutdown() {
impl->Shutdown(); impl->Shutdown();
} }
void System::stallForGPU(bool pause) { std::unique_lock<std::mutex> System::StallCPU() {
impl->stallForGPU(pause); return impl->StallCPU();
}
void System::UnstallCPU() {
impl->UnstallCPU();
} }
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,

View File

@ -7,6 +7,7 @@
#include <cstddef> #include <cstddef>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <mutex>
#include <string> #include <string>
#include <vector> #include <vector>
@ -160,7 +161,8 @@ public:
/// Shutdown the emulated system. /// Shutdown the emulated system.
void Shutdown(); void Shutdown();
void stallForGPU(bool pause); std::unique_lock<std::mutex> StallCPU();
void UnstallCPU();
/** /**
* Load an executable application. * Load an executable application.

View File

@ -150,9 +150,11 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
params.value |= event_id; params.value |= event_id;
event.event->GetWritableEvent().Clear(); event.event->GetWritableEvent().Clear();
if (events_interface.failed[event_id]) { if (events_interface.failed[event_id]) {
system.stallForGPU(true); {
gpu.WaitFence(params.syncpt_id, target_value); auto lk = system.StallCPU();
system.stallForGPU(false); gpu.WaitFence(params.syncpt_id, target_value);
system.UnstallCPU();
}
std::memcpy(output.data(), &params, sizeof(params)); std::memcpy(output.data(), &params, sizeof(params));
events_interface.failed[event_id] = false; events_interface.failed[event_id] = false;
return NvResult::Success; return NvResult::Success;