diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-06-23 15:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-23 15:27:14 +0200 |
commit | a6740224346db3c86944783e2b91dc7180c05537 (patch) | |
tree | af122b8a75d07f25113ef277aa25b2fdca14d05f /src/core/hle/service/nvnflinger | |
parent | Merge pull request #10842 from german77/native_mifare (diff) | |
parent | general: remove atomic signal and wait (diff) | |
download | yuzu-a6740224346db3c86944783e2b91dc7180c05537.tar yuzu-a6740224346db3c86944783e2b91dc7180c05537.tar.gz yuzu-a6740224346db3c86944783e2b91dc7180c05537.tar.bz2 yuzu-a6740224346db3c86944783e2b91dc7180c05537.tar.lz yuzu-a6740224346db3c86944783e2b91dc7180c05537.tar.xz yuzu-a6740224346db3c86944783e2b91dc7180c05537.tar.zst yuzu-a6740224346db3c86944783e2b91dc7180c05537.zip |
Diffstat (limited to 'src/core/hle/service/nvnflinger')
-rw-r--r-- | src/core/hle/service/nvnflinger/nvnflinger.cpp | 14 | ||||
-rw-r--r-- | src/core/hle/service/nvnflinger/nvnflinger.h | 3 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/core/hle/service/nvnflinger/nvnflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp index b41c6240c..5f55cd31e 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.cpp +++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp @@ -43,14 +43,10 @@ void Nvnflinger::SplitVSync(std::stop_token stop_token) { Common::SetCurrentThreadPriority(Common::ThreadPriority::High); while (!stop_token.stop_requested()) { - vsync_signal.wait(false); - vsync_signal.store(false); - - guard->lock(); + vsync_signal.Wait(); + const auto lock_guard = Lock(); Compose(); - - guard->unlock(); } } @@ -69,9 +65,8 @@ Nvnflinger::Nvnflinger(Core::System& system_, HosBinderDriverServer& hos_binder_ "ScreenComposition", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> { - vsync_signal.store(true); { const auto lock_guard = Lock(); } - vsync_signal.notify_one(); + vsync_signal.Set(); return std::chrono::nanoseconds(GetNextTicks()); }); @@ -97,8 +92,7 @@ Nvnflinger::~Nvnflinger() { if (system.IsMulticore()) { system.CoreTiming().UnscheduleEvent(multi_composition_event, {}); vsync_thread.request_stop(); - vsync_signal.store(true); - vsync_signal.notify_all(); + vsync_signal.Set(); } else { system.CoreTiming().UnscheduleEvent(single_composition_event, {}); } diff --git a/src/core/hle/service/nvnflinger/nvnflinger.h b/src/core/hle/service/nvnflinger/nvnflinger.h index a043cceb2..ef236303a 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.h +++ b/src/core/hle/service/nvnflinger/nvnflinger.h @@ -12,6 +12,7 @@ #include "common/common_types.h" #include "common/polyfill_thread.h" +#include "common/thread.h" #include "core/hle/result.h" #include "core/hle/service/kernel_helpers.h" @@ -143,7 +144,7 @@ private: Core::System& system; - std::atomic<bool> vsync_signal; + Common::Event vsync_signal; std::jthread vsync_thread; |