summaryrefslogtreecommitdiff
path: root/src/core/hle/service/nvnflinger
diff options
context:
space:
mode:
authorGravatar Liam2023-06-20 11:41:38 -0400
committerGravatar Liam2023-06-22 09:25:23 -0400
commit1586f1c0b174bec6b1db7de48b46ff75e29f3bb2 (patch)
treef84b5d604f05552f55a03b6a159bdb4cc57cba24 /src/core/hle/service/nvnflinger
parentMerge pull request #10086 from Morph1984/coretiming-ng-1 (diff)
downloadyuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.gz
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.xz
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.zip
general: remove atomic signal and wait
Diffstat (limited to 'src/core/hle/service/nvnflinger')
-rw-r--r--src/core/hle/service/nvnflinger/nvnflinger.cpp14
-rw-r--r--src/core/hle/service/nvnflinger/nvnflinger.h3
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) {
43 Common::SetCurrentThreadPriority(Common::ThreadPriority::High); 43 Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
44 44
45 while (!stop_token.stop_requested()) { 45 while (!stop_token.stop_requested()) {
46 vsync_signal.wait(false); 46 vsync_signal.Wait();
47 vsync_signal.store(false);
48
49 guard->lock();
50 47
48 const auto lock_guard = Lock();
51 Compose(); 49 Compose();
52
53 guard->unlock();
54 } 50 }
55} 51}
56 52
@@ -69,9 +65,8 @@ Nvnflinger::Nvnflinger(Core::System& system_, HosBinderDriverServer& hos_binder_
69 "ScreenComposition", 65 "ScreenComposition",
70 [this](std::uintptr_t, s64 time, 66 [this](std::uintptr_t, s64 time,
71 std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> { 67 std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
72 vsync_signal.store(true);
73 { const auto lock_guard = Lock(); } 68 { const auto lock_guard = Lock(); }
74 vsync_signal.notify_one(); 69 vsync_signal.Set();
75 return std::chrono::nanoseconds(GetNextTicks()); 70 return std::chrono::nanoseconds(GetNextTicks());
76 }); 71 });
77 72
@@ -97,8 +92,7 @@ Nvnflinger::~Nvnflinger() {
97 if (system.IsMulticore()) { 92 if (system.IsMulticore()) {
98 system.CoreTiming().UnscheduleEvent(multi_composition_event, {}); 93 system.CoreTiming().UnscheduleEvent(multi_composition_event, {});
99 vsync_thread.request_stop(); 94 vsync_thread.request_stop();
100 vsync_signal.store(true); 95 vsync_signal.Set();
101 vsync_signal.notify_all();
102 } else { 96 } else {
103 system.CoreTiming().UnscheduleEvent(single_composition_event, {}); 97 system.CoreTiming().UnscheduleEvent(single_composition_event, {});
104 } 98 }
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 @@
12 12
13#include "common/common_types.h" 13#include "common/common_types.h"
14#include "common/polyfill_thread.h" 14#include "common/polyfill_thread.h"
15#include "common/thread.h"
15#include "core/hle/result.h" 16#include "core/hle/result.h"
16#include "core/hle/service/kernel_helpers.h" 17#include "core/hle/service/kernel_helpers.h"
17 18
@@ -143,7 +144,7 @@ private:
143 144
144 Core::System& system; 145 Core::System& system;
145 146
146 std::atomic<bool> vsync_signal; 147 Common::Event vsync_signal;
147 148
148 std::jthread vsync_thread; 149 std::jthread vsync_thread;
149 150