diff options
| author | memberTwo.mb2 <memberTwo.mb2@gmail.com> | 2008-09-24 10:52:58 +0000 |
|---|---|---|
| committer | memberTwo.mb2 <memberTwo.mb2@gmail.com> | 2008-09-24 10:52:58 +0000 |
| commit | da088e62ad25dc53e20230c84b36c573bd95c46a (patch) | |
| tree | 30ef9d2977f164b94a17eb57d76c2a90873cd5cc /Source/Core/VideoCommon/Src/Fifo.cpp | |
| parent | e4725675fd4ecad96c9c5a8851f71aec4295a338 (diff) | |
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
Diffstat (limited to 'Source/Core/VideoCommon/Src/Fifo.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/Fifo.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 4781a351c1..d6e6cef4b0 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -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
}
|
