SPU: Remove condition from GETLLAR spin detection

This commit is contained in:
Elad Ashkenazi 2024-08-25 15:00:57 +03:00 committed by Elad
parent 3dc75dc3d1
commit 11e3aa660e
2 changed files with 6 additions and 6 deletions

View File

@ -4533,7 +4533,7 @@ bool spu_thread::process_mfc_cmd()
if ([&]() -> bool if ([&]() -> bool
{ {
// Validation that it is indeed GETLLAR spinning (large time window is intentional) // 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 // Seemingly not
getllar_busy_waiting_switch = umax; getllar_busy_waiting_switch = umax;
@ -4553,7 +4553,7 @@ bool spu_thread::process_mfc_cmd()
if (percent != 101) if (percent != 101)
{ {
// Predict whether or not to use operating system sleep based on history // 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; const auto old_stats = stats;
std::array<u8, 4> new_stats{}; std::array<u8, 4> new_stats{};
@ -4613,7 +4613,7 @@ bool spu_thread::process_mfc_cmd()
if (percent != 101) if (percent != 101)
{ {
spu_log.trace("SPU wait for 0x%x", addr); 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; getllar_busy_waiting_switch = 0;
} }
} }
@ -4636,7 +4636,7 @@ bool spu_thread::process_mfc_cmd()
if (getllar_busy_waiting_switch == 1) 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 defined(ARCH_X64)
if (utils::has_um_wait()) if (utils::has_um_wait())
@ -4705,7 +4705,7 @@ bool spu_thread::process_mfc_cmd()
rtime = new_time; 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<u8>(std::min<u32>(val + 1, u8{umax})); val = static_cast<u8>(std::min<u32>(val + 1, u8{umax}));
// Reset perf // Reset perf

View File

@ -819,7 +819,7 @@ public:
u32 current_bp_pc = umax; u32 current_bp_pc = umax;
bool stop_flag_removal_protection = false; bool stop_flag_removal_protection = false;
std::array<std::array<u8, 4>, SPU_LS_SIZE / 32> getllar_wait_time{}; std::array<std::array<u8, 4>, SPU_LS_SIZE / 128> getllar_wait_time{};
void push_snr(u32 number, u32 value); void push_snr(u32 number, u32 value);
static void do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* ls); static void do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8* ls);