From 14a425e487b63a3b49cade8b48e7e4c90b2567b9 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 7 Sep 2021 23:39:39 +0200 Subject: [PATCH] rsx: wait when emulation is paused This decreases my cpu usage by to <1% during Emu.Pause() --- rpcs3/Emu/RSX/RSXThread.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index a2bce9f1ef..d20bb79af1 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -555,7 +555,7 @@ namespace rsx on_exit(); } - void thread::cpu_wait(bs_t) + void thread::cpu_wait(bs_t old) { if (external_interrupt_lock) { @@ -563,7 +563,16 @@ namespace rsx } on_semaphore_acquire_wait(); - std::this_thread::yield(); + + if ((state & (cpu_flag::dbg_global_pause + cpu_flag::exit)) == cpu_flag::dbg_global_pause) + { + // Wait 16ms during emulation pause. This reduces cpu load while still giving us the chance to render overlays. + thread_ctrl::wait_on(state, old, 16000); + } + else + { + std::this_thread::yield(); + } } void thread::on_task()