summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-06-20 17:41:38 +0200
committerLiam <byteslice@airmail.cc>2023-06-22 15:25:23 +0200
commit1586f1c0b174bec6b1db7de48b46ff75e29f3bb2 (patch)
treef84b5d604f05552f55a03b6a159bdb4cc57cba24 /src/core
parentMerge pull request #10086 from Morph1984/coretiming-ng-1 (diff)
downloadyuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.gz
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.bz2
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.lz
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.xz
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.tar.zst
yuzu-1586f1c0b174bec6b1db7de48b46ff75e29f3bb2.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nvnflinger/nvnflinger.cpp14
-rw-r--r--src/core/hle/service/nvnflinger/nvnflinger.h3
-rw-r--r--src/core/hle/service/server_manager.cpp7
-rw-r--r--src/core/hle/service/server_manager.h4
4 files changed, 10 insertions, 18 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;
diff --git a/src/core/hle/service/server_manager.cpp b/src/core/hle/service/server_manager.cpp
index 156bc27d8..d1e99b184 100644
--- a/src/core/hle/service/server_manager.cpp
+++ b/src/core/hle/service/server_manager.cpp
@@ -44,7 +44,7 @@ ServerManager::~ServerManager() {
m_event->Signal();
// Wait for processing to stop.
- m_stopped.wait(false);
+ m_stopped.Wait();
m_threads.clear();
// Clean up ports.
@@ -182,10 +182,7 @@ void ServerManager::StartAdditionalHostThreads(const char* name, size_t num_thre
}
Result ServerManager::LoopProcess() {
- SCOPE_EXIT({
- m_stopped.store(true);
- m_stopped.notify_all();
- });
+ SCOPE_EXIT({ m_stopped.Set(); });
R_RETURN(this->LoopProcessImpl());
}
diff --git a/src/core/hle/service/server_manager.h b/src/core/hle/service/server_manager.h
index fdb8af2ff..58b0a0832 100644
--- a/src/core/hle/service/server_manager.h
+++ b/src/core/hle/service/server_manager.h
@@ -3,7 +3,6 @@
#pragma once
-#include <atomic>
#include <functional>
#include <list>
#include <map>
@@ -12,6 +11,7 @@
#include <vector>
#include "common/polyfill_thread.h"
+#include "common/thread.h"
#include "core/hle/result.h"
#include "core/hle/service/mutex.h"
@@ -82,7 +82,7 @@ private:
std::list<RequestState> m_deferrals{};
// Host state tracking
- std::atomic<bool> m_stopped{};
+ Common::Event m_stopped{};
std::vector<std::jthread> m_threads{};
std::stop_source m_stop_source{};
};