From 11e3aa660e48bbde7c1af6368ed9f03c3ebdc36d Mon Sep 17 00:00:00 2001 From: Elad Ashkenazi <18193363+elad335@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:00:57 +0300 Subject: [PATCH] SPU: Remove condition from GETLLAR spin detection --- rpcs3/Emu/Cell/SPUThread.cpp | 10 +++++----- rpcs3/Emu/Cell/SPUThread.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 1583c59e18..9e3f188a12 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -4533,7 +4533,7 @@ bool spu_thread::process_mfc_cmd() if ([&]() -> bool { // Validation that it is indeed GETLLAR spinning (large time window is intentional) - if (last_getllar_addr != addr || last_getllar != pc || last_getllar_gpr1 != gpr[1]._u32[3] || perf0.get() - last_gtsc >= 5'000 || (interrupts_enabled && ch_events.load().mask)) + if (last_getllar_addr != addr || last_getllar_gpr1 != gpr[1]._u32[3] || perf0.get() - last_gtsc >= 5'000 || (interrupts_enabled && ch_events.load().mask)) { // Seemingly not getllar_busy_waiting_switch = umax; @@ -4553,7 +4553,7 @@ bool spu_thread::process_mfc_cmd() if (percent != 101) { // Predict whether or not to use operating system sleep based on history - auto& stats = getllar_wait_time[pc / 32]; + auto& stats = getllar_wait_time[(addr % SPU_LS_SIZE) / 128]; const auto old_stats = stats; std::array new_stats{}; @@ -4613,7 +4613,7 @@ bool spu_thread::process_mfc_cmd() if (percent != 101) { spu_log.trace("SPU wait for 0x%x", addr); - getllar_wait_time[pc / 32].front() = 1; + getllar_wait_time[(addr % SPU_LS_SIZE) / 128].front() = 1; getllar_busy_waiting_switch = 0; } } @@ -4636,7 +4636,7 @@ bool spu_thread::process_mfc_cmd() if (getllar_busy_waiting_switch == 1) { - getllar_wait_time[pc / 32].front() = 0; + getllar_wait_time[(addr % SPU_LS_SIZE) / 128].front() = 0; #if defined(ARCH_X64) if (utils::has_um_wait()) @@ -4705,7 +4705,7 @@ bool spu_thread::process_mfc_cmd() rtime = new_time; } - u8& val = getllar_wait_time[pc / 32].front(); + u8& val = getllar_wait_time[(addr % SPU_LS_SIZE) / 128].front(); val = static_cast(std::min(val + 1, u8{umax})); // Reset perf diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 60dae8a69c..aff9895115 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -819,7 +819,7 @@ public: u32 current_bp_pc = umax; bool stop_flag_removal_protection = false; - std::array, SPU_LS_SIZE / 32> getllar_wait_time{}; + std::array, SPU_LS_SIZE / 128> getllar_wait_time{}; void push_snr(u32 number, u32 value); static void do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* ls);