DSP LLE Jit, joined work with XK and skidu.

VERY EXPERIMENTAL DON'T EXPECT HIGH PERFORMANCE!.



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5288 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2010-04-07 15:04:45 +00:00
parent 1b96bef8e1
commit 499936561a
22 changed files with 1305 additions and 324 deletions

View File

@ -303,7 +303,8 @@ unsigned short DSP_ReadControlRegister()
void DSP_Update(int cycles)
{
// This is called OFTEN - better not do anything expensive!
CDSPHandler::GetInstance().Update(cycles);
// ~1/6th as many cycles as the period PPC-side.
CDSPHandler::GetInstance().Update(cycles / 6);
}
// The reason that we don't disable this entire

View File

@ -23,6 +23,7 @@ BEGIN_EVENT_TABLE(DSPConfigDialogLLE, wxDialog)
EVT_BUTTON(wxID_OK, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_JIT, DSPConfigDialogLLE::SettingsChanged)
EVT_CHOICE(ID_BACKEND, DSPConfigDialogLLE::BackendChanged)
EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogLLE::VolumeChanged)
END_EVENT_TABLE()
@ -41,6 +42,7 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
// Create items
m_buttonEnableDTKMusic = new wxCheckBox(this, ID_ENABLE_DTK_MUSIC, wxT("Enable DTK Music"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, wxT("Enable Audio Throttle"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonEnableJIT = new wxCheckBox(this, ID_ENABLE_JIT, wxT("Enable JIT Dynarec"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxStaticText *BackendText = new wxStaticText(this, wxID_ANY, wxT("Audio Backend"), wxDefaultPosition, wxDefaultSize, 0);
m_BackendSelection = new wxChoice(this, ID_BACKEND, wxDefaultPosition, wxSize(90, 20), wxArrayBackends, 0, wxDefaultValidator, wxEmptyString);
@ -51,6 +53,7 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
// Update values
m_buttonEnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false);
m_buttonEnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false);
m_buttonEnableJIT->SetValue(ac_Config.m_EnableJIT ? true : false);
// Add tooltips
m_buttonEnableDTKMusic->SetToolTip(wxT("This is used to play music tracks, like BGM."));
@ -58,6 +61,8 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
wxT("Disabling this could cause abnormal game speed, such as too fast.\n")
wxT("But sometimes enabling this could cause constant noise.\n")
wxT("\nKeyboard Shortcut <TAB>: Hold down to instantly disable Throttle."));
m_buttonEnableJIT->SetToolTip(wxT("Enables dynamic recompilation of DSP code.\n")
wxT("Changing this will have no effect while the emulator is running!"));
m_BackendSelection->SetToolTip(wxT("Changing this will have no effect while the emulator is running!"));
m_volumeSlider->SetToolTip(wxT("This setting only affects DSound and OpenAL."));
@ -69,6 +74,7 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
sbSettings->Add(m_buttonEnableDTKMusic, 0, wxALL, 5);
sbSettings->Add(m_buttonEnableThrottle, 0, wxALL, 5);
sbSettings->Add(m_buttonEnableJIT, 0, wxALL, 5);
sBackend->Add(BackendText, 0, wxALIGN_CENTER|wxALL, 5);
sBackend->Add(m_BackendSelection, 0, wxALL, 1);
@ -125,6 +131,7 @@ void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event)
{
ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue();
ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();
ac_Config.m_EnableJIT = m_buttonEnableJIT->GetValue();
#ifdef __APPLE__
strncpy(ac_Config.sBackend, m_BackendSelection->GetStringSelection().mb_str(), 128);

View File

@ -45,6 +45,7 @@ private:
wxButton *m_OK;
wxCheckBox *m_buttonEnableDTKMusic;
wxCheckBox *m_buttonEnableThrottle;
wxCheckBox *m_buttonEnableJIT;
wxArrayString wxArrayBackends;
wxChoice *m_BackendSelection;
@ -52,6 +53,7 @@ private:
{
ID_ENABLE_DTK_MUSIC,
ID_ENABLE_THROTTLE,
ID_ENABLE_JIT,
ID_BACKEND,
ID_VOLUME
};

View File

@ -49,6 +49,7 @@ SoundStream *soundStream = NULL;
bool g_InitMixer = false;
bool bIsRunning = false;
u32 cycle_count = 0;
// Standard crap to make wxWidgets happy
#ifdef _WIN32
@ -218,7 +219,17 @@ THREAD_RETURN dsp_thread(void* lpParameter)
{
while (bIsRunning)
{
DSPInterpreter::Run();
u32 cycles = 0;
if (jit)
{
cycles = cycle_count;
DSPCore_RunCycles(cycles);
}
else
DSPInterpreter::Run();
cycle_count -= cycles;
}
return 0;
}
@ -241,7 +252,7 @@ void Initialize(void *init)
std::string irom_filename = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + DSP_IROM;
std::string coef_filename = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + DSP_COEF;
bCanWork = DSPCore_Init(irom_filename.c_str(), coef_filename.c_str());
bCanWork = DSPCore_Init(irom_filename.c_str(), coef_filename.c_str(), AudioCommon::UseJIT());
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
DSPCore_Reset();
@ -363,6 +374,7 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail)
void DSP_Update(int cycles)
{
int cyclesRatio = cycles / (jit?20:6);
// Sound stream update job has been handled by AudioDMA routine, which is more efficient
/*
// This gets called VERY OFTEN. The soundstream update might be expensive so only do it 200 times per second or something.
@ -385,7 +397,12 @@ void DSP_Update(int cycles)
// If we're not on a thread, run cycles here.
if (!g_dspInitialize.bOnThread)
{
DSPCore_RunCycles(cycles);
// ~1/6th as many cycles as the period PPC-side.
DSPCore_RunCycles(cyclesRatio);;
}
else
{
cycle_count += (cyclesRatio);
}
}