From 183597deea6794031107e9b9e8b60576036c9e55 Mon Sep 17 00:00:00 2001 From: Malcolm Date: Mon, 5 Oct 2026 17:14:47 -0400 Subject: [PATCH] RSX: use cache-line waits for event queue draining --- Utilities/mutex.h | 5 +++++ rpcs3/Emu/Cell/lv2/sys_rsx.cpp | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Utilities/mutex.h b/Utilities/mutex.h index 4c09431096..9ae83767c7 100644 --- a/Utilities/mutex.h +++ b/Utilities/mutex.h @@ -28,6 +28,11 @@ class shared_mutex final public: constexpr shared_mutex() = default; + const atomic_t& raw() const + { + return m_value; + } + bool try_lock_shared() { const u32 value = m_value.load(); diff --git a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp index 27323bc671..3598e91944 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_rsx.cpp @@ -245,8 +245,7 @@ void _sys_rsx_drain_event_queue(rsx::thread* rsxthr, u64 event_flags = umax, u64 break; } - // Wait - thread_ctrl::wait_for(100); + utils::spin_on_cacheline_once(queue->mutex.raw(), 0u, 100); // Check for timeout if (wait_timeout_ms == umax)