summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorayuanx <ayuanx@gmail.com>2010-06-16 14:22:17 +0000
committerayuanx <ayuanx@gmail.com>2010-06-16 14:22:17 +0000
commit221e722284decd25eec561ebe29b9d3314b1cae9 (patch)
tree45e711d91fb1e7489f8ef97d34ed3910783e984a /Source/Core
parent762ce28977725bedb87af3e2ced49aa3563b541a (diff)
Linux build fix.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5725 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/Thread.cpp15
-rw-r--r--Source/Core/Common/Src/Thread.h3
-rw-r--r--Source/Core/VideoCommon/Src/CommandProcessor.cpp35
3 files changed, 24 insertions, 29 deletions
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp
index 8ac22356d9..1f04ad1ef6 100644
--- a/Source/Core/Common/Src/Thread.cpp
+++ b/Source/Core/Common/Src/Thread.cpp
@@ -247,13 +247,18 @@ namespace Common
}
}
}
-
+
// Supporting functions
void SleepCurrentThread(int ms)
{
Sleep(ms);
}
+ void SwitchCurrentThread()
+ {
+ SwitchToThread();
+ }
+
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // must be 0x1000
@@ -417,13 +422,17 @@ namespace Common
thread_init_done++;
}
-
+
void SleepCurrentThread(int ms)
{
usleep(1000 * ms);
}
-
+ void SwitchCurrentThread()
+ {
+ usleep(1000 * 1);
+ }
+
void SetCurrentThreadName(const TCHAR* szThreadName)
{
char *name = strdup(szThreadName);
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h
index 584fd88613..7c934f86f6 100644
--- a/Source/Core/Common/Src/Thread.h
+++ b/Source/Core/Common/Src/Thread.h
@@ -205,7 +205,8 @@ namespace Common
void InitThreading();
void SleepCurrentThread(int ms);
-
+ void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
+
// YieldCPU: This function is only effective on HyperThreading CPU
// Use this function during a spin-wait to make the current thread
// relax while another thread is working. This may be more efficient
diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp
index 1b1e7e4d4e..c59f9b7b40 100644
--- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp
+++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp
@@ -596,36 +596,21 @@ void STACKALIGN GatherPipeBursted()
if (g_VideoInitialize.bOnThread)
{
- // The interrupt latency in Dolphin is much longer than Hardware, so we must be more vigilant on Watermark
- if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= HiWatermark_Tighter)
- {
- m_CPStatusReg.OverflowHiWatermark = true;
- if (m_CPCtrlReg.FifoOverflowIntEnable)
- UpdateInterrupts();
- }
- // A little trick to prevent FIFO from overflown in dual core mode
- // Unfortunately we cannot do the same for single core
- int cnt = 0;
- while (fifo.CPReadWriteDistance > fifo.CPEnd - fifo.CPBase)
- {
- // Avoid deadlock
- if (cnt >= 100)
- break;
- cnt++;
- SwitchToThread();
- }
+ // A little trick to prevent FIFO from overflown in dual core mode (n < 100 to avoid dead lock)
+ for (int cnt = 0; fifo.CPReadWriteDistance > fifo.CPEnd - fifo.CPBase && cnt < 100; cnt++)
+ Common::SwitchCurrentThread();
}
else
{
CatchUpGPU();
+ }
- // The interrupt latency in Dolphin is much longer than Hardware, so we must be more vigilant on Watermark
- if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= HiWatermark_Tighter)
- {
- m_CPStatusReg.OverflowHiWatermark = true;
- if (m_CPCtrlReg.FifoOverflowIntEnable)
- UpdateInterrupts();
- }
+ // The interrupt latency in Dolphin is much longer than Hardware, so we must be more vigilant on Watermark
+ if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= HiWatermark_Tighter)
+ {
+ m_CPStatusReg.OverflowHiWatermark = true;
+ if (m_CPCtrlReg.FifoOverflowIntEnable)
+ UpdateInterrupts();
}
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,