mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Experimental commit and one fix for my last commit.
I think that isFifoBusy bring better sync with VI (video interface) because the CPU emulated threads are waiting for DrawDone in BP Register. So, I do some modifications. 1) Rename "IsFifoBusy" by "isPossibleWaitingSetDrawDone" 2) Only activate isPossibleWaitingSetDrawDone when bFF_GPLinkEnable is true in fifo loop "Inmediate mode" that is because in theory this drawsync function is using in this mode. 3) Deactivate isPossibleWaitingSetDrawDone also in SetFinish in PixelEngine, beside when 32 block is finish. Please regression in yours games thats can bring some FPS more above all with VPS frame limiter ON (Auto, 60, 50, etc). - Fix waiting in AbortFrame(), please test mp1/mp2 is fixed again. Good look! git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7123 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -111,7 +111,7 @@ static Common::CriticalSection sFifoCritical;
|
||||
static bool bProcessFifoToLoWatermark = false;
|
||||
static bool bProcessFifoAllDistance = false;
|
||||
|
||||
volatile bool isFifoBusy = false; //This state is changed when the FIFO is processing data.
|
||||
volatile bool isPossibleWaitingSetDrawDone = false; //This state is changed when the FIFO is processing data.
|
||||
volatile bool interruptSet= false;
|
||||
volatile bool interruptWaiting= false;
|
||||
volatile bool interruptTokenWaiting = false;
|
||||
@ -153,7 +153,7 @@ void DoState(PointerWrap &p)
|
||||
p.Do(bProcessFifoToLoWatermark);
|
||||
p.Do(bProcessFifoAllDistance);
|
||||
|
||||
p.Do(isFifoBusy);
|
||||
p.Do(isPossibleWaitingSetDrawDone);
|
||||
p.Do(interruptSet);
|
||||
p.Do(interruptWaiting);
|
||||
p.Do(interruptTokenWaiting);
|
||||
@ -477,6 +477,7 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
fifo.bFF_GPReadEnable = tmpCtrl.GPReadEnable;
|
||||
fifo.bFF_HiWatermarkInt = tmpCtrl.FifoOverflowIntEnable;
|
||||
fifo.bFF_LoWatermarkInt = tmpCtrl.FifoUnderflowIntEnable;
|
||||
fifo.bFF_GPLinkEnable = tmpCtrl.GPLinkEnable;
|
||||
|
||||
if(tmpCtrl.GPReadEnable && tmpCtrl.GPLinkEnable)
|
||||
{
|
||||
@ -816,7 +817,7 @@ void SetFifoIdleFromVideoPlugin()
|
||||
void AbortFrame()
|
||||
{
|
||||
fifo.bFF_GPReadEnable = false;
|
||||
s_fifoIdleEvent.Wait();
|
||||
while(IsFifoProcesingData()) Common::YieldCPU();
|
||||
GPFifo::ResetGatherPipe();
|
||||
ResetVideoBuffer();
|
||||
fifo.CPReadPointer = fifo.CPWritePointer;
|
||||
|
@ -30,7 +30,7 @@ namespace CommandProcessor
|
||||
{
|
||||
|
||||
extern SCPFifoStruct fifo; //This one is shared between gfx thread and emulator thread.
|
||||
extern volatile bool isFifoBusy; //This one is used for sync gfx thread and emulator thread.
|
||||
extern volatile bool isPossibleWaitingSetDrawDone; //This one is used for sync gfx thread and emulator thread.
|
||||
extern volatile bool interruptSet;
|
||||
extern volatile bool interruptWaiting;
|
||||
extern volatile bool interruptTokenWaiting;
|
||||
|
@ -33,6 +33,7 @@ namespace
|
||||
{
|
||||
static volatile bool fifoStateRun = false;
|
||||
static volatile bool EmuRunning = false;
|
||||
static volatile bool isFifoProcesingData = false;
|
||||
static u8 *videoBuffer;
|
||||
// STATE_TO_SAVE
|
||||
static int size = 0;
|
||||
@ -95,6 +96,11 @@ void Fifo_RunLoop(bool run)
|
||||
EmuRunning = run;
|
||||
}
|
||||
|
||||
bool IsFifoProcesingData()
|
||||
{
|
||||
return isFifoProcesingData;
|
||||
}
|
||||
|
||||
// Description: Fifo_EnterLoop() sends data through this function.
|
||||
void Fifo_SendFifoData(u8* _uData, u32 len)
|
||||
{
|
||||
@ -142,9 +148,8 @@ void Fifo_EnterLoop()
|
||||
while (!CommandProcessor::interruptWaiting && _fifo.bFF_GPReadEnable &&
|
||||
_fifo.CPReadWriteDistance && (!AtBreakpoint() || CommandProcessor::OnOverflow))
|
||||
{
|
||||
// while the FIFO is processing data we activate this for sync with emulator thread.
|
||||
|
||||
CommandProcessor::isFifoBusy = true;
|
||||
isFifoProcesingData = true;
|
||||
CommandProcessor::isPossibleWaitingSetDrawDone = _fifo.bFF_GPLinkEnable;
|
||||
|
||||
if (!fifoStateRun) break;
|
||||
|
||||
@ -180,9 +185,10 @@ void Fifo_EnterLoop()
|
||||
// If we don't, s_swapRequested or s_efbAccessRequested won't be set to false
|
||||
// leading the CPU thread to wait in Video_BeginField or Video_AccessEFB thus slowing things down.
|
||||
VideoFifo_CheckAsyncRequest();
|
||||
CommandProcessor::isFifoBusy = false;
|
||||
CommandProcessor::isPossibleWaitingSetDrawDone = false;
|
||||
}
|
||||
|
||||
|
||||
isFifoProcesingData = false;
|
||||
|
||||
CommandProcessor::SetFifoIdleFromVideoPlugin();
|
||||
|
||||
|
@ -41,6 +41,7 @@ bool AtBreakpoint();
|
||||
void Fifo_DoState(PointerWrap &f);
|
||||
void ResetVideoBuffer();
|
||||
void Fifo_SetRendering(bool bEnabled);
|
||||
bool IsFifoProcesingData();
|
||||
|
||||
// Implemented by the Video Plugin
|
||||
void VideoFifo_CheckAsyncRequest();
|
||||
|
@ -240,9 +240,9 @@ void VideoBackendHLE::Video_WaitForFrameFinish()
|
||||
CommandProcessor::WaitForFrameFinish();
|
||||
}
|
||||
|
||||
bool VideoBackendHLE::Video_IsFifoBusy()
|
||||
bool VideoBackendHLE::Video_IsPossibleWaitingSetDrawDone()
|
||||
{
|
||||
return CommandProcessor::isFifoBusy;
|
||||
return CommandProcessor::isPossibleWaitingSetDrawDone;
|
||||
}
|
||||
|
||||
void VideoBackendHLE::Video_AbortFrame()
|
||||
|
@ -356,6 +356,7 @@ void SetFinish_OnMainThread(u64 userdata, int cyclesLate)
|
||||
g_bSignalFinishInterrupt = 1;
|
||||
UpdateInterrupts();
|
||||
CommandProcessor::interruptFinishWaiting = false;
|
||||
CommandProcessor::isPossibleWaitingSetDrawDone = false;
|
||||
}
|
||||
|
||||
// SetToken
|
||||
|
Reference in New Issue
Block a user