experimental multi-core support on linux

- Input seems not to work for some reason (please check and tell me if it's not only me)
- Skip frames is not supported

Report to me of other problems


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@740 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-10-02 10:43:32 +00:00
parent a1837662a0
commit dc3fd905c9
4 changed files with 26 additions and 4 deletions

View File

@ -157,11 +157,16 @@ void Init()
#ifdef _WIN32
InitializeCriticalSection(&fifo.sync);
#else
fifo.sync = new Common::CriticalSection(0);
#endif
}
void Shutdown()
{
#ifndef _WIN32
delete fifo.sync;
#endif
}
void Read16(u16& _rReturnValue, const u32 _Address)
@ -249,6 +254,8 @@ void Write16(const u16 _Value, const u32 _Address)
}
#ifdef _WIN32
EnterCriticalSection(&fifo.sync);
#else
fifo.sync->Enter();
#endif
}
@ -332,9 +339,11 @@ void Write16(const u16 _Value, const u32 _Address)
// update the registers and run the fifo
// This will recursively enter fifo.sync, TODO(ector): is this good?
UpdateFifoRegister();
#ifdef _WIN32
if (Core::g_CoreStartupParameter.bUseDualCore)
#ifdef _WIN32
LeaveCriticalSection(&fifo.sync);
#else
fifo.sync->Leave();
#endif
fifo.bPauseRead = false; // pauseread is not actually used anywhere! TOOD(ector): huh!
}
@ -369,6 +378,10 @@ void GatherPipeBursted()
Common::SleepCurrentThread(1);
#ifdef _WIN32
InterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, GPFifo::GATHER_PIPE_SIZE);
#else
fifo.sync->Enter();
fifo.CPReadWriteDistance += GPFifo::GATHER_PIPE_SIZE;
fifo.sync->Leave();
#endif
// check if we are in sync

View File

@ -200,12 +200,17 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
u8 *uData = video_initialize.pGetMemoryPointer(_fifo.CPReadPointer);
#ifdef _WIN32
EnterCriticalSection(&_fifo.sync);
#else
_fifo.sync->Enter();
#endif
_fifo.CPReadPointer += 32;
Video_SendFifoData(uData);
#ifdef _WIN32
InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -32);
LeaveCriticalSection(&_fifo.sync);
#else
_fifo.CPReadWriteDistance -= 32;
_fifo.sync->Leave();
#endif
// increase the ReadPtr
if (_fifo.CPReadPointer >= _fifo.CPEnd)

View File

@ -5,10 +5,12 @@
#ifndef _VIDEO_H_INCLUDED__
#define _VIDEO_H_INCLUDED__
#include "Thread.h"
#include "PluginSpecs.h"
#include "ExportProlog.h"
typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenAcknowledge);
typedef void (*TSetPEFinish)(void);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress);
@ -40,6 +42,8 @@ typedef struct
volatile bool bPauseRead;
#ifdef _WIN32
CRITICAL_SECTION sync;
#else
Common::CriticalSection *sync;
#endif
} SCPFifoStruct;

View File

@ -79,7 +79,7 @@ BOOL Callback_PeekMessages()
// TODO: There is no documentation of this function and the calling code
// ignores the return value, so I have no idea what would be the
// proper value to return.
return FALSE;
return TRUE;
#elif defined(_WIN32)
//TODO: peekmessage
MSG msg;
@ -94,7 +94,7 @@ BOOL Callback_PeekMessages()
#else // GLX
// This is called from Outside of our video thread, from EmuThread
// The calls are NOT thread safe, so it breaks everything
return FALSE;
return TRUE;
#endif
}