mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-17 03:15:39 +00:00
System: Frame pacing improvements
This commit is contained in:
parent
cbb9b96537
commit
40d6be7142
|
@ -36,7 +36,6 @@ bool GPU::Initialize(HostDisplay* host_display, System* system, DMA* dma, Interr
|
||||||
void GPU::UpdateSettings()
|
void GPU::UpdateSettings()
|
||||||
{
|
{
|
||||||
m_force_progressive_scan = m_system->GetSettings().display_force_progressive_scan;
|
m_force_progressive_scan = m_system->GetSettings().display_force_progressive_scan;
|
||||||
UpdateCRTCConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::Reset()
|
void GPU::Reset()
|
||||||
|
@ -336,7 +335,6 @@ void GPU::UpdateCRTCConfig()
|
||||||
const float vertical_frequency =
|
const float vertical_frequency =
|
||||||
static_cast<float>(static_cast<double>((u64(MASTER_CLOCK) * 11) / 7) / static_cast<double>(ticks_per_frame));
|
static_cast<float>(static_cast<double>((u64(MASTER_CLOCK) * 11) / 7) / static_cast<double>(ticks_per_frame));
|
||||||
m_system->SetThrottleFrequency(vertical_frequency);
|
m_system->SetThrottleFrequency(vertical_frequency);
|
||||||
m_tick_event->SetInterval(cs.horizontal_total);
|
|
||||||
|
|
||||||
const u8 horizontal_resolution_index = m_GPUSTAT.horizontal_resolution_1 | (m_GPUSTAT.horizontal_resolution_2 << 2);
|
const u8 horizontal_resolution_index = m_GPUSTAT.horizontal_resolution_1 | (m_GPUSTAT.horizontal_resolution_2 << 2);
|
||||||
cs.dot_clock_divider = dot_clock_dividers[horizontal_resolution_index];
|
cs.dot_clock_divider = dot_clock_dividers[horizontal_resolution_index];
|
||||||
|
@ -431,6 +429,8 @@ void GPU::UpdateCRTCConfig()
|
||||||
Log_DevPrintf("Padding: Left=%u, Top=%u, Right=%u, Bottom=%u", cs.active_display_left, cs.active_display_top,
|
Log_DevPrintf("Padding: Left=%u, Top=%u, Right=%u, Bottom=%u", cs.active_display_left, cs.active_display_top,
|
||||||
cs.visible_display_width - cs.active_display_width - cs.active_display_left,
|
cs.visible_display_width - cs.active_display_width - cs.active_display_left,
|
||||||
cs.visible_display_height - cs.active_display_height - cs.active_display_top);
|
cs.visible_display_height - cs.active_display_height - cs.active_display_top);
|
||||||
|
|
||||||
|
UpdateSliceTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
static TickCount GPUTicksToSystemTicks(TickCount gpu_ticks)
|
static TickCount GPUTicksToSystemTicks(TickCount gpu_ticks)
|
||||||
|
@ -563,14 +563,9 @@ void GPU::Execute(TickCount ticks)
|
||||||
|
|
||||||
// switch fields for interlaced modes
|
// switch fields for interlaced modes
|
||||||
if (m_GPUSTAT.vertical_interlace)
|
if (m_GPUSTAT.vertical_interlace)
|
||||||
{
|
|
||||||
m_GPUSTAT.interlaced_field ^= true;
|
m_GPUSTAT.interlaced_field ^= true;
|
||||||
m_crtc_state.current_scanline = BoolToUInt32(!m_GPUSTAT.interlaced_field);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_GPUSTAT.interlaced_field = false;
|
m_GPUSTAT.interlaced_field = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,8 +661,8 @@ void GPU::WriteGP1(u32 value)
|
||||||
{
|
{
|
||||||
const bool disable = ConvertToBoolUnchecked(value & 0x01);
|
const bool disable = ConvertToBoolUnchecked(value & 0x01);
|
||||||
Log_DebugPrintf("Display %s", disable ? "disabled" : "enabled");
|
Log_DebugPrintf("Display %s", disable ? "disabled" : "enabled");
|
||||||
|
m_tick_event->InvokeEarly();
|
||||||
m_GPUSTAT.display_disable = disable;
|
m_GPUSTAT.display_disable = disable;
|
||||||
UpdateCRTCConfig();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
#include "cdrom.h"
|
#include "cdrom.h"
|
||||||
|
#include "common/audio_stream.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/state_wrapper.h"
|
#include "common/state_wrapper.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
@ -457,8 +458,6 @@ void System::UpdateThrottlePeriod()
|
||||||
{
|
{
|
||||||
m_throttle_period = static_cast<s32>(1000000000.0 / static_cast<double>(m_throttle_frequency) /
|
m_throttle_period = static_cast<s32>(1000000000.0 / static_cast<double>(m_throttle_frequency) /
|
||||||
static_cast<double>(GetSettings().emulation_speed));
|
static_cast<double>(GetSettings().emulation_speed));
|
||||||
m_last_throttle_time = 0;
|
|
||||||
m_throttle_timer.Reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::Throttle()
|
void System::Throttle()
|
||||||
|
@ -486,6 +485,7 @@ void System::Throttle()
|
||||||
#endif
|
#endif
|
||||||
m_last_throttle_time = 0;
|
m_last_throttle_time = 0;
|
||||||
m_throttle_timer.Reset();
|
m_throttle_timer.Reset();
|
||||||
|
m_host_interface->GetAudioStream()->EmptyBuffers();
|
||||||
}
|
}
|
||||||
else if (sleep_time >= MINIMUM_SLEEP_TIME && sleep_time <= m_throttle_period)
|
else if (sleep_time >= MINIMUM_SLEEP_TIME && sleep_time <= m_throttle_period)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue