rsx: Unify FIFO recovery methods

TODO: Maybe consider fifo stack content when recovering.
This commit is contained in:
Eladash 2020-02-11 07:00:30 +02:00 committed by kd-11
parent 07f300a14e
commit 9344b21484
4 changed files with 11 additions and 17 deletions

View file

@ -49,11 +49,6 @@ namespace rsx
} }
} }
void FIFO_control::set_put(u32 put)
{
m_ctrl->put = put;
}
void FIFO_control::set_get(u32 get) void FIFO_control::set_get(u32 get)
{ {
if (m_ctrl->get == get) if (m_ctrl->get == get)
@ -401,7 +396,7 @@ namespace rsx
} }
case FIFO::FIFO_ERROR: case FIFO::FIFO_ERROR:
{ {
rsx_log.error("FIFO error: possible desync event (last cmd = 0x%x)", fifo_ctrl->last_cmd()); rsx_log.error("FIFO error: possible desync event (last cmd = 0x%x)", get_fifo_cmd());
recover_fifo(); recover_fifo();
return; return;
} }
@ -451,8 +446,8 @@ namespace rsx
if (fifo_ret_addr != RSX_CALL_STACK_EMPTY) if (fifo_ret_addr != RSX_CALL_STACK_EMPTY)
{ {
// Only one layer is allowed in the call stack. // Only one layer is allowed in the call stack.
rsx_log.error("FIFO: CALL found inside a subroutine. Discarding subroutine"); rsx_log.error("FIFO: CALL found inside a subroutine (last cmd = 0x%x)", get_fifo_cmd());
fifo_ctrl->set_get(std::exchange(fifo_ret_addr, RSX_CALL_STACK_EMPTY)); recover_fifo();
return; return;
} }
@ -465,8 +460,8 @@ namespace rsx
{ {
if (fifo_ret_addr == RSX_CALL_STACK_EMPTY) if (fifo_ret_addr == RSX_CALL_STACK_EMPTY)
{ {
rsx_log.error("FIFO: RET found without corresponding CALL. Discarding queue"); rsx_log.error("FIFO: RET found without corresponding CALL (last cmd = 0x%x)", get_fifo_cmd());
fifo_ctrl->set_get(ctrl->put); recover_fifo();
return; return;
} }

View file

@ -113,7 +113,7 @@ namespace rsx
{ {
private: private:
RsxDmaControl* m_ctrl = nullptr; RsxDmaControl* m_ctrl = nullptr;
rsx::rsx_iomap_table* m_iotable; const rsx::rsx_iomap_table* m_iotable;
u32 m_internal_get = 0; u32 m_internal_get = 0;
u32 m_memwatch_addr = 0; u32 m_memwatch_addr = 0;
@ -129,12 +129,11 @@ namespace rsx
FIFO_control(rsx::thread* pctrl); FIFO_control(rsx::thread* pctrl);
~FIFO_control() = default; ~FIFO_control() = default;
u32 get_pos() { return m_internal_get; } u32 get_pos() const { return m_internal_get; }
u32 last_cmd() { return m_cmd; } u32 last_cmd() const { return m_cmd; }
void sync_get() { m_ctrl->get.release(m_internal_get); } void sync_get() { m_ctrl->get.release(m_internal_get); }
void inc_get(bool wait); void inc_get(bool wait);
void set_get(u32 get); void set_get(u32 get);
void set_put(u32 put);
void abort(); void abort();
template <bool = true> u32 read_put(); template <bool = true> u32 read_put();

View file

@ -2342,7 +2342,7 @@ namespace rsx
} }
} }
u32 thread::get_fifo_cmd() u32 thread::get_fifo_cmd() const
{ {
// Last fifo cmd for logging and utility // Last fifo cmd for logging and utility
return fifo_ctrl->last_cmd(); return fifo_ctrl->last_cmd();

View file

@ -603,8 +603,8 @@ namespace rsx
atomic_t<bool> external_interrupt_ack{ false }; atomic_t<bool> external_interrupt_ack{ false };
void flush_fifo(); void flush_fifo();
void recover_fifo(); void recover_fifo();
void fifo_wake_delay(u64 div = 1); static void fifo_wake_delay(u64 div = 1);
u32 get_fifo_cmd(); u32 get_fifo_cmd() const;
// Performance approximation counters // Performance approximation counters
struct struct