mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Merge branch 'FIFO-BP'
# By skidau (30) and Pierre Bourdon (1) * FIFO-BP: (31 commits) Set g_bSignalTokenInterrupt on the main thread. Fixes the random hang in Harry Potter: Prisoner of Azkaban. Used a scheduled event to generate the ARAM DMA interrupt if the DMA is greater than a certain size. Fixes NFS:HP2 GC. Bumped up the disc transfer speed enough to prevent audio stuttering in Gauntlet: Dark Legacy. Enabled Synchronise GPU on "SPEED CHALLENGE - Jacques Villeneuve's Racing Vision". Required to go in-game. Added direct GameCube controller commands to the Serial Interface emulation. Fixes the controls in MaxPlay Classic Games Volume 1 and the Action Replay disc. Increased the FIFO buffer size to 2MB from 1MB. Fixes Killer 7's Angel boss. Used an immediate GenerateDSPInterrupt when transferring data from ARAM to MRAM and a scheduled DSP interrupt when transferring data from MRAM to ARAM. Fixes the audio cutting in and out in the Resident Evil GC games using DSP HLE. Triggered the ARAM interrupt by the scheduler instead of directly in function. Implemented proper timing for the sample counter in the AudioInterface, removing the previous hack. Cleaned up some of the audio streaming code. Skipped the EE check if there is a CP interrupt pending. Disabled "Speed up disc transfer" from the ZTP GC game ini. Removed the disc seek times for GC games and removed the disc speed option on Wii games. Checked for external exceptions only in mtmsr. Delayed the interrupts in the EXI Channel. Merge aram-dma-fixes (r76a13604ef49b522281af75675f044d59a74e871) Added a patch that bypasses the FIFO reset code in Wallace and Gromit: Project Zoo, allowing it to go in-game. Made vertex loading take constant time. Increased the cycle time of the vertex command. Fixes "Speed Challenge: Jacques Villeneuve's Racing Vision". Moved the setting of the Finish interrupt signal back to the main thread as it was causing Wii games like Resident Evil 4 (Wii) to hang. Profile stores, fp stores and ps stores only to the fifo write addresses list. This should make the JIT a little faster as it will not be checking for external exceptions unnecessarily. ... Conflicts: Source/Core/VideoCommon/Src/PixelEngine.cpp
This commit is contained in:
@ -33,7 +33,6 @@
|
||||
#include "HW/ProcessorInterface.h"
|
||||
#include "DLCache.h"
|
||||
#include "State.h"
|
||||
#include "PerfQueryBase.h"
|
||||
|
||||
namespace PixelEngine
|
||||
{
|
||||
@ -113,14 +112,14 @@ static UPEAlphaReadReg m_AlphaRead;
|
||||
static UPECtrlReg m_Control;
|
||||
//static u16 m_Token; // token value most recently encountered
|
||||
|
||||
static bool g_bSignalTokenInterrupt;
|
||||
static bool g_bSignalFinishInterrupt;
|
||||
volatile u32 g_bSignalTokenInterrupt;
|
||||
volatile u32 g_bSignalFinishInterrupt;
|
||||
|
||||
static int et_SetTokenOnMainThread;
|
||||
static int et_SetFinishOnMainThread;
|
||||
|
||||
volatile bool interruptSetToken = false;
|
||||
volatile bool interruptSetFinish = false;
|
||||
volatile u32 interruptSetToken = 0;
|
||||
volatile u32 interruptSetFinish = 0;
|
||||
|
||||
u16 bbox[4];
|
||||
bool bbox_active;
|
||||
@ -164,10 +163,10 @@ void Init()
|
||||
m_AlphaModeConf.Hex = 0;
|
||||
m_AlphaRead.Hex = 0;
|
||||
|
||||
g_bSignalTokenInterrupt = false;
|
||||
g_bSignalFinishInterrupt = false;
|
||||
interruptSetToken = false;
|
||||
interruptSetFinish = false;
|
||||
g_bSignalTokenInterrupt = 0;
|
||||
g_bSignalFinishInterrupt = 0;
|
||||
interruptSetToken = 0;
|
||||
interruptSetFinish = 0;
|
||||
|
||||
et_SetTokenOnMainThread = CoreTiming::RegisterEvent("SetToken", SetToken_OnMainThread);
|
||||
et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread);
|
||||
@ -214,7 +213,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
|
||||
break;
|
||||
|
||||
case PE_TOKEN_REG:
|
||||
_uReturnValue = CommandProcessor::fifo.PEToken;
|
||||
_uReturnValue = Common::AtomicLoad(*(volatile u32*)&CommandProcessor::fifo.PEToken);
|
||||
INFO_LOG(PIXELENGINE, "(r16) TOKEN_REG : %04x", _uReturnValue);
|
||||
break;
|
||||
|
||||
@ -351,8 +350,8 @@ void Write16(const u16 _iValue, const u32 _iAddress)
|
||||
{
|
||||
UPECtrlReg tmpCtrl(_iValue);
|
||||
|
||||
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
|
||||
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
|
||||
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = 0;
|
||||
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = 0;
|
||||
|
||||
m_Control.PETokenEnable = tmpCtrl.PETokenEnable;
|
||||
m_Control.PEFinishEnable = tmpCtrl.PEFinishEnable;
|
||||
@ -398,14 +397,14 @@ void UpdateInterrupts()
|
||||
|
||||
void UpdateTokenInterrupt(bool active)
|
||||
{
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, active);
|
||||
interruptSetToken = active;
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, active);
|
||||
Common::AtomicStore(interruptSetToken, active ? 1 : 0);
|
||||
}
|
||||
|
||||
void UpdateFinishInterrupt(bool active)
|
||||
{
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, active);
|
||||
interruptSetFinish = active;
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, active);
|
||||
Common::AtomicStore(interruptSetFinish, active ? 1 : 0);
|
||||
}
|
||||
|
||||
// TODO(mb2): Refactor SetTokenINT_OnMainThread(u64 userdata, int cyclesLate).
|
||||
@ -415,20 +414,23 @@ void UpdateFinishInterrupt(bool active)
|
||||
// Called only if BPMEM_PE_TOKEN_INT_ID is ack by GP
|
||||
void SetToken_OnMainThread(u64 userdata, int cyclesLate)
|
||||
{
|
||||
//if (userdata >> 16)
|
||||
//{
|
||||
g_bSignalTokenInterrupt = true;
|
||||
//_dbg_assert_msg_(PIXELENGINE, (CommandProcessor::fifo.PEToken == (userdata&0xFFFF)), "WTF? BPMEM_PE_TOKEN_INT_ID's token != BPMEM_PE_TOKEN_ID's token" );
|
||||
INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", CommandProcessor::fifo.PEToken);
|
||||
// XXX: No 16-bit atomic store available, so cheat and use 32-bit.
|
||||
// That's what we've always done. We're counting on fifo.PEToken to be
|
||||
// 4-byte padded.
|
||||
Common::AtomicStore(*(volatile u32*)&CommandProcessor::fifo.PEToken, userdata & 0xffff);
|
||||
INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", CommandProcessor::fifo.PEToken);
|
||||
if (userdata >> 16)
|
||||
{
|
||||
Common::AtomicStore(*(volatile u32*)&g_bSignalTokenInterrupt, 1);
|
||||
UpdateInterrupts();
|
||||
CommandProcessor::interruptTokenWaiting = false;
|
||||
IncrementCheckContextId();
|
||||
//}
|
||||
}
|
||||
CommandProcessor::interruptTokenWaiting = false;
|
||||
IncrementCheckContextId();
|
||||
}
|
||||
|
||||
void SetFinish_OnMainThread(u64 userdata, int cyclesLate)
|
||||
{
|
||||
g_bSignalFinishInterrupt = 1;
|
||||
Common::AtomicStore(*(volatile u32*)&g_bSignalFinishInterrupt, 1);
|
||||
UpdateInterrupts();
|
||||
CommandProcessor::interruptFinishWaiting = false;
|
||||
CommandProcessor::isPossibleWaitingSetDrawDone = false;
|
||||
@ -438,23 +440,13 @@ void SetFinish_OnMainThread(u64 userdata, int cyclesLate)
|
||||
// THIS IS EXECUTED FROM VIDEO THREAD
|
||||
void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
|
||||
{
|
||||
// TODO?: set-token-value and set-token-INT could be merged since set-token-INT own the token value.
|
||||
if (_bSetTokenAcknowledge) // set token INT
|
||||
{
|
||||
Common::AtomicStore(*(volatile u32*)&g_bSignalTokenInterrupt, 1);
|
||||
}
|
||||
|
||||
Common::AtomicStore(*(volatile u32*)&CommandProcessor::fifo.PEToken, _token);
|
||||
CommandProcessor::interruptTokenWaiting = true;
|
||||
CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16));
|
||||
}
|
||||
else // set token value
|
||||
{
|
||||
// we do it directly from videoThread because of
|
||||
// Super Monkey Ball
|
||||
// XXX: No 16-bit atomic store available, so cheat and use 32-bit.
|
||||
// That's what we've always done. We're counting on fifo.PEToken to be
|
||||
// 4-byte padded.
|
||||
Common::AtomicStore(*(volatile u32*)&CommandProcessor::fifo.PEToken, _token);
|
||||
}
|
||||
CommandProcessor::interruptTokenWaiting = true;
|
||||
CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16));
|
||||
IncrementCheckContextId();
|
||||
}
|
||||
|
||||
@ -477,7 +469,6 @@ void ResetSetFinish()
|
||||
{
|
||||
UpdateFinishInterrupt(false);
|
||||
g_bSignalFinishInterrupt = false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -491,8 +482,7 @@ void ResetSetToken()
|
||||
if (g_bSignalTokenInterrupt)
|
||||
{
|
||||
UpdateTokenInterrupt(false);
|
||||
g_bSignalTokenInterrupt = false;
|
||||
|
||||
g_bSignalTokenInterrupt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -500,17 +490,4 @@ void ResetSetToken()
|
||||
}
|
||||
CommandProcessor::interruptTokenWaiting = false;
|
||||
}
|
||||
|
||||
bool WaitingForPEInterrupt()
|
||||
{
|
||||
return !CommandProcessor::waitingForPEInterruptDisable && (CommandProcessor::interruptFinishWaiting || CommandProcessor::interruptTokenWaiting || interruptSetFinish || interruptSetToken);
|
||||
}
|
||||
|
||||
void ResumeWaitingForPEInterrupt()
|
||||
{
|
||||
interruptSetFinish = false;
|
||||
interruptSetToken = false;
|
||||
CommandProcessor::interruptFinishWaiting = false;
|
||||
CommandProcessor::interruptTokenWaiting = false;
|
||||
}
|
||||
} // end of namespace PixelEngine
|
||||
|
Reference in New Issue
Block a user