Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx: Implement basic infinite FIFO desync detection #7859

Merged
merged 3 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/PPUTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Function* PPUTranslator::Translate(const ppu_function& info)
if (m_rel)
{
// This is very bad. m_rel is normally set to nullptr after a relocation is handled (so it wasn't)
ppu_log.error("LLVM: [0x%x] Unsupported relocation(%u) in '%s'. Please report.", rel_found->first, m_rel->type, m_info.name);
ppu_log.error("LLVM: [0x%x] Unsupported relocation(%u) in '%s' (opcode=0x%x). Please report.", rel_found->first, m_rel->type, m_info.name, op);
return nullptr;
}
}
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/lv2/sys_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static error_code overlay_load_module(vm::ptr<u32> ovlmid, const std::string& vp

ppu_initialize(*ovlm);

sys_overlay.success("Loaded overlay: %s", vpath);
sys_overlay.success(u8"Loaded overlay: “%s” (id=0x%x)", vpath, idm::last_id());

*ovlmid = idm::last_id();
*entry = ovlm->entry;
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/Cell/lv2/sys_prx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ static error_code prx_load_module(const std::string& vpath, u64 flags, vm::ptr<s

if (ignore)
{
sys_prx.warning("Ignored module: %s", vpath);

const auto prx = idm::make_ptr<lv2_obj, lv2_prx>();

prx->name = std::move(name);
prx->path = std::move(path);

sys_prx.warning(u8"Ignored module: “%s” (id=0x%x)", vpath, idm::last_id());

return not_an_error(idm::last_id());
}

Expand Down Expand Up @@ -182,7 +182,7 @@ static error_code prx_load_module(const std::string& vpath, u64 flags, vm::ptr<s

ppu_initialize(*prx);

sys_prx.success("Loaded module: %s", vpath);
sys_prx.success(u8"Loaded module: “%s” (id=0x%x)", vpath, idm::last_id());

return not_an_error(idm::last_id());
}
Expand Down
19 changes: 19 additions & 0 deletions rpcs3/Emu/RSX/RSXThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions rpcs3/Emu/RSX/RSXThread.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <queue>
#include <deque>
#include <variant>
#include <stack>
Expand Down Expand Up @@ -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;
Expand Down