mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 12:31:45 +01:00
Remove reader_lock executed in every instruction by RSX
Use optimistic double check instead, use one load instruction for the check to be atomic + Read emu status once every FIFO iteration
This commit is contained in:
parent
f25587d24c
commit
888cb9d673
@ -527,7 +527,7 @@ namespace rsx
|
||||
fesetround(FE_TONEAREST);
|
||||
|
||||
// TODO: exit condition
|
||||
while (!Emu.IsStopped())
|
||||
while (true)
|
||||
{
|
||||
// Wait for external pause events
|
||||
if (external_interrupt_lock.load())
|
||||
@ -536,13 +536,6 @@ namespace rsx
|
||||
while (external_interrupt_lock.load()) _mm_pause();
|
||||
}
|
||||
|
||||
// Idle if emulation paused
|
||||
if (Emu.IsPaused())
|
||||
{
|
||||
std::this_thread::sleep_for(1ms);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Note a possible rollback address
|
||||
if (sync_point_request)
|
||||
{
|
||||
@ -559,6 +552,20 @@ namespace rsx
|
||||
|
||||
// Execute FIFO queue
|
||||
run_FIFO();
|
||||
|
||||
if (!Emu.IsRunning())
|
||||
{
|
||||
// Idle if emulation paused
|
||||
while (Emu.IsPaused())
|
||||
{
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -900,12 +907,14 @@ namespace rsx
|
||||
|
||||
if (!in_begin_end && state != FIFO_state::lock_wait)
|
||||
{
|
||||
reader_lock lock(m_mtx_task);
|
||||
|
||||
if (m_invalidated_memory_range.valid())
|
||||
if (atomic_storage<u32>::load(m_invalidated_memory_range.end) != 0)
|
||||
{
|
||||
lock.upgrade();
|
||||
handle_invalidated_memory_range();
|
||||
std::lock_guard lock(m_mtx_task);
|
||||
|
||||
if (m_invalidated_memory_range.valid())
|
||||
{
|
||||
handle_invalidated_memory_range();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user