GPU: Don't panic when FIFO is non-empty with VRAM->CPU copy

This probably is not a good state to be in though, since the DMA request
gets turned off and will never resume until it's copied out.
This commit is contained in:
Connor McLaughlin 2020-05-17 14:05:29 +10:00
parent 7d887edf17
commit 597aa20d83
2 changed files with 11 additions and 5 deletions

View file

@ -766,11 +766,9 @@ u32 GPU::ReadGPUREAD()
Log_DebugPrintf("End of VRAM->CPU transfer"); Log_DebugPrintf("End of VRAM->CPU transfer");
m_vram_transfer = {}; m_vram_transfer = {};
m_blitter_state = BlitterState::Idle; m_blitter_state = BlitterState::Idle;
UpdateDMARequest();
// end of transfer, catch up on any commands which were written (unlikely) // end of transfer, catch up on any commands which were written (unlikely)
ExecuteCommands(); ExecuteCommands();
UpdateDMARequest();
break; break;
} }
} }

View file

@ -37,7 +37,7 @@ void GPU::ExecuteCommands()
if ((this->*s_GP0_command_handler_table[command])()) if ((this->*s_GP0_command_handler_table[command])())
continue; continue;
else else
break; goto batch_done;
} }
case BlitterState::WritingVRAM: case BlitterState::WritingVRAM:
@ -59,7 +59,7 @@ void GPU::ExecuteCommands()
case BlitterState::ReadingVRAM: case BlitterState::ReadingVRAM:
{ {
Panic("shouldn't be here"); goto batch_done;
} }
break; break;
@ -101,6 +101,7 @@ void GPU::ExecuteCommands()
} }
} }
batch_done:
m_fifo_pushed = false; m_fifo_pushed = false;
UpdateDMARequest(); UpdateDMARequest();
if (!m_fifo_pushed) if (!m_fifo_pushed)
@ -168,8 +169,15 @@ GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
bool GPU::HandleUnknownGP0Command() bool GPU::HandleUnknownGP0Command()
{ {
const u32 command = m_fifo.Pop() >> 24; const u32 command = m_fifo.Peek() >> 24;
Log_ErrorPrintf("Unimplemented GP0 command 0x%02X", command); Log_ErrorPrintf("Unimplemented GP0 command 0x%02X", command);
SmallString dump;
for (u32 i = 0; i < m_fifo.GetSize(); i++)
dump.AppendFormattedString("%s0x%08X", (i > 0) ? " " : "", m_fifo.Peek(i));
Log_ErrorPrintf("FIFO: %s", dump.GetCharArray());
m_fifo.RemoveOne();
EndCommand(); EndCommand();
return true; return true;
} }