From 2c6e274b3978ce4ee1af98e21f101e7037ec9d24 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 22 Jul 2021 21:03:50 -0400 Subject: config, nvflinger: Add FPS cap setting Allows finer tuning of the FPS limit. --- src/core/hle/service/nvflinger/nvflinger.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/core/hle/service/nvflinger') diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 1d810562f..941748970 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -307,11 +307,12 @@ void NVFlinger::Compose() { } s64 NVFlinger::GetNextTicks() const { - if (Settings::values.disable_fps_limit.GetValue()) { - return 0; - } - constexpr s64 max_hertz = 120LL; - return (1000000000 * (1LL << swap_interval)) / max_hertz; + static constexpr s64 max_hertz = 120LL; + + const auto& settings = Settings::values; + const bool unlocked_fps = settings.disable_fps_limit.GetValue(); + const s64 fps_cap = unlocked_fps ? static_cast(settings.fps_cap.GetValue()) : 1; + return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap); } } // namespace Service::NVFlinger -- cgit v1.2.3