summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-04-14 04:14:04 +0200
committerGitHub <noreply@github.com>2019-04-14 04:14:04 +0200
commit6088898b02fc4141f81bfda0006adc2e8219dff1 (patch)
treea1e406fd17f7105363d92803f77e6c7891b88579 /src/core/hle
parentMerge pull request #2381 from lioncash/fs (diff)
parentadded a toggle to force 30fps mode (diff)
downloadyuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar
yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.gz
yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.bz2
yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.lz
yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.xz
yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.zst
yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index c7f5bbf28..3c5c53e24 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -21,12 +21,13 @@
#include "core/hle/service/vi/display/vi_display.h"
#include "core/hle/service/vi/layer/vi_layer.h"
#include "core/perf_stats.h"
+#include "core/settings.h"
#include "video_core/renderer_base.h"
namespace Service::NVFlinger {
-constexpr std::size_t SCREEN_REFRESH_RATE = 60;
-constexpr s64 frame_ticks = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE);
+constexpr s64 frame_ticks = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / 60);
+constexpr s64 frame_ticks_30fps = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / 30);
NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_timing} {
displays.emplace_back(0, "Default");
@@ -36,13 +37,15 @@ NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_t
displays.emplace_back(4, "Null");
// Schedule the screen composition events
- composition_event =
- core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata, s64 cycles_late) {
+ 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(frame_ticks - cycles_late, composition_event);
+ this->core_timing.ScheduleEvent(ticks - cycles_late, composition_event);
});
- core_timing.ScheduleEvent(frame_ticks, composition_event);
+ core_timing.ScheduleEvent(ticks, composition_event);
}
NVFlinger::~NVFlinger() {
@@ -62,6 +65,7 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
const auto itr =
std::find_if(displays.begin(), displays.end(),
[&](const VI::Display& display) { return display.GetName() == name; });
+
if (itr == displays.end()) {
return {};
}