mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
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:
parent
ebc696c58e
commit
dee90fa7aa
@ -80,14 +80,10 @@ void STACKALIGN CheckGatherPipe()
|
|||||||
memcpy(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
|
memcpy(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
|
||||||
|
|
||||||
// increase the CPUWritePointer
|
// increase the CPUWritePointer
|
||||||
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
if (ProcessorInterface::Fifo_CPUWritePointer == ProcessorInterface::Fifo_CPUEnd)
|
||||||
|
|
||||||
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)
|
|
||||||
ProcessorInterface::Fifo_CPUWritePointer = ProcessorInterface::Fifo_CPUBase;
|
ProcessorInterface::Fifo_CPUWritePointer = ProcessorInterface::Fifo_CPUBase;
|
||||||
|
else
|
||||||
|
ProcessorInterface::Fifo_CPUWritePointer += GATHER_PIPE_SIZE;
|
||||||
|
|
||||||
// TODO store video plugin pointer
|
// TODO store video plugin pointer
|
||||||
CPluginManager::GetInstance().GetVideo()->Video_GatherPipeBursted();
|
CPluginManager::GetInstance().GetVideo()->Video_GatherPipeBursted();
|
||||||
|
@ -590,9 +590,11 @@ void STACKALIGN GatherPipeBursted()
|
|||||||
if (g_VideoInitialize.bOnThread)
|
if (g_VideoInitialize.bOnThread)
|
||||||
{
|
{
|
||||||
// update the fifo-pointer
|
// update the fifo-pointer
|
||||||
fifo.CPWritePointer += GATHER_PIPE_SIZE;
|
|
||||||
if (fifo.CPWritePointer >= fifo.CPEnd)
|
if (fifo.CPWritePointer >= fifo.CPEnd)
|
||||||
fifo.CPWritePointer = fifo.CPBase;
|
fifo.CPWritePointer = fifo.CPBase;
|
||||||
|
else
|
||||||
|
fifo.CPWritePointer += GATHER_PIPE_SIZE;
|
||||||
|
|
||||||
Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE);
|
Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE);
|
||||||
|
|
||||||
// High watermark overflow handling (hacked way)
|
// High watermark overflow handling (hacked way)
|
||||||
@ -626,9 +628,10 @@ void STACKALIGN GatherPipeBursted()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fifo.CPWritePointer += GATHER_PIPE_SIZE;
|
|
||||||
if (fifo.CPWritePointer >= fifo.CPEnd)
|
if (fifo.CPWritePointer >= fifo.CPEnd)
|
||||||
fifo.CPWritePointer = fifo.CPBase;
|
fifo.CPWritePointer = fifo.CPBase;
|
||||||
|
else
|
||||||
|
fifo.CPWritePointer += GATHER_PIPE_SIZE;
|
||||||
// check if we are in sync
|
// 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.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");
|
_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
|
// 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
|
// We are going to do FP math on the main thread so have to save the current state
|
||||||
SaveSSEState();
|
SaveSSEState();
|
||||||
LoadDefaultSSEState();
|
LoadDefaultSSEState();
|
||||||
Fifo_SendFifoData(ptr,32);
|
Fifo_SendFifoData(ptr,32);
|
||||||
LoadSSEState();
|
LoadSSEState();
|
||||||
// adjust
|
|
||||||
ptr += 32;
|
|
||||||
|
|
||||||
fifo.CPReadWriteDistance -= 32;
|
fifo.CPReadWriteDistance -= 32;
|
||||||
|
|
||||||
@ -685,6 +685,11 @@ void CatchUpGPU()
|
|||||||
ptr = Memory_GetPtr(fifo.CPReadPointer);
|
ptr = Memory_GetPtr(fifo.CPReadPointer);
|
||||||
INFO_LOG(COMMANDPROCESSOR, "BUFFER LOOP");
|
INFO_LOG(COMMANDPROCESSOR, "BUFFER LOOP");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fifo.CPReadPointer += 32;
|
||||||
|
ptr += 32;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,7 +717,7 @@ void UpdateFifoRegister()
|
|||||||
if (wp >= rp)
|
if (wp >= rp)
|
||||||
dist = wp - rp;
|
dist = wp - rp;
|
||||||
else
|
else
|
||||||
dist = (wp - fifo.CPBase) + (fifo.CPEnd - rp);
|
dist = (wp - fifo.CPBase) + ((fifo.CPEnd + GATHER_PIPE_SIZE) - rp);
|
||||||
|
|
||||||
Common::AtomicStore(fifo.CPReadWriteDistance, dist);
|
Common::AtomicStore(fifo.CPReadWriteDistance, dist);
|
||||||
|
|
||||||
|
@ -165,18 +165,21 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
distToSend = 32;
|
distToSend = 32;
|
||||||
readPtr += 32;
|
|
||||||
if ( readPtr >= _fifo.CPEnd)
|
if ( readPtr >= _fifo.CPEnd)
|
||||||
readPtr = _fifo.CPBase;
|
readPtr = _fifo.CPBase;
|
||||||
|
else
|
||||||
|
readPtr += 32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
distToSend = _fifo.CPReadWriteDistance;
|
distToSend = _fifo.CPReadWriteDistance;
|
||||||
// send 1024B chunk max length to have better control over PeekMessages' period
|
// send 1024B chunk max length to have better control over PeekMessages' period
|
||||||
distToSend = distToSend > 1024 ? 1024 : distToSend;
|
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;
|
readPtr = _fifo.CPBase;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user