Skip to content

Commit

Permalink
Fixup HW thread switch delay condition for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Feb 11, 2024
1 parent 148edc0 commit e123e98
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions rpcs3/Emu/Cell/lv2/lv2.cpp
Expand Up @@ -1723,15 +1723,19 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio)

if (current_ppu && changed_queue && has_free_hw_thread_space)
{
if (current_ppu->prio.load().prio > lowest_new_priority)
if (current_ppu->prio.load().prio > lowest_new_priorit)
{
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)
}
}
}
}
Expand Down

0 comments on commit e123e98

Please sign in to comment.