From 94239f55261bbad8c55095fab814760b94176e4e Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:01:14 +0200 Subject: [PATCH] Fixup HW thread switch delay condition for performance --- rpcs3/Emu/Cell/lv2/lv2.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index f8db392ef6..8ad00079cc 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1725,13 +1725,17 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio) { if (current_ppu->prio.load().prio > lowest_new_priority) { - if (!current_ppu->state.test_and_set(cpu_flag::yield) || current_ppu->hw_sleep_time != 0) + // When not being set to All timers - activate only for sys_ppu_thread_start + if (current_ppu->gpr[11] == 0x35 || g_cfg.core.sleep_timers_accuracy == sleep_timers_accuracy_level::_all_timers) { - current_ppu->hw_sleep_time += 35; // Seems like 35us after extensive testing - } - else - { - current_ppu->hw_sleep_time = 30000; // In addition to another flag's use (TODO: Refactor and clean this) + if (!current_ppu->state.test_and_set(cpu_flag::yield) || current_ppu->hw_sleep_time != 0) + { + current_ppu->hw_sleep_time += 35; // Seems like 35us after extensive testing + } + else + { + current_ppu->hw_sleep_time = 30000; // In addition to another flag's use (TODO: Refactor and clean this) + } } } }