rsx: Robustness fixes

- Track last working state and reset to it if RSX starts to desync
-- This is especially useful when running vulkan since the renderer will easily outpace the rest of the system when merely recording draw commands
- Ignore empty sets
-- Mark empty/invalid IB sets as having 0 element counts.
This commit is contained in:
kd-11 2018-01-01 11:43:06 +03:00
parent 198e9dce1d
commit ee009ec99c
6 changed files with 46 additions and 10 deletions

View file

@ -388,6 +388,7 @@ namespace rsx
continue;
}
while (Emu.IsPaused())
std::this_thread::sleep_for(10ms);
@ -490,6 +491,22 @@ namespace rsx
while (external_interrupt_lock.load()) _mm_pause();
}
//Set up restore state if needed
if (sync_point_request)
{
if (RSXIOMem.RealAddr(internal_get))
{
//New internal get is valid, use it
restore_point = internal_get.load();
}
else
{
LOG_ERROR(RSX, "Could not update FIFO restore point");
}
sync_point_request = false;
}
//Now load the FIFO ctrl registers
ctrl->get.store(internal_get.load());
const u32 put = ctrl->put;
@ -513,13 +530,13 @@ namespace rsx
if (mem_faults_count >= 3)
{
LOG_ERROR(RSX, "Application has failed to recover, discarding FIFO queue");
internal_get = put;
LOG_ERROR(RSX, "Application has failed to recover, resetting FIFO queue");
internal_get = restore_point.load();;
}
else
{
mem_faults_count++;
std::this_thread::sleep_for(1ms);
std::this_thread::sleep_for(10ms);
}
invalid_command_interrupt_raised = true;
@ -581,13 +598,13 @@ namespace rsx
if (mem_faults_count >= 3)
{
LOG_ERROR(RSX, "Application has failed to recover, discarding FIFO queue");
internal_get = put;
LOG_ERROR(RSX, "Application has failed to recover, resetting FIFO queue");
internal_get = restore_point.load();
}
else
{
mem_faults_count++;
std::this_thread::sleep_for(1ms);
std::this_thread::sleep_for(10ms);
}
invalid_command_interrupt_raised = true;
@ -735,7 +752,8 @@ namespace rsx
{
//This is almost guaranteed to be heap corruption at this point
//Ignore the rest of the chain
internal_get = put;
LOG_ERROR(RSX, "FIFO contents may be corrupted. Resetting...");
internal_get = restore_point.load();
continue;
}