From b0ef8117869aa1c96d8957c0235c6350fe912407 Mon Sep 17 00:00:00 2001 From: ayuanx Date: Thu, 17 Dec 2009 04:01:34 +0000 Subject: [PATCH] Disabled thread synchronization check so the speed should be back, and theoretically should be even faster than r4698. Hope it is safe to do so. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4701 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/CommandProcessor.cpp | 8 ++++---- Source/Core/VideoCommon/Src/Fifo.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index cce4f62a8f..7c0864d692 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -484,9 +484,11 @@ void Write16(const u16 _Value, const u32 _Address) // TODO(mb2): better. Check if it help: avoid CPReadPointer overwrites when stupidly done like in Super Monkey Ball if ((!fifo.bFF_GPReadEnable && fifo.CPReadIdle) || !g_VideoInitialize.bOnThread) // TOCHECK(mb2): check again if thread safe? { - if (g_VideoInitialize.bOnThread) FifoCriticalEnter(); // This may not be necessary, just for safety +// Disabling this thread synchronization check does boost the speed +// Hope it is safe to skip this check +// if (g_VideoInitialize.bOnThread) FifoCriticalEnter(); // This may not be necessary, just for safety UpdateFifoRegister(); - if (g_VideoInitialize.bOnThread) FifoCriticalLeave(); +// if (g_VideoInitialize.bOnThread) FifoCriticalLeave(); } } @@ -536,9 +538,7 @@ void STACKALIGN GatherPipeBursted() else fifo.CPWritePointer += GATHER_PIPE_SIZE; - FifoCriticalEnter(); // This may not be necessary, just for safety Common::AtomicAdd(fifo.CPReadWriteDistance, GATHER_PIPE_SIZE); - FifoCriticalLeave(); // High watermark overflow handling (hacked way) if (fifo.CPReadWriteDistance > fifo.CPHiWatermark) diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 717d8602d5..8c129ff87d 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -137,8 +137,6 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) VideoFifo_CheckEFBAccess(); VideoFifo_CheckSwapRequest(); - CommandProcessor::FifoCriticalEnter(); - // check if we are able to run this buffer if (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance && !_fifo.bFF_Breakpoint) { @@ -153,6 +151,8 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) u32 readPtr = _fifo.CPReadPointer; u8 *uData = video_initialize.pGetMemoryPointer(readPtr); + CommandProcessor::FifoCriticalEnter(); + // It looks like even in BP mode, we still can send all the chunks we have /* // if we are on BP mode we must send 32B chunks to Video plugin for BP checking @@ -194,6 +194,9 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) Common::AtomicStore(_fifo.CPReadPointer, readPtr); Common::AtomicAdd(_fifo.CPReadWriteDistance, -distToSend); + + CommandProcessor::FifoCriticalLeave(); + /* video_initialize.pPeekMessages(); if (g_ActiveConfig.bEFBAccessEnable) @@ -208,8 +211,6 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) { Common::YieldCPU(); } - - CommandProcessor::FifoCriticalLeave(); } fifo_exit_event.Set(); }