Settings: Make DMA performance parameters tweakable

This commit is contained in:
Connor McLaughlin 2020-04-29 20:00:22 +10:00
parent 9d1eb321ec
commit 940b725c1d
6 changed files with 68 additions and 27 deletions

View file

@ -25,6 +25,10 @@ void DMA::Initialize(System* system, Bus* bus, InterruptController* interrupt_co
m_cdrom = cdrom; m_cdrom = cdrom;
m_spu = spu; m_spu = spu;
m_mdec = mdec; m_mdec = mdec;
m_max_slice_ticks = system->GetSettings().dma_max_slice_ticks;
m_halt_ticks = system->GetSettings().dma_halt_ticks;
m_transfer_buffer.resize(32); m_transfer_buffer.resize(32);
m_unhalt_event = system->CreateTimingEvent("DMA Transfer Unhalt", 1, m_max_slice_ticks, m_unhalt_event = system->CreateTimingEvent("DMA Transfer Unhalt", 1, m_max_slice_ticks,
std::bind(&DMA::UnhaltTransfer, this, std::placeholders::_1), false); std::bind(&DMA::UnhaltTransfer, this, std::placeholders::_1), false);

View file

@ -50,6 +50,8 @@ public:
// changing interfaces // changing interfaces
void SetGPU(GPU* gpu) { m_gpu = gpu; } void SetGPU(GPU* gpu) { m_gpu = gpu; }
void SetMaxSliceTicks(TickCount ticks) { m_max_slice_ticks = ticks; }
void SetHaltTicks(TickCount ticks) { m_halt_ticks = ticks; }
private: private:
static constexpr PhysicalMemoryAddress BASE_ADDRESS_MASK = UINT32_C(0x00FFFFFF); static constexpr PhysicalMemoryAddress BASE_ADDRESS_MASK = UINT32_C(0x00FFFFFF);

View file

@ -983,7 +983,7 @@ void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
const GPURenderer old_gpu_renderer = m_settings.gpu_renderer; const GPURenderer old_gpu_renderer = m_settings.gpu_renderer;
const u32 old_gpu_resolution_scale = m_settings.gpu_resolution_scale; const u32 old_gpu_resolution_scale = m_settings.gpu_resolution_scale;
const u32 old_gpu_fifo_size = m_settings.gpu_fifo_size; const u32 old_gpu_fifo_size = m_settings.gpu_fifo_size;
const u32 old_gpu_max_run_ahead = m_settings.gpu_max_run_ahead; const TickCount old_gpu_max_run_ahead = m_settings.gpu_max_run_ahead;
const bool old_gpu_true_color = m_settings.gpu_true_color; const bool old_gpu_true_color = m_settings.gpu_true_color;
const bool old_gpu_scaled_dithering = m_settings.gpu_scaled_dithering; const bool old_gpu_scaled_dithering = m_settings.gpu_scaled_dithering;
const bool old_gpu_texture_filtering = m_settings.gpu_texture_filtering; const bool old_gpu_texture_filtering = m_settings.gpu_texture_filtering;
@ -1058,6 +1058,9 @@ void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
if (m_settings.memory_card_types != old_memory_card_types || m_settings.memory_card_paths != old_memory_card_paths) if (m_settings.memory_card_types != old_memory_card_types || m_settings.memory_card_paths != old_memory_card_paths)
m_system->UpdateMemoryCards(); m_system->UpdateMemoryCards();
m_system->GetDMA()->SetMaxSliceTicks(m_settings.dma_max_slice_ticks);
m_system->GetDMA()->SetHaltTicks(m_settings.dma_halt_ticks);
} }
bool controllers_updated = false; bool controllers_updated = false;

View file

@ -23,8 +23,6 @@ void Settings::Load(SettingsInterface& si)
gpu_renderer = ParseRendererName(si.GetStringValue("GPU", "Renderer", GetRendererName(DEFAULT_GPU_RENDERER)).c_str()) gpu_renderer = ParseRendererName(si.GetStringValue("GPU", "Renderer", GetRendererName(DEFAULT_GPU_RENDERER)).c_str())
.value_or(DEFAULT_GPU_RENDERER); .value_or(DEFAULT_GPU_RENDERER);
gpu_resolution_scale = static_cast<u32>(si.GetIntValue("GPU", "ResolutionScale", 1)); gpu_resolution_scale = static_cast<u32>(si.GetIntValue("GPU", "ResolutionScale", 1));
gpu_fifo_size = static_cast<u32>(si.GetIntValue("GPU", "FIFOSize", 128));
gpu_max_run_ahead = static_cast<u32>(si.GetIntValue("GPU", "MaxRunAhead", 128));
gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false); gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false);
gpu_true_color = si.GetBoolValue("GPU", "TrueColor", true); gpu_true_color = si.GetBoolValue("GPU", "TrueColor", true);
gpu_scaled_dithering = si.GetBoolValue("GPU", "ScaledDithering", false); gpu_scaled_dithering = si.GetBoolValue("GPU", "ScaledDithering", false);
@ -54,6 +52,11 @@ void Settings::Load(SettingsInterface& si)
audio_sync_enabled = si.GetBoolValue("Audio", "Sync", true); audio_sync_enabled = si.GetBoolValue("Audio", "Sync", true);
audio_dump_on_boot = si.GetBoolValue("Audio", "DumpOnBoot", false); audio_dump_on_boot = si.GetBoolValue("Audio", "DumpOnBoot", false);
dma_max_slice_ticks = si.GetIntValue("Hacks", "DMAMaxSliceTicks", 1000);
dma_halt_ticks = si.GetIntValue("Hacks", "DMAHaltTicks", 100);
gpu_fifo_size = static_cast<u32>(si.GetIntValue("Hacks", "GPUFIFOSize", 128));
gpu_max_run_ahead = si.GetIntValue("Hacks", "GPUMaxRunAhead", 128);
bios_path = si.GetStringValue("BIOS", "Path", "bios/scph1001.bin"); bios_path = si.GetStringValue("BIOS", "Path", "bios/scph1001.bin");
bios_patch_tty_enable = si.GetBoolValue("BIOS", "PatchTTYEnable", true); bios_patch_tty_enable = si.GetBoolValue("BIOS", "PatchTTYEnable", true);
bios_patch_fast_boot = si.GetBoolValue("BIOS", "PatchFastBoot", false); bios_patch_fast_boot = si.GetBoolValue("BIOS", "PatchFastBoot", false);

View file

@ -47,8 +47,6 @@ struct Settings
GPURenderer gpu_renderer = GPURenderer::Software; GPURenderer gpu_renderer = GPURenderer::Software;
u32 gpu_resolution_scale = 1; u32 gpu_resolution_scale = 1;
u32 gpu_fifo_size = 128;
u32 gpu_max_run_ahead = 128;
bool gpu_use_debug_device = false; bool gpu_use_debug_device = false;
bool gpu_true_color = true; bool gpu_true_color = true;
bool gpu_scaled_dithering = false; bool gpu_scaled_dithering = false;
@ -71,6 +69,12 @@ struct Settings
bool audio_sync_enabled = true; bool audio_sync_enabled = true;
bool audio_dump_on_boot = true; bool audio_dump_on_boot = true;
// timing hacks section
TickCount dma_max_slice_ticks = 1000;
TickCount dma_halt_ticks = 100;
u32 gpu_fifo_size = 128;
TickCount gpu_max_run_ahead = 128;
struct DebugSettings struct DebugSettings
{ {
bool show_vram = false; bool show_vram = false;

View file

@ -1210,32 +1210,57 @@ void SDLHostInterface::DrawSettingsWindow()
settings_changed |= ImGui::Checkbox("Force NTSC Timings", &m_settings_copy.gpu_force_ntsc_timings); settings_changed |= ImGui::Checkbox("Force NTSC Timings", &m_settings_copy.gpu_force_ntsc_timings);
} }
if (DrawSettingsSectionHeader("Advanced")) ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Advanced"))
{ {
ImGui::Text("These options are tweakable to improve performance/game compatibility.");
ImGui::Text("They will not be automatically saved to the settings INI file.");
ImGui::Text("Use at your own risk, modified values will not be supported.");
ImGui::NewLine();
ImGui::Text("DMA Max Slice Ticks:");
ImGui::SameLine(indent);
int dma_max_slice_ticks = static_cast<int>(m_settings_copy.dma_max_slice_ticks);
if (ImGui::SliderInt("##dma_max_slice_ticks", &dma_max_slice_ticks, 100, 10000))
{
m_settings_copy.dma_max_slice_ticks = dma_max_slice_ticks;
settings_changed = true;
}
ImGui::Text("DMA Halt Ticks:");
ImGui::SameLine(indent);
int dma_halt_ticks = static_cast<int>(m_settings_copy.dma_halt_ticks);
if (ImGui::SliderInt("##dma_halt_ticks", &dma_halt_ticks, 100, 10000))
{
m_settings_copy.dma_halt_ticks = dma_halt_ticks;
settings_changed = true;
}
ImGui::Text("FIFO Size:"); ImGui::Text("FIFO Size:");
ImGui::SameLine(indent); ImGui::SameLine(indent);
int fifo_size = static_cast<int>(m_settings_copy.gpu_fifo_size); int gpu_fifo_size = static_cast<int>(m_settings_copy.gpu_fifo_size);
if (ImGui::SliderInt("##fifo_size", &fifo_size, 16, GPU::MAX_FIFO_SIZE)) if (ImGui::SliderInt("##gpu_fifo_size", &gpu_fifo_size, 16, GPU::MAX_FIFO_SIZE))
{ {
m_settings_copy.gpu_fifo_size = fifo_size; m_settings_copy.gpu_fifo_size = gpu_fifo_size;
settings_changed = true; settings_changed = true;
} }
ImGui::Text("Max Run-Ahead:"); ImGui::Text("Max Run-Ahead:");
ImGui::SameLine(indent); ImGui::SameLine(indent);
int max_run_ahead = static_cast<int>(m_settings_copy.gpu_max_run_ahead); int gpu_max_run_ahead = static_cast<int>(m_settings_copy.gpu_max_run_ahead);
if (ImGui::SliderInt("##max_run_ahead", &max_run_ahead, 0, 1000)) if (ImGui::SliderInt("##gpu_max_run_ahead", &gpu_max_run_ahead, 0, 1000))
{ {
m_settings_copy.gpu_max_run_ahead = max_run_ahead; m_settings_copy.gpu_max_run_ahead = gpu_max_run_ahead;
settings_changed = true; settings_changed = true;
} }
} }
ImGui::EndTabItem();
}
ImGui::EndTabBar(); ImGui::EndTabBar();
} }