From 319fc8c55da1626d914ff187e31becca8c1b8542 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 28 Sep 2019 10:31:06 +0300 Subject: [PATCH] rsx: Mask FIFO PUT on rsx execution --- rpcs3/Emu/RSX/RSXFIFO.cpp | 18 +++++++++--------- rpcs3/Emu/RSX/RSXFIFO.h | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXFIFO.cpp b/rpcs3/Emu/RSX/RSXFIFO.cpp index 667bf9bed4..97bb6ab3a2 100644 --- a/rpcs3/Emu/RSX/RSXFIFO.cpp +++ b/rpcs3/Emu/RSX/RSXFIFO.cpp @@ -17,26 +17,26 @@ namespace rsx { m_internal_get += 4; - if (wait && m_ctrl->put == m_internal_get) + if (wait && read_put() == m_internal_get) { // NOTE: Only supposed to be invoked to wait for a single arg on command[0] (4 bytes) // Wait for put to allow us to procceed execution sync_get(); - while (m_ctrl->put == m_internal_get && !Emu.IsStopped()) + while (read_put() == m_internal_get && !Emu.IsStopped()) { std::this_thread::yield(); } } } + u32 FIFO_control::read_put() + { + return m_ctrl->put.and_fetch(~3); + } + void FIFO_control::set_put(u32 put) { - if (m_ctrl->put == put) - { - return; - } - m_ctrl->put = put; } @@ -65,7 +65,7 @@ namespace rsx { // Fast read with no processing, only safe inside a PACKET_BEGIN+count block if (m_remaining_commands && - m_internal_get != m_ctrl->put) + m_internal_get != read_put()) { m_command_reg += m_command_inc; m_args_ptr += 4; @@ -81,7 +81,7 @@ namespace rsx void FIFO_control::read(register_pair& data) { - const u32 put = m_ctrl->put; + const u32 put = read_put(); m_internal_get = m_ctrl->get; if (put == m_internal_get) diff --git a/rpcs3/Emu/RSX/RSXFIFO.h b/rpcs3/Emu/RSX/RSXFIFO.h index dd66de3ffd..405bd87cb2 100644 --- a/rpcs3/Emu/RSX/RSXFIFO.h +++ b/rpcs3/Emu/RSX/RSXFIFO.h @@ -131,6 +131,7 @@ namespace rsx void inc_get(bool wait); void set_get(u32 get); void set_put(u32 put); + u32 read_put(); void read(register_pair& data); inline bool read_unsafe(register_pair& data);