More FIFO work. I've implemented intelligent mechanism in GatherPipeBursted to prevent "FIFO is overflown by GatherPipe!". I commented HiWatermark_Tighter parameter. If Hopefully this patch fix this issue. I will delete this definitely. I tested StarFox for 20 minutes and works really fine. :) This patch also can help when the CPU go ahead the GPU and sync in better way.
Plus: I added a _assert_msg_ in FIFO loop when the WriteDistance is negative. Please if that happens report it, this can help to solve strange issues with wrong WriteDistances. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6495 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c540995193
commit
40c4e5f9a7
|
@ -526,8 +526,8 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||||
break;
|
break;
|
||||||
case FIFO_HI_WATERMARK_HI:
|
case FIFO_HI_WATERMARK_HI:
|
||||||
WriteHigh((u32 &)fifo.CPHiWatermark, _Value);
|
WriteHigh((u32 &)fifo.CPHiWatermark, _Value);
|
||||||
// Tune this when you see lots of FIFO overflown by GatherPipe
|
// Tune this when you see lots of FIFO overflown by GatherPipe
|
||||||
HiWatermark_Tighter = fifo.CPHiWatermark - 32 * g_ActiveConfig.iFIFOWatermarkTightness;
|
//HiWatermark_Tighter = fifo.CPHiWatermark - 32 * g_ActiveConfig.iFIFOWatermarkTightness;
|
||||||
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI : %04x", _Value);
|
DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI : %04x", _Value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -625,21 +625,32 @@ void STACKALIGN GatherPipeBursted()
|
||||||
|
|
||||||
if (g_VideoInitialize.bOnThread)
|
if (g_VideoInitialize.bOnThread)
|
||||||
{
|
{
|
||||||
// A little trick to prevent FIFO from overflown in dual core mode (n < 100 to avoid dead lock)
|
|
||||||
for (int cnt = 0; fifo.CPReadWriteDistance > fifo.CPEnd - fifo.CPBase && cnt < 100; cnt++)
|
if (fifo.CPReadWriteDistance >= fifo.CPHiWatermark)
|
||||||
Common::SwitchCurrentThread();
|
{
|
||||||
|
// A little trick to prevent FIFO from overflown in dual core mode
|
||||||
|
while (fifo.bFF_GPReadEnable && (fifo.CPReadWriteDistance >= fifo.CPHiWatermark))
|
||||||
|
Common::YieldCPU();
|
||||||
|
|
||||||
|
if (!m_CPStatusReg.OverflowHiWatermark)
|
||||||
|
{
|
||||||
|
m_CPStatusReg.OverflowHiWatermark = true;
|
||||||
|
if (m_CPCtrlReg.FifoOverflowIntEnable)
|
||||||
|
UpdateInterrupts();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CatchUpGPU();
|
CatchUpGPU();
|
||||||
}
|
if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= fifo.CPHiWatermark)
|
||||||
|
{
|
||||||
// The interrupt latency in Dolphin is much longer than Hardware, so we must be more vigilant on Watermark
|
m_CPStatusReg.OverflowHiWatermark = true;
|
||||||
if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= HiWatermark_Tighter)
|
if (m_CPCtrlReg.FifoOverflowIntEnable)
|
||||||
{
|
UpdateInterrupts();
|
||||||
m_CPStatusReg.OverflowHiWatermark = true;
|
}
|
||||||
if (m_CPCtrlReg.FifoOverflowIntEnable)
|
|
||||||
UpdateInterrupts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
||||||
|
|
|
@ -196,6 +196,10 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||||
readPtr += distToSend;
|
readPtr += distToSend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_assert_msg_(COMMANDPROCESSOR, _fifo.CPReadWriteDistance - distToSend >= 0 ,
|
||||||
|
"Negative fifo.CPReadWriteDistance = %i in FIFO Loop !\nThat can produce inestabilty in the game. Please report it.", _fifo.CPReadWriteDistance - distToSend);
|
||||||
|
|
||||||
Common::AtomicStore(_fifo.CPReadPointer, readPtr);
|
Common::AtomicStore(_fifo.CPReadPointer, readPtr);
|
||||||
Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
|
Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
|
||||||
// Execute new instructions found in uData
|
// Execute new instructions found in uData
|
||||||
|
|
Loading…
Reference in New Issue