mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 23:40:05 +00:00
Suspend temporally
This commit is contained in:
parent
7dca0bc11d
commit
198c6ad0d7
@ -140,25 +140,45 @@ struct System::Impl {
|
|||||||
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
|
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
|
||||||
|
|
||||||
SystemResultStatus Run() {
|
SystemResultStatus Run() {
|
||||||
|
std::unique_lock<std::mutex> lk(suspend_guard);
|
||||||
status = SystemResultStatus::Success;
|
status = SystemResultStatus::Success;
|
||||||
|
|
||||||
kernel.Suspend(false);
|
kernel.Suspend(false);
|
||||||
core_timing.SyncPause(false);
|
core_timing.SyncPause(false);
|
||||||
cpu_manager.Pause(false);
|
cpu_manager.Pause(false);
|
||||||
|
is_paused = false;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemResultStatus Pause() {
|
SystemResultStatus Pause() {
|
||||||
|
std::unique_lock<std::mutex> lk(suspend_guard);
|
||||||
status = SystemResultStatus::Success;
|
status = SystemResultStatus::Success;
|
||||||
|
|
||||||
core_timing.SyncPause(true);
|
core_timing.SyncPause(true);
|
||||||
kernel.Suspend(true);
|
kernel.Suspend(true);
|
||||||
cpu_manager.Pause(true);
|
cpu_manager.Pause(true);
|
||||||
|
is_paused = true;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void stallForGPU(bool pause) {
|
||||||
|
if (pause) {
|
||||||
|
suspend_guard.lock();
|
||||||
|
kernel.Suspend(pause);
|
||||||
|
core_timing.SyncPause(pause);
|
||||||
|
cpu_manager.Pause(pause);
|
||||||
|
} else {
|
||||||
|
if (!is_paused) {
|
||||||
|
core_timing.SyncPause(pause);
|
||||||
|
kernel.Suspend(pause);
|
||||||
|
cpu_manager.Pause(pause);
|
||||||
|
}
|
||||||
|
suspend_guard.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
|
SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
|
||||||
LOG_DEBUG(Core, "initialized OK");
|
LOG_DEBUG(Core, "initialized OK");
|
||||||
|
|
||||||
@ -367,6 +387,9 @@ struct System::Impl {
|
|||||||
return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs());
|
return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::mutex suspend_guard;
|
||||||
|
bool is_paused{};
|
||||||
|
|
||||||
Timing::CoreTiming core_timing;
|
Timing::CoreTiming core_timing;
|
||||||
Kernel::KernelCore kernel;
|
Kernel::KernelCore kernel;
|
||||||
/// RealVfsFilesystem instance
|
/// RealVfsFilesystem instance
|
||||||
@ -464,6 +487,10 @@ void System::Shutdown() {
|
|||||||
impl->Shutdown();
|
impl->Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void System::stallForGPU(bool pause) {
|
||||||
|
impl->stallForGPU(pause);
|
||||||
|
}
|
||||||
|
|
||||||
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
|
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
|
||||||
u64 program_id, std::size_t program_index) {
|
u64 program_id, std::size_t program_index) {
|
||||||
return impl->Load(*this, emu_window, filepath, program_id, program_index);
|
return impl->Load(*this, emu_window, filepath, program_id, program_index);
|
||||||
|
@ -160,6 +160,8 @@ public:
|
|||||||
/// Shutdown the emulated system.
|
/// Shutdown the emulated system.
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
|
void stallForGPU(bool pause);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an executable application.
|
* Load an executable application.
|
||||||
* @param emu_window Reference to the host-system window used for video output and keyboard
|
* @param emu_window Reference to the host-system window used for video output and keyboard
|
||||||
|
@ -150,8 +150,9 @@ 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]) {
|
||||||
lock.unlock();
|
system.stallForGPU(true);
|
||||||
gpu.WaitFence(params.syncpt_id, target_value);
|
gpu.WaitFence(params.syncpt_id, target_value);
|
||||||
|
system.stallForGPU(false);
|
||||||
std::memcpy(output.data(), ¶ms, sizeof(params));
|
std::memcpy(output.data(), ¶ms, sizeof(params));
|
||||||
events_interface.failed[event_id] = false;
|
events_interface.failed[event_id] = false;
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
|
Loading…
Reference in New Issue
Block a user