mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 07:49:19 +01:00
Linux build fix.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5725 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
762ce28977
commit
221e722284
@ -247,13 +247,18 @@ namespace Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Supporting functions
|
// Supporting functions
|
||||||
void SleepCurrentThread(int ms)
|
void SleepCurrentThread(int ms)
|
||||||
{
|
{
|
||||||
Sleep(ms);
|
Sleep(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SwitchCurrentThread()
|
||||||
|
{
|
||||||
|
SwitchToThread();
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct tagTHREADNAME_INFO
|
typedef struct tagTHREADNAME_INFO
|
||||||
{
|
{
|
||||||
DWORD dwType; // must be 0x1000
|
DWORD dwType; // must be 0x1000
|
||||||
@ -417,13 +422,17 @@ namespace Common
|
|||||||
|
|
||||||
thread_init_done++;
|
thread_init_done++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepCurrentThread(int ms)
|
void SleepCurrentThread(int ms)
|
||||||
{
|
{
|
||||||
usleep(1000 * ms);
|
usleep(1000 * ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SwitchCurrentThread()
|
||||||
|
{
|
||||||
|
usleep(1000 * 1);
|
||||||
|
}
|
||||||
|
|
||||||
void SetCurrentThreadName(const TCHAR* szThreadName)
|
void SetCurrentThreadName(const TCHAR* szThreadName)
|
||||||
{
|
{
|
||||||
char *name = strdup(szThreadName);
|
char *name = strdup(szThreadName);
|
||||||
|
@ -205,7 +205,8 @@ namespace Common
|
|||||||
|
|
||||||
void InitThreading();
|
void InitThreading();
|
||||||
void SleepCurrentThread(int ms);
|
void SleepCurrentThread(int ms);
|
||||||
|
void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
|
||||||
|
|
||||||
// YieldCPU: This function is only effective on HyperThreading CPU
|
// YieldCPU: This function is only effective on HyperThreading CPU
|
||||||
// Use this function during a spin-wait to make the current thread
|
// Use this function during a spin-wait to make the current thread
|
||||||
// relax while another thread is working. This may be more efficient
|
// relax while another thread is working. This may be more efficient
|
||||||
|
@ -596,36 +596,21 @@ void STACKALIGN GatherPipeBursted()
|
|||||||
|
|
||||||
if (g_VideoInitialize.bOnThread)
|
if (g_VideoInitialize.bOnThread)
|
||||||
{
|
{
|
||||||
// The interrupt latency in Dolphin is much longer than Hardware, so we must be more vigilant on Watermark
|
// A little trick to prevent FIFO from overflown in dual core mode (n < 100 to avoid dead lock)
|
||||||
if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= HiWatermark_Tighter)
|
for (int cnt = 0; fifo.CPReadWriteDistance > fifo.CPEnd - fifo.CPBase && cnt < 100; cnt++)
|
||||||
{
|
Common::SwitchCurrentThread();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CatchUpGPU();
|
CatchUpGPU();
|
||||||
|
}
|
||||||
|
|
||||||
// The interrupt latency in Dolphin is much longer than Hardware, so we must be more vigilant on Watermark
|
// 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)
|
if (!m_CPStatusReg.OverflowHiWatermark && fifo.CPReadWriteDistance >= HiWatermark_Tighter)
|
||||||
{
|
{
|
||||||
m_CPStatusReg.OverflowHiWatermark = true;
|
m_CPStatusReg.OverflowHiWatermark = true;
|
||||||
if (m_CPCtrlReg.FifoOverflowIntEnable)
|
if (m_CPCtrlReg.FifoOverflowIntEnable)
|
||||||
UpdateInterrupts();
|
UpdateInterrupts();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
_assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user