diff options
author | bunnei <bunneidev@gmail.com> | 2019-07-26 20:26:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-26 20:26:44 +0200 |
commit | 52f54c728d9691f113f0736fab8fbc60b408dceb (patch) | |
tree | e02db0d667f818aacbd27e54927ef91e875eb2c2 /src/core/hle/service/nvflinger/nvflinger.cpp | |
parent | Merge pull request #2739 from lioncash/cflow (diff) | |
parent | NVServices: Correct delayed responses. (diff) | |
download | yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.gz yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.bz2 yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.lz yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.xz yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.tar.zst yuzu-52f54c728d9691f113f0736fab8fbc60b408dceb.zip |
Diffstat (limited to 'src/core/hle/service/nvflinger/nvflinger.cpp')
-rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 3c5c53e24..f9db79370 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -37,15 +37,14 @@ NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_t displays.emplace_back(4, "Null"); // Schedule the screen composition events - const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : frame_ticks; - - composition_event = core_timing.RegisterEvent( - "ScreenComposition", [this, ticks](u64 userdata, s64 cycles_late) { - Compose(); - this->core_timing.ScheduleEvent(ticks - cycles_late, composition_event); - }); - - core_timing.ScheduleEvent(ticks, composition_event); + composition_event = core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata, + s64 cycles_late) { + Compose(); + const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : GetNextTicks(); + this->core_timing.ScheduleEvent(std::max<s64>(0LL, ticks - cycles_late), composition_event); + }); + + core_timing.ScheduleEvent(frame_ticks, composition_event); } NVFlinger::~NVFlinger() { @@ -206,8 +205,14 @@ void NVFlinger::Compose() { igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride, buffer->get().transform, buffer->get().crop_rect); + swap_interval = buffer->get().swap_interval; buffer_queue.ReleaseBuffer(buffer->get().slot); } } +s64 NVFlinger::GetNextTicks() const { + constexpr s64 max_hertz = 120LL; + return (Core::Timing::BASE_CLOCK_RATE * (1LL << swap_interval)) / max_hertz; +} + } // namespace Service::NVFlinger |