SPU MFC: Add shuffling in steps setting

This commit is contained in:
Eladash 2021-09-17 18:12:48 +03:00 committed by Ivan
parent 5f729d4dbf
commit 5870da0b55
3 changed files with 16 additions and 5 deletions

View file

@ -1662,7 +1662,7 @@ void spu_thread::cpu_work()
// If either MFC size exceeds limit or timeout has been reached execute pending MFC commands
if (mfc_size > g_cfg.core.mfc_transfers_shuffling || (timeout && get_system_time() - mfc_last_timestamp >= timeout))
{
do_mfc(false);
do_mfc(false, false);
check_mfc_interrupts(pc + 4);
}
}
@ -2960,7 +2960,7 @@ void spu_thread::do_putlluc(const spu_mfc_cmd& args)
vm::reservation_notifier(addr).notify_all(-128);
}
void spu_thread::do_mfc(bool can_escape)
void spu_thread::do_mfc(bool can_escape, bool must_finish)
{
u32 removed = 0;
u32 barrier = 0;
@ -3106,6 +3106,14 @@ void spu_thread::do_mfc(bool can_escape)
{
break;
}
if (!must_finish && g_cfg.core.mfc_shuffling_in_steps)
{
// Exit early, not all pending commands have to be executed at a single iteration
// Update last timestamp so the next MFC timeout check will use the current time
mfc_last_timestamp = get_system_time();
return;
}
}
if (state & cpu_flag::pending)
@ -3171,12 +3179,14 @@ bool spu_thread::process_mfc_cmd()
// Reset MFC timestamp in the case of full queue
mfc_last_timestamp = 0;
// Process MFC commands
if (test_stopped())
{
return false;
}
// Process MFC commands
do_mfc();
auto old = state.add_fetch(cpu_flag::wait);
if (is_stopped(old))