summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvflinger
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-07-16 00:30:06 +0200
committerLioncash <mathew1800@gmail.com>2020-07-16 00:54:15 +0200
commit8b50c660dfce50a07c2b2aa3c1b6b8642259a944 (patch)
tree798b0427a660bf249311f3a13d96c6df69a6bcb5 /src/core/hle/service/nvflinger
parentMerge pull request #4342 from lioncash/endian (diff)
downloadyuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.gz
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.bz2
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.lz
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.xz
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.zst
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.zip
Diffstat (limited to 'src/core/hle/service/nvflinger')
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 2f44d3779..76672264d 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -28,8 +28,7 @@
namespace Service::NVFlinger {
-constexpr s64 frame_ticks = static_cast<s64>(1000000000 / 60);
-constexpr s64 frame_ticks_30fps = static_cast<s64>(1000000000 / 30);
+constexpr auto frame_ns = std::chrono::nanoseconds{1000000000 / 60};
void NVFlinger::VSyncThread(NVFlinger& nv_flinger) {
nv_flinger.SplitVSync();
@@ -71,16 +70,20 @@ NVFlinger::NVFlinger(Core::System& system) : system(system) {
Core::Timing::CreateEvent("ScreenComposition", [this](u64 userdata, s64 ns_late) {
Lock();
Compose();
- const auto ticks = GetNextTicks();
- this->system.CoreTiming().ScheduleEvent(std::max<s64>(0LL, ticks - ns_late),
- composition_event);
+
+ const auto ticks = std::chrono::nanoseconds{GetNextTicks()};
+ const auto ticks_delta = ticks - std::chrono::nanoseconds{ns_late};
+ const auto future_ns = std::max(std::chrono::nanoseconds::zero(), ticks_delta);
+
+ this->system.CoreTiming().ScheduleEvent(future_ns, composition_event);
});
+
if (system.IsMulticore()) {
is_running = true;
wait_event = std::make_unique<Common::Event>();
vsync_thread = std::make_unique<std::thread>(VSyncThread, std::ref(*this));
} else {
- system.CoreTiming().ScheduleEvent(frame_ticks, composition_event);
+ system.CoreTiming().ScheduleEvent(frame_ns, composition_event);
}
}