mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
816647a86f
commit
4a8ba5cd40
|
@ -174,7 +174,7 @@ protected:
|
||||||
// Counts the number of vsync frames queued in the MTGS ringbuffer. This is used to
|
// 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
|
// 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)
|
// 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
|
// Protection lock for the frame queue counter -- needed because we can't safely
|
||||||
// AtomicExchange from two threads.
|
// AtomicExchange from two threads.
|
||||||
|
|
|
@ -442,6 +442,13 @@ void mtgsThreadObject::PostVsyncEnd( bool updategs )
|
||||||
{
|
{
|
||||||
while( m_QueuedFrames > 8 )
|
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.
|
Sleep( 2 ); // Sleep off quite a bit of time, since we're obviously *waaay* ahead.
|
||||||
SpinWait();
|
SpinWait();
|
||||||
}
|
}
|
||||||
|
@ -560,7 +567,7 @@ int mtgsThreadObject::Callback()
|
||||||
gsFrameSkip( !tag.data[1] );
|
gsFrameSkip( !tag.data[1] );
|
||||||
|
|
||||||
m_lock_FrameQueueCounter.Lock();
|
m_lock_FrameQueueCounter.Lock();
|
||||||
m_QueuedFrames--;
|
AtomicDecrement( m_QueuedFrames );
|
||||||
jASSUME( m_QueuedFrames >= 0 );
|
jASSUME( m_QueuedFrames >= 0 );
|
||||||
m_lock_FrameQueueCounter.Unlock();
|
m_lock_FrameQueueCounter.Unlock();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue