Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix thread_ctrl::wait_for_accurate #15195

Merged
merged 2 commits into from Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Utilities/Thread.cpp
Expand Up @@ -2427,7 +2427,7 @@ void thread_ctrl::wait_for_accurate(u64 usec)
break;
}

usec = (until - current).count();
usec = std::chrono::duration_cast<std::chrono::microseconds>(until - current).count();
}
#endif
}
Expand Down
16 changes: 10 additions & 6 deletions rpcs3/Emu/Cell/lv2/lv2.cpp
Expand Up @@ -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)
}
}
}
}
Expand Down