GIF: Fix MFIFO DMAStalls. Fix InstantDMA with PSE bit set

This commit is contained in:
Ty Lamontagne 2022-11-17 20:12:26 -05:00 committed by refractionpcsx2
parent ebfd656c54
commit e1f7fe5700
1 changed files with 13 additions and 9 deletions

View File

@ -423,8 +423,9 @@ void GIFdma()
if (gifRegs.ctrl.PSE) if (gifRegs.ctrl.PSE)
{ // Temporarily stop { // Temporarily stop
Console.WriteLn("Gif dma temp paused? (non MFIFO GIF)"); DevCon.WriteLn("Gif dma paused by PSE bit.");
GifDMAInt(16); GifDMAInt(16);
CPU_SET_DMASTALL(DMAC_GIF, true);
return; return;
} }
@ -434,6 +435,7 @@ void GIFdma()
if ((gifch.madr + (gifch.qwc * 16)) > dmacRegs.stadr.ADDR) if ((gifch.madr + (gifch.qwc * 16)) > dmacRegs.stadr.ADDR)
{ {
GifDMAInt(4); GifDMAInt(4);
CPU_SET_DMASTALL(DMAC_GIF, true);
gif.gscycles = 0; gif.gscycles = 0;
return; return;
} }
@ -668,8 +670,9 @@ void mfifoGIFtransfer()
if (gifRegs.ctrl.PSE) if (gifRegs.ctrl.PSE)
{ // Temporarily stop { // Temporarily stop
Console.WriteLn("Gif dma temp paused?"); DevCon.WriteLn("Gif MFIFO dma paused by PSE bit.");
CPU_INT(DMAC_MFIFO_GIF, 16); CPU_INT(DMAC_MFIFO_GIF, 16);
CPU_SET_DMASTALL(DMAC_MFIFO_GIF, true);
return; return;
} }
@ -682,6 +685,7 @@ void mfifoGIFtransfer()
SPR_LOG("GIF FIFO EMPTY before tag read"); SPR_LOG("GIF FIFO EMPTY before tag read");
gif.gifstate = GIF_STATE_EMPTY; gif.gifstate = GIF_STATE_EMPTY;
GifDMAInt(4); GifDMAInt(4);
CPU_SET_DMASTALL(DMAC_MFIFO_GIF, true);
return; return;
} }
@ -730,7 +734,7 @@ void gifMFIFOInterrupt()
{ // GIF not in MFIFO anymore, come out. { // GIF not in MFIFO anymore, come out.
DevCon.WriteLn("GIF Leaving MFIFO - Report if any errors"); DevCon.WriteLn("GIF Leaving MFIFO - Report if any errors");
gifInterrupt(); gifInterrupt();
CPU_SET_DMASTALL(DMAC_GIF, true); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, true);
return; return;
} }
@ -751,7 +755,7 @@ void gifMFIFOInterrupt()
{ {
GifDMAInt(16); GifDMAInt(16);
} }
CPU_SET_DMASTALL(DMAC_GIF, gifUnit.Path3Masked() || !gifUnit.CanDoPath3()); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, gifUnit.Path3Masked() || !gifUnit.CanDoPath3());
return; return;
} }
} }
@ -759,7 +763,7 @@ void gifMFIFOInterrupt()
if (gifUnit.gsSIGNAL.queued) if (gifUnit.gsSIGNAL.queued)
{ {
GifDMAInt(128); GifDMAInt(128);
CPU_SET_DMASTALL(DMAC_GIF, true); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, true);
return; return;
} }
@ -777,7 +781,7 @@ void gifMFIFOInterrupt()
// If there is no DMA data waiting and the DMA is active, let the DMA progress until there is // If there is no DMA data waiting and the DMA is active, let the DMA progress until there is
if ((!CheckPaths() && gif_fifo.fifoSize == 16) || readSize) if ((!CheckPaths() && gif_fifo.fifoSize == 16) || readSize)
{ {
CPU_SET_DMASTALL(DMAC_GIF, gifUnit.Path3Masked() || !gifUnit.CanDoPath3()); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, gifUnit.Path3Masked() || !gifUnit.CanDoPath3());
return; return;
} }
} }
@ -792,7 +796,7 @@ void gifMFIFOInterrupt()
if (gifch.qwc > 0 || !gif.gspath3done) if (gifch.qwc > 0 || !gif.gspath3done)
{ {
CPU_SET_DMASTALL(DMAC_GIF, true); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, true);
return; return;
} }
} }
@ -800,7 +804,7 @@ void gifMFIFOInterrupt()
if (gifch.qwc > 0 || !gif.gspath3done) if (gifch.qwc > 0 || !gif.gspath3done)
{ {
mfifoGIFtransfer(); mfifoGIFtransfer();
CPU_SET_DMASTALL(DMAC_GIF, gifUnit.Path3Masked() || !gifUnit.CanDoPath3()); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, gifUnit.Path3Masked() || !gifUnit.CanDoPath3());
return; return;
} }
@ -811,7 +815,7 @@ void gifMFIFOInterrupt()
gifRegs.stat.FQC = gif_fifo.fifoSize; gifRegs.stat.FQC = gif_fifo.fifoSize;
CalculateFIFOCSR(); CalculateFIFOCSR();
hwDmacIrq(DMAC_GIF); hwDmacIrq(DMAC_GIF);
CPU_SET_DMASTALL(DMAC_GIF, false); CPU_SET_DMASTALL(DMAC_MFIFO_GIF, false);
if (gif_fifo.fifoSize) if (gif_fifo.fifoSize)
GifDMAInt(8 * BIAS); GifDMAInt(8 * BIAS);
DMA_LOG("GIF MFIFO DMA End"); DMA_LOG("GIF MFIFO DMA End");