mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
DC idle skipping part 2: video thread is woken up when "OnIdle".
For testing purpose only (I can't test with lots of games) because it may break some sync. Besides, I'm not satisfied with the way things are done. So just uncomment "//#define THREAD_VIDEO_WAKEUP_ONIDLE" in thread.h in order to test it. Works fine with movies, 2D and simple 3D in ZWW at least. If it's ok I'll clean up the code. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@658 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -127,20 +127,36 @@ void Video_SendFifoData(u8* _uData)
|
||||
void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||
{
|
||||
SCPFifoStruct &_fifo = *video_initialize.pCPFifo;
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
HANDLE hEventOnIdle= OpenEventA(EVENT_ALL_ACCESS,FALSE,(LPCSTR)"EventOnIdle");
|
||||
if (hEventOnIdle==NULL) PanicAlert("Fifo_EnterLoop() -> EventOnIdle NULL");
|
||||
#endif
|
||||
|
||||
// TODO(ector): Don't peek so often!
|
||||
while (video_initialize.pPeekMessages())
|
||||
{
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
if (MsgWaitForMultipleObjects(1, &hEventOnIdle, FALSE, 1L, QS_ALLEVENTS) == WAIT_ABANDONED)
|
||||
break;
|
||||
#endif
|
||||
if (_fifo.CPReadWriteDistance < 1) //fifo.CPLoWatermark)
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
continue;
|
||||
#else
|
||||
Common::SleepCurrentThread(1);
|
||||
#endif
|
||||
//etc...
|
||||
|
||||
// check if we are able to run this buffer
|
||||
if ((_fifo.bFF_GPReadEnable) && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint))
|
||||
{
|
||||
int count = 200;
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
while(_fifo.CPReadWriteDistance > 0)
|
||||
#else
|
||||
int count = 200;
|
||||
while(_fifo.CPReadWriteDistance > 0 && count)
|
||||
{
|
||||
#endif
|
||||
{
|
||||
// check if we are on a breakpoint
|
||||
if (_fifo.bFF_BPEnable)
|
||||
{
|
||||
@ -169,10 +185,15 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||
_fifo.CPReadPointer = _fifo.CPBase;
|
||||
//LOG(COMMANDPROCESSOR, "BUFFER LOOP");
|
||||
}
|
||||
#ifndef THREAD_VIDEO_WAKEUP_ONIDLE
|
||||
count--;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
CloseHandle(hEventOnIdle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user