Added some diagnostic and recovery checks to the MTGS queued frame counter, as per problems expressed in Issue 49.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@562 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-02-21 17:23:39 +00:00
parent 816647a86f
commit 4a8ba5cd40
2 changed files with 9 additions and 2 deletions

View File

@ -174,7 +174,7 @@ protected:
// Counts the number of vsync frames queued in the MTGS ringbuffer. This is used to
// throttle the number of frames allowed to be rendered ahead of time for games that
// run very fast and have little or no ringbuffer overhead (typically opening menus)
volatile u32 m_QueuedFrames;
volatile s32 m_QueuedFrames;
// Protection lock for the frame queue counter -- needed because we can't safely
// AtomicExchange from two threads.

View File

@ -442,6 +442,13 @@ void mtgsThreadObject::PostVsyncEnd( bool updategs )
{
while( m_QueuedFrames > 8 )
{
if( m_WritePos == volatize( m_RingPos ) )
{
// MTGS ringbuffer is empty, but we still have queued frames in the counter? Ouch!
Console::Error( "MTGS > Queued framecount mismatch = %d", params m_QueuedFrames );
m_QueuedFrames = 0;
break;
}
Sleep( 2 ); // Sleep off quite a bit of time, since we're obviously *waaay* ahead.
SpinWait();
}
@ -560,7 +567,7 @@ int mtgsThreadObject::Callback()
gsFrameSkip( !tag.data[1] );
m_lock_FrameQueueCounter.Lock();
m_QueuedFrames--;
AtomicDecrement( m_QueuedFrames );
jASSUME( m_QueuedFrames >= 0 );
m_lock_FrameQueueCounter.Unlock();