diff options
| author | 2019-04-13 22:14:04 -0400 | |
|---|---|---|
| committer | 2019-04-13 22:14:04 -0400 | |
| commit | 6088898b02fc4141f81bfda0006adc2e8219dff1 (patch) | |
| tree | a1e406fd17f7105363d92803f77e6c7891b88579 /src/core | |
| parent | Merge pull request #2381 from lioncash/fs (diff) | |
| parent | added a toggle to force 30fps mode (diff) | |
| download | yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.gz yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.tar.xz yuzu-6088898b02fc4141f81bfda0006adc2e8219dff1.zip | |
Merge pull request #2357 from zarroboogs/force-30fps-mode
Add a toggle to force 30FPS mode
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 16 | ||||
| -rw-r--r-- | src/core/settings.h | 1 |
2 files changed, 11 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 @@ | |||
| 21 | #include "core/hle/service/vi/display/vi_display.h" | 21 | #include "core/hle/service/vi/display/vi_display.h" |
| 22 | #include "core/hle/service/vi/layer/vi_layer.h" | 22 | #include "core/hle/service/vi/layer/vi_layer.h" |
| 23 | #include "core/perf_stats.h" | 23 | #include "core/perf_stats.h" |
| 24 | #include "core/settings.h" | ||
| 24 | #include "video_core/renderer_base.h" | 25 | #include "video_core/renderer_base.h" |
| 25 | 26 | ||
| 26 | namespace Service::NVFlinger { | 27 | namespace Service::NVFlinger { |
| 27 | 28 | ||
| 28 | constexpr std::size_t SCREEN_REFRESH_RATE = 60; | 29 | constexpr s64 frame_ticks = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / 60); |
| 29 | constexpr s64 frame_ticks = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); | 30 | constexpr s64 frame_ticks_30fps = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / 30); |
| 30 | 31 | ||
| 31 | NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_timing} { | 32 | NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_timing} { |
| 32 | displays.emplace_back(0, "Default"); | 33 | displays.emplace_back(0, "Default"); |
| @@ -36,13 +37,15 @@ NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_t | |||
| 36 | displays.emplace_back(4, "Null"); | 37 | displays.emplace_back(4, "Null"); |
| 37 | 38 | ||
| 38 | // Schedule the screen composition events | 39 | // Schedule the screen composition events |
| 39 | composition_event = | 40 | const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : frame_ticks; |
| 40 | core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata, s64 cycles_late) { | 41 | |
| 42 | composition_event = core_timing.RegisterEvent( | ||
| 43 | "ScreenComposition", [this, ticks](u64 userdata, s64 cycles_late) { | ||
| 41 | Compose(); | 44 | Compose(); |
| 42 | this->core_timing.ScheduleEvent(frame_ticks - cycles_late, composition_event); | 45 | this->core_timing.ScheduleEvent(ticks - cycles_late, composition_event); |
| 43 | }); | 46 | }); |
| 44 | 47 | ||
| 45 | core_timing.ScheduleEvent(frame_ticks, composition_event); | 48 | core_timing.ScheduleEvent(ticks, composition_event); |
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | NVFlinger::~NVFlinger() { | 51 | NVFlinger::~NVFlinger() { |
| @@ -62,6 +65,7 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) { | |||
| 62 | const auto itr = | 65 | const auto itr = |
| 63 | std::find_if(displays.begin(), displays.end(), | 66 | std::find_if(displays.begin(), displays.end(), |
| 64 | [&](const VI::Display& display) { return display.GetName() == name; }); | 67 | [&](const VI::Display& display) { return display.GetName() == name; }); |
| 68 | |||
| 65 | if (itr == displays.end()) { | 69 | if (itr == displays.end()) { |
| 66 | return {}; | 70 | return {}; |
| 67 | } | 71 | } |
diff --git a/src/core/settings.h b/src/core/settings.h index d543eb32f..b84390745 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -393,6 +393,7 @@ struct Values { | |||
| 393 | bool use_disk_shader_cache; | 393 | bool use_disk_shader_cache; |
| 394 | bool use_accurate_gpu_emulation; | 394 | bool use_accurate_gpu_emulation; |
| 395 | bool use_asynchronous_gpu_emulation; | 395 | bool use_asynchronous_gpu_emulation; |
| 396 | bool force_30fps_mode; | ||
| 396 | 397 | ||
| 397 | float bg_red; | 398 | float bg_red; |
| 398 | float bg_green; | 399 | float bg_green; |