CP: Replace a couple spin-waits with event signals.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3828 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
3ad9b0a466
commit
ccfc004161
|
@ -336,6 +336,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
|||
VideoInitialize.pUpdateInterrupts = &(CommandProcessor::UpdateInterruptsFromVideoPlugin);
|
||||
VideoInitialize.pMemoryBase = Memory::base;
|
||||
VideoInitialize.pKeyPress = Callback_KeyPress;
|
||||
VideoInitialize.pSetFifoIdle = &(CommandProcessor::SetFifoIdleFromVideoPlugin);
|
||||
VideoInitialize.bWii = _CoreParameter.bWii;
|
||||
VideoInitialize.bUseDualCore = _CoreParameter.bUseDualCore;
|
||||
VideoInitialize.pBBox = &PixelEngine::bbox[0];
|
||||
|
|
|
@ -152,6 +152,7 @@ u16 m_tokenReg;
|
|||
|
||||
SCPFifoStruct fifo; //This one is shared between gfx thread and emulator thread
|
||||
static u32 fake_GPWatchdogLastToken = 0;
|
||||
static Common::Event s_fifoIdleEvent;
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
|
@ -191,7 +192,7 @@ void IncrementGPWDToken()
|
|||
void WaitForFrameFinish()
|
||||
{
|
||||
while ((fake_GPWatchdogLastToken == fifo.Fake_GPWDToken) && fifo.bFF_GPReadEnable && (fifo.CPReadWriteDistance > 0) && !(fifo.bFF_BPEnable && fifo.bFF_Breakpoint))
|
||||
Common::YieldCPU();
|
||||
s_fifoIdleEvent.MsgWait();
|
||||
fake_GPWatchdogLastToken = fifo.Fake_GPWDToken;
|
||||
}
|
||||
|
||||
|
@ -217,18 +218,19 @@ void Init()
|
|||
m_tokenReg = 0;
|
||||
|
||||
fake_GPWatchdogLastToken = 0;
|
||||
|
||||
memset(&fifo,0,sizeof(fifo));
|
||||
fifo.CPCmdIdle = 1 ;
|
||||
fifo.CPReadIdle = 1;
|
||||
|
||||
s_fifoIdleEvent.Init();
|
||||
|
||||
et_UpdateInterrupts = CoreTiming::RegisterEvent("UpdateInterrupts", UpdateInterrupts_Wrapper);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
// delete fifo.sync;
|
||||
#endif
|
||||
s_fifoIdleEvent.Shutdown();
|
||||
}
|
||||
|
||||
void Read16(u16& _rReturnValue, const u32 _Address)
|
||||
|
@ -378,8 +380,8 @@ void Write16(const u16 _Value, const u32 _Address)
|
|||
DEBUG_LOG(COMMANDPROCESSOR, "*********************** GXSetGPFifo very soon? ***********************");
|
||||
// (mb2) We don't sleep here since it could be a perf issue for super monkey ball (yup only this game IIRC)
|
||||
// Touching that game is a no-go so I don't want to take the risk :p
|
||||
while (fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance > 0 )
|
||||
Common::YieldCPU();
|
||||
while (fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance > 0 && !(fifo.bFF_BPEnable && fifo.bFF_Breakpoint) )
|
||||
s_fifoIdleEvent.MsgWait();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -739,4 +741,9 @@ void UpdateInterruptsFromVideoPlugin()
|
|||
CoreTiming::ScheduleEvent_Threadsafe(0, et_UpdateInterrupts);
|
||||
}
|
||||
|
||||
void SetFifoIdleFromVideoPlugin()
|
||||
{
|
||||
s_fifoIdleEvent.Set();
|
||||
}
|
||||
|
||||
} // end of namespace CommandProcessor
|
||||
|
|
|
@ -81,6 +81,7 @@ void CatchUpGPU();
|
|||
void GatherPipeBursted();
|
||||
void UpdateInterrupts();
|
||||
void UpdateInterruptsFromVideoPlugin();
|
||||
void SetFifoIdleFromVideoPlugin();
|
||||
|
||||
bool AllowIdleSkipping();
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
|||
}
|
||||
|
||||
Common::AtomicStore(_fifo.CPReadIdle, 1);
|
||||
video_initialize.pSetFifoIdle();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ typedef unsigned int (*TPeekMessages)(void);
|
|||
typedef void (*TUpdateInterrupts)(void);
|
||||
typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title
|
||||
typedef void (*TKeyPressed)(int keycode, bool shift, bool control); // sets the window title
|
||||
typedef void (*TSetFifoIdle)();
|
||||
|
||||
enum FieldType
|
||||
{
|
||||
|
@ -82,6 +83,8 @@ typedef struct
|
|||
TUpdateFPSDisplay pUpdateFPSDisplay;
|
||||
TKeyPressed pKeyPress;
|
||||
|
||||
TSetFifoIdle pSetFifoIdle;
|
||||
|
||||
SCPFifoStruct *pCPFifo;
|
||||
void *pMemoryBase;
|
||||
bool bWii;
|
||||
|
|
Loading…
Reference in New Issue