aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/gpu_thread.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-09-18 20:37:40 -0700
committerGitHub <noreply@github.com>2021-09-18 20:37:40 -0700
commita9c3619d26beaaae338c5e902635147b9237350a (patch)
treeb86f29a288fa5bc5a337ba61a6833fa1c89c2270 /src/video_core/gpu_thread.h
parent6e376c27a327d8e123efafe49370a304cec20221 (diff)
parent84f7e7e91c441636b93accae6f7bd52f70a8ab99 (diff)
Merge pull request #7019 from ameerj/videocore-jthread
videocore: Use std::jthread for worker threads
Diffstat (limited to 'src/video_core/gpu_thread.h')
-rw-r--r--src/video_core/gpu_thread.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h
index 11a648f38..91bada925 100644
--- a/src/video_core/gpu_thread.h
+++ b/src/video_core/gpu_thread.h
@@ -33,9 +33,6 @@ class RendererBase;
namespace VideoCommon::GPUThread {
-/// Command to signal to the GPU thread that processing has ended
-struct EndProcessingCommand final {};
-
/// Command to signal to the GPU thread that a command list is ready for processing
struct SubmitListCommand final {
explicit SubmitListCommand(Tegra::CommandList&& entries_) : entries{std::move(entries_)} {}
@@ -83,7 +80,7 @@ struct OnCommandListEndCommand final {};
struct GPUTickCommand final {};
using CommandData =
- std::variant<EndProcessingCommand, SubmitListCommand, SwapBuffersCommand, FlushRegionCommand,
+ std::variant<std::monostate, SubmitListCommand, SwapBuffersCommand, FlushRegionCommand,
InvalidateRegionCommand, FlushAndInvalidateRegionCommand, OnCommandListEndCommand,
GPUTickCommand>;
@@ -100,14 +97,12 @@ struct CommandDataContainer {
/// Struct used to synchronize the GPU thread
struct SynchState final {
- std::atomic_bool is_running{true};
-
- using CommandQueue = Common::SPSCQueue<CommandDataContainer>;
+ using CommandQueue = Common::SPSCQueue<CommandDataContainer, true>;
std::mutex write_lock;
CommandQueue queue;
u64 last_fence{};
std::atomic<u64> signaled_fence{};
- std::condition_variable cv;
+ std::condition_variable_any cv;
};
/// Class used to manage the GPU thread
@@ -149,7 +144,7 @@ private:
VideoCore::RasterizerInterface* rasterizer = nullptr;
SynchState state;
- std::thread thread;
+ std::jthread thread;
};
} // namespace VideoCommon::GPUThread