mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -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:
@ -367,10 +367,17 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
g_hEventOnIdle = CreateEvent( NULL, FALSE, FALSE, "EventOnIdle");
|
||||
if (g_hEventOnIdle == NULL) PanicAlert("EmuThread() -> Create EventOnIdle error");
|
||||
#endif
|
||||
cpuThread = new Common::Thread(CpuThread, pArg);
|
||||
PluginVideo::Video_Prepare(); //wglMakeCurrent
|
||||
Common::SetCurrentThreadName("Video thread");
|
||||
PluginVideo::Video_EnterLoop();
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
CloseHandle(g_hEventOnIdle);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Wait for CPU thread to exit - it should have been signaled to do so by now
|
||||
|
@ -459,9 +459,10 @@ void CatchUpGPU()
|
||||
void UpdateFifoRegister()
|
||||
{
|
||||
// update the distance
|
||||
#ifdef _WIN32
|
||||
if (Core::g_CoreStartupParameter.bUseDualCore) EnterCriticalSection(&fifo.sync);
|
||||
#endif
|
||||
//#ifdef _WIN32
|
||||
// not needed since we are already in the critical section in DC mode -> see write16(...) (unique reference)
|
||||
// if (Core::g_CoreStartupParameter.bUseDualCore) EnterCriticalSection(&fifo.sync);
|
||||
//#endif
|
||||
int wp = fifo.CPWritePointer;
|
||||
int rp = fifo.CPReadPointer;
|
||||
if (wp >= rp)
|
||||
@ -469,9 +470,10 @@ void UpdateFifoRegister()
|
||||
else
|
||||
fifo.CPReadWriteDistance = (wp - fifo.CPBase) +
|
||||
(fifo.CPEnd - rp);
|
||||
#ifdef _WIN32
|
||||
if (Core::g_CoreStartupParameter.bUseDualCore) LeaveCriticalSection(&fifo.sync);
|
||||
#endif
|
||||
//#ifdef _WIN32
|
||||
// not needed since we are already in the critical section in DC mode (see write16)
|
||||
// if (Core::g_CoreStartupParameter.bUseDualCore) LeaveCriticalSection(&fifo.sync);
|
||||
//#endif
|
||||
if (!Core::g_CoreStartupParameter.bUseDualCore) CatchUpGPU();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#include "../Host.h"
|
||||
|
||||
#include "thread.h" // for g_hEventOnIdle
|
||||
|
||||
namespace PowerPC
|
||||
{
|
||||
// STATE_TO_SAVE
|
||||
@ -293,6 +295,10 @@ namespace PowerPC
|
||||
//DualCore OnIdle
|
||||
void OnIdleDC(void)
|
||||
{
|
||||
#if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
|
||||
if (g_hEventOnIdle==NULL) PanicAlert("Idle() -> EventOnIdle NULL");
|
||||
if (! SetEvent(g_hEventOnIdle) ) { PanicAlert("Idle() -> SetEvent EventOnIdle failed");}
|
||||
#endif
|
||||
CoreTiming::Idle();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user