GIF: re-re-fix FIFO behaviour

Fixes #4915
This commit is contained in:
refractionpcsx2 2021-10-18 12:14:21 +01:00
parent c363241fad
commit a85247ff9f
1 changed files with 18 additions and 8 deletions

View File

@ -288,11 +288,16 @@ __fi void gifInterrupt()
} }
} }
} }
// If the dma has data waiting and there's something in the fifo, drain the fifo // The following is quite timing sensitive so we need to pause/resume the DMA in these certain scenarios
// If the GIF is currently paused, check if the FIFO is full, otherwise fill it // If the DMA is masked/blocked and the fifo is full, no need to run the DMA
if ((!CheckPaths() && gif_fifo.fifoSize == 16) || (readSize && gif_fifo.fifoSize < 16)) // If we just read from the fifo, we want to loop and not read more DMA
// 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 (gifch.qwc || !gifch.chcr.STR)
return; return;
} }
}
if (!(gifch.chcr.STR)) if (!(gifch.chcr.STR))
return; return;
@ -800,11 +805,16 @@ void gifMFIFOInterrupt()
} }
} }
// If the dma has data waiting and there's something in the fifo, drain the fifo // The following is quite timing sensitive so we need to pause/resume the DMA in these certain scenarios
// If the GIF is currently paused, check if the FIFO is full, otherwise fill it // If the DMA is masked/blocked and the fifo is full, no need to run the DMA
if ((!CheckPaths() && gif_fifo.fifoSize == 16) || (readSize && gif_fifo.fifoSize < 16)) // If we just read from the fifo, we want to loop and not read more DMA
// 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 (gifch.qwc || !gifch.chcr.STR)
return; return;
} }
}
if (!gifch.chcr.STR) if (!gifch.chcr.STR)
return; return;