summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorXTra.KrazzY <XTra.KrazzY@gmail.com>2009-07-03 10:00:09 +0000
committerXTra.KrazzY <XTra.KrazzY@gmail.com>2009-07-03 10:00:09 +0000
commit3ddbb094ab9808a6a175759fe33d4f147ce851ab (patch)
treeaa6e9b4fc4ab15ab2b2b408c30cf14ecd8f1694c /Source
parent7e8a2fc1360bf8e3c9c07e9ef233826086652b25 (diff)
1. Savestates should now be super-stable (but you have to save AND load)
2. AccessEFB will probably not hang (tell me if it does) 3. Stopping should be a little bit faster git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3658 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/Src/Fifo.cpp10
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/main.cpp10
2 files changed, 18 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp
index c8d8d79b83..efac84ae99 100644
--- a/Source/Core/VideoCommon/Src/Fifo.cpp
+++ b/Source/Core/VideoCommon/Src/Fifo.cpp
@@ -39,6 +39,7 @@ namespace {
static volatile bool fifoStateRun = false;
static u8 *videoBuffer;
static Common::Event fifo_exit_event;
+static Common::CriticalSection s_criticalFifo;
// STATE_TO_SAVE
static int size = 0;
@@ -46,11 +47,15 @@ static int size = 0;
void Fifo_DoState(PointerWrap &p)
{
+ s_criticalFifo.Enter();
+
p.DoArray(videoBuffer, FIFO_SIZE);
p.Do(size);
int pos = (int)(g_pVideoData - videoBuffer); // get offset
p.Do(pos); // read or write offset (depends on the mode afaik)
g_pVideoData = &videoBuffer[pos]; // overwrite g_pVideoData -> expected no change when load ss and change when save ss
+
+ s_criticalFifo.Leave();
}
void Fifo_Init()
@@ -153,6 +158,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
Video_UpdateXFB(NULL, 0, 0, 0, FALSE);
}
+ s_criticalFifo.Enter();
// check if we are able to run this buffer
if ((_fifo.bFF_GPReadEnable) && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint))
{
@@ -161,6 +167,9 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
int peek_counter = 0;
while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance)
{
+ if(!fifoStateRun)
+ break;
+
peek_counter++;
if (peek_counter == 1000) {
video_initialize.pPeekMessages();
@@ -218,6 +227,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
//video_initialize.pLog("..........................IDLE",FALSE);
Common::SyncInterlockedExchange((LONG*)&_fifo.CPReadIdle, 1);
}
+ s_criticalFifo.Leave();
}
fifo_exit_event.Set();
#ifdef SETUP_TIMER_WAITING
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index e2f2ebd206..1aaf7efdda 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -102,7 +102,7 @@ static bool s_PluginInitialized = false;
static volatile u32 s_AccessEFBResult = 0, s_EFBx, s_EFBy;
static volatile EFBAccessType s_AccessEFBType;
static Common::Event s_AccessEFBDone;
-static Common::CriticalSection s_criticalEFB;
+static Common::CriticalSection s_criticalEFB, s_criticalAccess;
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
@@ -513,6 +513,7 @@ void Video_OnThreadAccessEFB()
break;
case POKE_COLOR:
+ //WARN_LOG(VIDEOINTERFACE, "This is probably some kind of software rendering");
break;
default:
@@ -528,6 +529,8 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
{
u32 result;
+ s_criticalAccess.Enter();
+
s_criticalEFB.Enter();
s_AccessEFBType = type;
@@ -536,8 +539,8 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
if (g_VideoInitialize.bUseDualCore)
{
- g_EFBAccessRequested = true;
s_AccessEFBDone.Init();
+ g_EFBAccessRequested = true;
}
s_criticalEFB.Leave();
@@ -548,12 +551,15 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
Video_OnThreadAccessEFB();
s_criticalEFB.Enter();
+
if (g_VideoInitialize.bUseDualCore)
s_AccessEFBDone.Shutdown();
result = s_AccessEFBResult;
s_criticalEFB.Leave();
+ s_criticalAccess.Leave();
+
return result;
}