From d686b48f6549c736661e14d1e0990b043c32e3c2 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Fri, 9 Sep 2022 22:04:32 +0300 Subject: [PATCH] rsx: Simplify FIFO concurrent access. --- rpcs3/Emu/RSX/RSXFIFO.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXFIFO.cpp b/rpcs3/Emu/RSX/RSXFIFO.cpp index 7534f6745c..c7fab7fa37 100644 --- a/rpcs3/Emu/RSX/RSXFIFO.cpp +++ b/rpcs3/Emu/RSX/RSXFIFO.cpp @@ -119,14 +119,17 @@ namespace rsx m_cache_size = put - m_cache_addr; } - rsx::reservation_lock rsx_lock(addr1, m_cache_size, true); + // Atomic FIFO debug options + const bool force_cache_fill = g_cfg.core.rsx_fifo_accuracy == rsx_fifo_mode::atomic_ordered; + const bool strict_fetch_ordering = g_cfg.core.rsx_fifo_accuracy >= rsx_fifo_mode::atomic_ordered; + rsx::reservation_lock rsx_lock(addr1, m_cache_size, true); const auto src = vm::_ptr(addr1); - // Find the next set bit after every iteration u64 start_time = 0; u32 bytes_read = 0; + // Find the next set bit after every iteration for (int i = 0;; i = (std::countr_zero(utils::rol8(to_fetch, 0 - i - 1)) + i + 1) % 8) { // If a reservation is being updated, try to load another @@ -154,9 +157,10 @@ namespace rsx if (!start_time) { - if ((bytes_read << 1) >= m_cache_size) + if (bytes_read >= 256 && !force_cache_fill) { - // Cut our losses, we have enough to work with. + // Cut our losses if we have something to work with. + // This is the first time falling out of the reservation loop above, so we have clean data with no holes. m_cache_size = bytes_read; break; } @@ -183,7 +187,7 @@ namespace rsx busy_wait(200); } - if (g_cfg.core.rsx_fifo_accuracy >= rsx_fifo_mode::atomic_ordered) + if (strict_fetch_ordering) { i = (i - 1) % 8; }