From 378d3aaa52cc383600c3273433cebd9987dbe76c Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sun, 18 Jul 2010 15:47:28 +0000 Subject: [PATCH] Make FIFO watermark tightness configurable instead of hardcoding it. To change it, right click the affected game in the iso list, select Properties, and enter some constant for "Watermark tightness". Reasonable values range from 20 to 200. FIFO seems unoverflowable on my computer no matter what I set this value to, so test whether tuning the value helps you ;P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5907 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/ConfigManager.h | 2 ++ Source/Core/DolphinWX/Src/ISOProperties.cpp | 28 +++++++++++++++++-- Source/Core/DolphinWX/Src/ISOProperties.h | 4 +++ .../Core/VideoCommon/Src/CommandProcessor.cpp | 4 +-- Source/Core/VideoCommon/Src/VideoConfig.cpp | 3 ++ Source/Core/VideoCommon/Src/VideoConfig.h | 1 + 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index 6a1839b07bc..aa0fb090821 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -71,6 +71,8 @@ struct SConfig // framelimit choose int m_Framelimit; bool b_UseFPS; + // FIFO watermark tightness + int m_WatermarkTightness; // other interface settings bool m_InterfaceToolbar; bool m_InterfaceStatusbar; diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index dda9ec23895..1b38ebaef0e 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -321,6 +321,10 @@ void CISOProperties::CreateGUIControls(bool IsWad) arrayStringFor_Hack.Add(_("Skies of Arcadia")); Hack = new wxChoice(m_GameConfig, ID_HACK, wxDefaultPosition, wxDefaultSize, arrayStringFor_Hack, 0, wxDefaultValidator); + WMTightnessText = new wxStaticText(m_GameConfig, ID_WMTIGHTNESS_TEXT, wxT("Watermark tightness: "), wxDefaultPosition, wxDefaultSize); + WMTightness = new wxTextCtrl(m_GameConfig, ID_WMTIGHTNESS, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)); + WMTightness->SetToolTip(wxT("Change this if you get lots of FIFO overflow errors. Reasonable values range from 0 to 200.")); + // Emulation State sEmuState = new wxBoxSizer(wxHORIZONTAL); EmuStateText = new wxStaticText(m_GameConfig, ID_EMUSTATE_TEXT, _("Emulation State: "), wxDefaultPosition, wxDefaultSize); @@ -348,8 +352,14 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbVideoOverrides->Add(DstAlphaPass, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(UseXFB, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(BPHack, 0, wxEXPAND|wxLEFT, 5); - sbVideoOverrides->Add(Hacktext, 0, wxEXPAND|wxLEFT, 5); - sbVideoOverrides->Add(Hack, 0, wxEXPAND|wxLEFT, 5); + + wxFlexGridSizer* fifosizer = new wxFlexGridSizer(2, 2, 0, 0); + fifosizer->Add(Hacktext, 0, wxLEFT, 5); + fifosizer->Add(Hack, 0, wxEXPAND|wxLEFT, 5); + fifosizer->Add(WMTightnessText, 0, wxLEFT, 5); + fifosizer->Add(WMTightness, 0, wxEXPAND|wxLEFT, 5); + sbVideoOverrides->Add(fifosizer); + sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND); sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND); sbGameConfig->Add(sbVideoOverrides, 0, wxEXPAND); @@ -846,6 +856,11 @@ void CISOProperties::LoadGameConfig() else BPHack->Set3StateValue(wxCHK_UNDETERMINED); + if (GameIni.Get("Video", "FIFOWatermarkTightness", &sTemp)) + WMTightness->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); + else + WMTightness->SetValue(wxT("50")); + GameIni.Get("Video", "ProjectionHack", &iTemp, -1); Hack->SetSelection(iTemp); @@ -931,6 +946,15 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("Video", "ProjectionHack", Hack->GetSelection()); + if (WMTightness->GetValue().size() == 0) + GameIni.DeleteKey("Video", "FIFOWatermarkTightness"); + else + { + long val; + WMTightness->GetValue().ToLong(&val); + GameIni.Set("Video", "FIFOWatermarkTightness", (int)val); + } + if (EmuState->GetSelection() == -1) GameIni.DeleteKey("EmuState", "EmulationStateId"); else diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 3ea5973dbe1..ca8680905cd 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -93,6 +93,8 @@ class CISOProperties : public wxDialog wxStaticText *Hacktext; wxArrayString arrayStringFor_Hack; wxChoice *Hack; + wxStaticText *WMTightnessText; + wxTextCtrl *WMTightness; wxButton *EditConfig; wxStaticText *EmuStateText; @@ -169,6 +171,8 @@ class CISOProperties : public wxDialog ID_USEXFB, ID_HACK_TEXT, ID_HACK, + ID_WMTIGHTNESS_TEXT, + ID_WMTIGHTNESS, ID_ENABLEPROGRESSIVESCAN, ID_ENABLEWIDESCREEN, ID_EDITCONFIG, diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index 82e599432b5..39da6aeb6f2 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -495,7 +495,7 @@ void Write16(const u16 _Value, const u32 _Address) case FIFO_HI_WATERMARK_HI: WriteHigh((u32 &)fifo.CPHiWatermark, _Value); // Tune this when you see lots of FIFO overflown by GatherPipe - HiWatermark_Tighter = fifo.CPHiWatermark - 32 * 20; + HiWatermark_Tighter = fifo.CPHiWatermark - 32 * g_ActiveConfig.iFIFOWatermarkTightness; DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_HI_WATERMARK_HI : %04x", _Value); break; @@ -616,7 +616,7 @@ void STACKALIGN GatherPipeBursted() } _assert_msg_(COMMANDPROCESSOR, fifo.CPReadWriteDistance <= fifo.CPEnd - fifo.CPBase, - "FIFO is overflown by GatherPipe !\nCPU thread is too fast, lower the HiWatermark may help."); + "FIFO is overflown by GatherPipe !\nCPU thread is too fast, try changing the watermark tightness in the game properties."); // check if we are in sync _assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == *(g_VideoInitialize.Fifo_CPUWritePointer), "FIFOs linked but out of sync"); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 6df9bdd7565..93b05483047 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -95,6 +95,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); iniFile.Get("Hacks", "FIFOBPHack", &bFIFOBPhack, false); + iniFile.Get("Hacks", "FIFOWatermarkTightness", &iFIFOWatermarkTightness, 50); iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); @@ -145,6 +146,8 @@ void VideoConfig::GameIniLoad(const char *ini_file) iniFile.Get("Video", "UseRealXFB", &bUseRealXFB); if (iniFile.Exists("Video", "FIFOBPHack")) iniFile.Get("Video", "FIFOBPHack", &bFIFOBPhack); + if (iniFile.Exists("Video", "FIFOWatermarkTightness")) + iniFile.Get("Video", "FIFOWatermarkTightness", &iFIFOWatermarkTightness); if (iniFile.Exists("Video", "ProjectionHack")) iniFile.Get("Video", "ProjectionHack", &iPhackvalue); if (iniFile.Exists("Video", "UseNativeMips")) diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 1184d2a6b48..2ace261fe64 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -120,6 +120,7 @@ struct VideoConfig bool bSafeTextureCache; int iSafeTextureCache_ColorSamples; bool bFIFOBPhack; + int iFIFOWatermarkTightness; int iPhackvalue; bool bPhackvalue1, bPhackvalue2; float fhackvalue1, fhackvalue2;