summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2010-01-23 21:06:12 +0000
committerskidau <skidau@gmail.com>2010-01-23 21:06:12 +0000
commit1f37bb2177b60e0e9a5eeffc3e14c8e6eebc4908 (patch)
tree106f2c083829a2afa0124bb74a614c52d6c822ba /Source/Core
parent0128e92068e7900df43b4099c4148e0ea7ff3c83 (diff)
Reverted the FIFO thread change
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4937 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/Src/Fifo.cpp178
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.cpp6
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.h1
3 files changed, 69 insertions, 116 deletions
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp
index dbdfa582b0..099084fae5 100644
--- a/Source/Core/VideoCommon/Src/Fifo.cpp
+++ b/Source/Core/VideoCommon/Src/Fifo.cpp
@@ -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,134 +132,94 @@ 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;
- // check if we are able to run this buffer
- while (_fifo.bFF_GPReadEnable && ((!_fifo.bFF_BPEnable && _fifo.CPReadWriteDistance) || (_fifo.bFF_BPEnable && !_fifo.bFF_Breakpoint)))
+ while (fifoStateRun)
{
- if (!fifoStateRun)
- break;
-
- CommandProcessor::FifoCriticalEnter();
+ video_initialize.pPeekMessages();
- // Create pointer to video data and send it to the VideoPlugin
- u32 readPtr = _fifo.CPReadPointer;
- u8 *uData = video_initialize.pGetMemoryPointer(readPtr);
+ VideoFifo_CheckEFBAccess();
+ VideoFifo_CheckSwapRequest();
- // If we are in BP mode we only send 32B chunks to Video plugin for BP checking
- if (_fifo.bFF_BPEnable)
+ // check if we are able to run this buffer
+ while (_fifo.bFF_GPReadEnable && ((!_fifo.bFF_BPEnable && _fifo.CPReadWriteDistance) || (_fifo.bFF_BPEnable && !_fifo.bFF_Breakpoint)))
{
- // Sometimes we have already exceeded the BP even before it is set
- // so careful check is required
- if (
- (readPtr == _fifo.CPBreakpoint) ||
- //(readPtr <= _fifo.CPBreakpoint && readPtr + 32 > _fifo.CPBreakpoint) ||
- (readPtr <= _fifo.CPWritePointer && _fifo.CPWritePointer < _fifo.CPBreakpoint) ||
- (readPtr <= _fifo.CPWritePointer && readPtr > _fifo.CPBreakpoint) ||
- (readPtr > _fifo.CPBreakpoint && _fifo.CPBreakpoint > _fifo.CPWritePointer)
- )
- {
- Common::AtomicStore(_fifo.bFF_Breakpoint, 1);
- CommandProcessor::UpdateInterruptsFromVideoPlugin(true);
- CommandProcessor::FifoCriticalLeave();
+ if (!fifoStateRun)
break;
- }
- distToSend = 32;
- if ( readPtr >= _fifo.CPEnd)
- readPtr = _fifo.CPBase;
- else
- readPtr += 32;
- }
- // If we are not in BP mode we send all the chunk we have to speed up
- else
- {
- distToSend = _fifo.CPReadWriteDistance;
- // send 1024B chunk max length to have better control over PeekMessages' period
- distToSend = distToSend > 1024 ? 1024 : distToSend;
- // add 32 bytes because the cp end points to the start of the last 32 byte chunk
- if ((distToSend + readPtr) >= (_fifo.CPEnd + 32)) // TODO: better?
+ CommandProcessor::FifoCriticalEnter();
+
+ // 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)
{
- distToSend =(_fifo.CPEnd + 32) - readPtr;
- readPtr = _fifo.CPBase;
+ // Sometimes we have already exceeded the BP even before it is set
+ // so careful check is required
+ if (
+ (readPtr == _fifo.CPBreakpoint) ||
+ //(readPtr <= _fifo.CPBreakpoint && readPtr + 32 > _fifo.CPBreakpoint) ||
+ (readPtr <= _fifo.CPWritePointer && _fifo.CPWritePointer < _fifo.CPBreakpoint) ||
+ (readPtr <= _fifo.CPWritePointer && readPtr > _fifo.CPBreakpoint) ||
+ (readPtr > _fifo.CPBreakpoint && _fifo.CPBreakpoint > _fifo.CPWritePointer)
+ )
+ {
+ Common::AtomicStore(_fifo.bFF_Breakpoint, 1);
+ CommandProcessor::UpdateInterruptsFromVideoPlugin(true);
+ CommandProcessor::FifoCriticalLeave();
+ break;
+ }
+ distToSend = 32;
+
+ if ( readPtr >= _fifo.CPEnd)
+ readPtr = _fifo.CPBase;
+ else
+ readPtr += 32;
}
+ // If we are not in BP mode we send all the chunk we have to speed up
else
- readPtr += distToSend;
- }
-
- // Execute new instructions found in uData
- Fifo_SendFifoData(uData, distToSend);
+ {
+ distToSend = _fifo.CPReadWriteDistance;
+ // send 1024B chunk max length to have better control over PeekMessages' period
+ distToSend = distToSend > 1024 ? 1024 : distToSend;
+ // add 32 bytes because the cp end points to the start of the last 32 byte chunk
+ if ((distToSend + readPtr) >= (_fifo.CPEnd + 32)) // TODO: better?
+ {
+ distToSend =(_fifo.CPEnd + 32) - readPtr;
+ readPtr = _fifo.CPBase;
+ }
+ else
+ readPtr += distToSend;
+ }
- Common::AtomicStore(_fifo.CPReadPointer, readPtr);
- Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
+ // Execute new instructions found in uData
+ Fifo_SendFifoData(uData, distToSend);
- CommandProcessor::FifoCriticalLeave();
- }
+ Common::AtomicStore(_fifo.CPReadPointer, readPtr);
+ Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend);
- CommandProcessor::SetFifoIdleFromVideoPlugin();
-}
-
-// Regular thread
-THREAD_RETURN fifo_thread(void* lpParameter)
-{
- while (fifoStateRun)
- {
- Fifo_Run();
+ CommandProcessor::FifoCriticalLeave();
- // Must use YieldCPU() in this loop. SLEEP(1) will make MP2
- // hang on boot.
+ // 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();
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();
- }
- }
-} \ No newline at end of file
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp
index 282e04b0aa..614811c813 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp
@@ -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);
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h
index 8254ad4ffe..359dc549d3 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.h
+++ b/Source/Core/VideoCommon/Src/VideoConfig.h
@@ -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