Reverted the FIFO thread change

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4937 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2010-01-23 21:06:12 +00:00
parent 0128e92068
commit 1f37bb2177
3 changed files with 79 additions and 126 deletions

View File

@ -39,12 +39,8 @@ static u8 *videoBuffer;
static Common::EventEx fifo_run_event;
// STATE_TO_SAVE
static int size = 0;
} // namespace
Common::Thread *g_hFifoThread = NULL;
SVideoInitialize video_initialize;
void Fifo_DoState(PointerWrap &p)
{
CommandProcessor::FifoCriticalEnter();
@ -136,11 +132,21 @@ void Fifo_SendFifoData(u8* _uData, u32 len)
OpcodeDecoder_Run(g_bSkipCurrentFrame);
}
inline void Fifo_Run()
// Description: Main FIFO update loop
// Purpose: Keep the Core HW updated about the CPU-GPU distance
void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
{
fifoStateRun = true;
SCPFifoStruct &_fifo = CommandProcessor::fifo;
s32 distToSend;
while (fifoStateRun)
{
video_initialize.pPeekMessages();
VideoFifo_CheckEFBAccess();
VideoFifo_CheckSwapRequest();
// check if we are able to run this buffer
while (_fifo.bFF_GPReadEnable && ((!_fifo.bFF_BPEnable && _fifo.CPReadWriteDistance) || (_fifo.bFF_BPEnable && !_fifo.bFF_Breakpoint)))
{
@ -152,6 +158,7 @@ inline void Fifo_Run()
// Create pointer to video data and send it to the VideoPlugin
u32 readPtr = _fifo.CPReadPointer;
u8 *uData = video_initialize.pGetMemoryPointer(readPtr);
// NOTICE_LOG(BOOT, "readPtr: %08x uData %08x", readPtr, uData);
// If we are in BP mode we only send 32B chunks to Video plugin for BP checking
if (_fifo.bFF_BPEnable)
@ -201,69 +208,18 @@ inline void Fifo_Run()
Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
CommandProcessor::FifoCriticalLeave();
}
// Those two are pretty important and must be called in the FIFO Loop.
// If we don't, s_swapRequested (OGL only) or s_efbAccessRequested won't be set to false
// leading the CPU thread to wait in Video_BeginField or Video_AccessEFB thus slowing things down.
VideoFifo_CheckEFBAccess();
VideoFifo_CheckSwapRequest();
}
CommandProcessor::SetFifoIdleFromVideoPlugin();
}
// Regular thread
THREAD_RETURN fifo_thread(void* lpParameter)
{
while (fifoStateRun)
{
Fifo_Run();
// Must use YieldCPU() in this loop. SLEEP(1) will make MP2
// hang on boot.
if (EmuRunning)
Common::YieldCPU();
else
fifo_run_event.MsgWait();
}
return 0;
}
// Description: Main FIFO update loop
// Purpose: Keep the Core HW updated about the CPU-GPU distance
void Fifo_EnterLoop(const SVideoInitialize &video_init)
{
fifoStateRun = true;
video_initialize = video_init;
if (g_ActiveConfig.bUseFIFOThread) // threaded mode
{
g_hFifoThread = new Common::Thread(fifo_thread, NULL);
while (fifoStateRun)
{
video_initialize.pPeekMessages();
// The two VideoFifo checks below are pretty important and must be
// called in the FIFO Loop. If we don't, s_swapRequested (OGL only)
// or s_efbAccessRequested won't be set to false leading the CPU
// thread to wait in Video_BeginField or Video_AccessEFB thus slowing
// things down.
VideoFifo_CheckEFBAccess();
VideoFifo_CheckSwapRequest();
SLEEP(1);
}
}
else
{
while (fifoStateRun)
{
video_initialize.pPeekMessages();
VideoFifo_CheckEFBAccess();
VideoFifo_CheckSwapRequest();
Fifo_Run();
if (EmuRunning)
Common::YieldCPU();
else
fifo_run_event.MsgWait();
}
}
}

View File

@ -57,8 +57,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
iniFile.Get("Settings", "Crop", &bCrop, false);
iniFile.Get("Settings", "HideCursor", &bHideCursor, false);
iniFile.Get("Settings", "UseXFB", &bUseXFB, false);
iniFile.Get("Settings", "UseFIFOThread", &bUseFIFOThread, false);
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
@ -131,7 +130,7 @@ void VideoConfig::GameIniLoad(const char *ini_file)
if (iniFile.Exists("Video", "DstAlphaPass"))
iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass, false);
if (iniFile.Exists("Video", "UseXFB"))
iniFile.Get("Video", "UseXFB", &bUseXFB, false);
iniFile.Get("Video", "UseXFB", &bUseXFB, 0);
if (iniFile.Exists("Video", "FIFOBPHack"))
iniFile.Get("Video", "FIFOBPHack", &bFIFOBPhack, false);
if (iniFile.Exists("Video", "ProjectionHack"))
@ -154,7 +153,6 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Settings", "wideScreenHack", bWidescreenHack);
iniFile.Set("Settings", "HideCursor", bHideCursor);
iniFile.Set("Settings", "UseXFB", bUseXFB);
iniFile.Set("Settings", "UseFIFOThread", bUseFIFOThread);
iniFile.Set("Settings", "AutoScale", bAutoScale);
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);

View File

@ -81,7 +81,6 @@ struct VideoConfig
int iAspectRatio;
bool bCrop; // Aspect ratio controls.
bool bUseXFB;
bool bUseFIFOThread;
bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly.
// Enhancements