summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-07-22 21:03:50 -0400
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 22:04:36 -0400
commit2c6e274b3978ce4ee1af98e21f101e7037ec9d24 (patch)
tree3342199a569d656ed23b0d2407c01f939066aaed /src/core
parentdb46f8a70c853ccab3318abed1416231a3c426db (diff)
config, nvflinger: Add FPS cap setting
Allows finer tuning of the FPS limit.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp11
1 files changed, 6 insertions, 5 deletions
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<s64>(settings.fps_cap.GetValue()) : 1;
+ return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap);
}
} // namespace Service::NVFlinger