rsx: Implement basic infinite FIFO desync detection

This commit is contained in:
Eladash 2020-03-26 09:05:20 +02:00 committed by Ivan
parent 433a21286a
commit 38c8dd98b4
2 changed files with 28 additions and 0 deletions

View File

@ -2256,6 +2256,23 @@ namespace rsx
void thread::recover_fifo()
{
const u64 current_time = get_system_time();
if (recovered_fifo_cmds_history.size() == 20u)
{
const auto cmd_info = recovered_fifo_cmds_history.front();
// Check timestamp of last tracked cmd
if (current_time - cmd_info.timestamp < 1'500'000u)
{
// Probably hopeless
fmt::throw_exception("Dead FIFO commands queue state has been detected!\nTry increasing \"Driver Wake-Up Delay\" setting in Advanced settings." HERE);
}
// Erase the last command from history, keep the size of the queue the same
recovered_fifo_cmds_history.pop();
}
// Error. Should reset the queue
fifo_ctrl->set_get(restore_point);
fifo_ret_addr = saved_fifo_ret;
@ -2267,6 +2284,8 @@ namespace rsx
execute_nop_draw();
rsx::thread::end();
}
recovered_fifo_cmds_history.push({fifo_ctrl->last_cmd(), current_time});
}
void thread::fifo_wake_delay(u64 div)

View File

@ -1,5 +1,6 @@
#pragma once
#include <queue>
#include <deque>
#include <variant>
#include <stack>
@ -726,6 +727,14 @@ namespace rsx
bool sync_point_request = false;
bool in_begin_end = false;
struct desync_fifo_cmd_info
{
u32 cmd;
u64 timestamp;
};
std::queue<desync_fifo_cmd_info> recovered_fifo_cmds_history;
atomic_t<s32> async_tasks_pending{ 0 };
bool zcull_stats_enabled = false;