From bc22df8ba89c8e11bbd293524e824078530deb8a Mon Sep 17 00:00:00 2001 From: Elad Ashkenazi <18193363+elad335@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:25:26 +0300 Subject: [PATCH] SPU: Optimize cellSpurs reservations --- rpcs3/Emu/Cell/SPUThread.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 77f976d51a..af7b4644bc 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -3898,7 +3898,23 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args) { if (raddr) { - vm::reservation_notifier_notify(addr); + if (raddr != spurs_addr || pc != 0x11e4) + { + vm::reservation_notifier_notify(addr); + } + else + { + const u32 thread_bit_mask = (1u << index); + constexpr usz SPU_IDLE = 0x73; + + const bool switched_from_running_to_idle = (static_cast(rdata[SPU_IDLE]) & thread_bit_mask) == 0 && (_ref(0x100 + SPU_IDLE) & thread_bit_mask) != 0; + + if (switched_from_running_to_idle) + { + vm::reservation_notifier_notify(addr); + } + } + raddr = 0; }