The WGP does not loop if the write pointer is set beyond the end of the fifo. Updated the video plugins this time.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4531 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
donkopunchstania 2009-11-12 01:51:40 +00:00
parent ebc696c58e
commit dee90fa7aa
3 changed files with 21 additions and 17 deletions

View File

@ -80,14 +80,10 @@ void STACKALIGN CheckGatherPipe()
memcpy(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
// increase the CPUWritePointer
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
if (ProcessorInterface::Fifo_CPUWritePointer > ProcessorInterface::Fifo_CPUEnd)
_assert_msg_(DYNA_REC, 0, "Fifo_CPUWritePointer out of bounds: %08x (end = %08x)",
ProcessorInterface::Fifo_CPUWritePointer, ProcessorInterface::Fifo_CPUEnd);
if (ProcessorInterface::Fifo_CPUWritePointer >= ProcessorInterface::Fifo_CPUEnd)
if (ProcessorInterface::Fifo_CPUWritePointer == ProcessorInterface::Fifo_CPUEnd)
ProcessorInterface::Fifo_CPUWritePointer = ProcessorInterface::Fifo_CPUBase;
else
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
// TODO store video plugin pointer
CPluginManager::GetInstance().GetVideo()->Video_GatherPipeBursted();

View File

@ -590,9 +590,11 @@ void STACKALIGN GatherPipeBursted()
if (g_VideoInitialize.bOnThread)
{
// update the fifo-pointer
fifo.CPWritePointer += GATHER_PIPE_SIZE;
if (fifo.CPWritePointer >= fifo.CPEnd)
fifo.CPWritePointer = fifo.CPBase;
else
fifo.CPWritePointer += GATHER_PIPE_SIZE;
Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE);
// High watermark overflow handling (hacked way)
@ -626,9 +628,10 @@ void STACKALIGN GatherPipeBursted()
}
else
{
fifo.CPWritePointer += GATHER_PIPE_SIZE;
if (fifo.CPWritePointer >= fifo.CPEnd)
fifo.CPWritePointer = fifo.CPBase;
else
fifo.CPWritePointer += GATHER_PIPE_SIZE;
// check if we are in sync
_assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == *(g_VideoInitialize.Fifo_CPUWritePointer), "FIFOs linked but out of sync");
_assert_msg_(COMMANDPROCESSOR, fifo.CPBase == *(g_VideoInitialize.Fifo_CPUBase), "FIFOs linked but out of sync");
@ -666,14 +669,11 @@ void CatchUpGPU()
}
// read the data and send it to the VideoPlugin
fifo.CPReadPointer += 32;
// We are going to do FP math on the main thread so have to save the current state
SaveSSEState();
LoadDefaultSSEState();
Fifo_SendFifoData(ptr,32);
LoadSSEState();
// adjust
ptr += 32;
fifo.CPReadWriteDistance -= 32;
@ -685,6 +685,11 @@ void CatchUpGPU()
ptr = Memory_GetPtr(fifo.CPReadPointer);
INFO_LOG(COMMANDPROCESSOR, "BUFFER LOOP");
}
else
{
fifo.CPReadPointer += 32;
ptr += 32;
}
}
}
}
@ -712,7 +717,7 @@ void UpdateFifoRegister()
if (wp >= rp)
dist = wp - rp;
else
dist = (wp - fifo.CPBase) + (fifo.CPEnd - rp);
dist = (wp - fifo.CPBase) + ((fifo.CPEnd + GATHER_PIPE_SIZE) - rp);
Common::AtomicStore(fifo.CPReadWriteDistance, dist);

View File

@ -165,18 +165,21 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
break;
}
distToSend = 32;
readPtr += 32;
if ( readPtr >= _fifo.CPEnd)
readPtr = _fifo.CPBase;
else
readPtr += 32;
}
else
{
distToSend = _fifo.CPReadWriteDistance;
// send 1024B chunk max length to have better control over PeekMessages' period
distToSend = distToSend > 1024 ? 1024 : distToSend;
if ((distToSend + readPtr) >= _fifo.CPEnd) // TODO: better?
// add 32 bytes because the cp end points to the start of the last 32 byte chunk
if ((distToSend + readPtr) >= (_fifo.CPEnd + 32)) // TODO: better?
{
distToSend =_fifo.CPEnd - readPtr;
distToSend =(_fifo.CPEnd + 32) - readPtr;
readPtr = _fifo.CPBase;
}
else