From 4e6be9172a7635d9b7d3804fcbbd6c75a6ea828c Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 21 May 2022 00:53:48 +0300 Subject: [PATCH] rsx: Asynchronously flush the pipelines when handing ZCULL memory access violations --- rpcs3/Emu/RSX/RSXThread.cpp | 7 +++++++ rpcs3/Emu/RSX/RSXThread.h | 3 ++- rpcs3/Emu/RSX/RSXZCULL.cpp | 7 ++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 8885fcc761..a263c2bd53 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1070,6 +1070,11 @@ namespace rsx } } } + + if (m_eng_interrupt_mask & rsx::pipe_flush_interrupt) + { + sync(); + } } std::array thread::get_color_surface_addresses() const @@ -2612,6 +2617,8 @@ namespace rsx void thread::sync() { + m_eng_interrupt_mask.clear(rsx::pipe_flush_interrupt); + if (zcull_ctrl->has_pending()) { zcull_ctrl->sync(this); diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index b4f34cf6d7..046a837b29 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -168,8 +168,9 @@ namespace rsx backend_interrupt = 0x0001, // Backend-related interrupt memory_config_interrupt = 0x0002, // Memory configuration changed display_interrupt = 0x0004, // Display handling + pipe_flush_interrupt = 0x0008, // Flush pipelines - all_interrupt_bits = memory_config_interrupt | backend_interrupt | display_interrupt + all_interrupt_bits = memory_config_interrupt | backend_interrupt | display_interrupt | pipe_flush_interrupt }; enum FIFO_state : u8 diff --git a/rpcs3/Emu/RSX/RSXZCULL.cpp b/rpcs3/Emu/RSX/RSXZCULL.cpp index b6f15fdb57..003a68e54a 100644 --- a/rpcs3/Emu/RSX/RSXZCULL.cpp +++ b/rpcs3/Emu/RSX/RSXZCULL.cpp @@ -836,11 +836,6 @@ namespace rsx rsx_log.warning("Reports area at location %s was accessed. ZCULL optimizations will be disabled.", location_tostring(location)); m_pages_accessed[location] = true; - // Flush all pending writes - m_critical_reports_in_flight += 0x100000; - ptimer->sync(); - m_critical_reports_in_flight -= 0x100000; - // Unlock pages for (auto& p : m_locked_pages[location]) { @@ -911,6 +906,8 @@ namespace rsx rsx::eng_lock rlock(thr); std::scoped_lock lock(m_pages_mutex); disable_optimizations(thr, location); + + thr->m_eng_interrupt_mask |= rsx::pipe_flush_interrupt; return true; }