diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-29 10:06:04 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-29 10:06:04 +0200 |
commit | 8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3 (patch) | |
tree | 0e7ef0aa4ff134d53a46c0f1748a140c95db44fe /src/video_core | |
parent | Merge pull request #6373 from bunnei/use-slabheap-tls (diff) | |
download | yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.tar yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.tar.gz yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.tar.bz2 yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.tar.lz yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.tar.xz yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.tar.zst yuzu-8592f8a2b4cae1320b7e152f4d3a68ac7b39bfa3.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/gpu.cpp | 12 | ||||
-rw-r--r-- | src/video_core/gpu.h | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 37f7b24e1..35cc561be 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -104,7 +104,13 @@ void GPU::WaitFence(u32 syncpoint_id, u32 value) { } MICROPROFILE_SCOPE(GPU_wait); std::unique_lock lock{sync_mutex}; - sync_cv.wait(lock, [=, this] { return syncpoints.at(syncpoint_id).load() >= value; }); + sync_cv.wait(lock, [=, this] { + if (shutting_down.load(std::memory_order_relaxed)) { + // We're shutting down, ensure no threads continue to wait for the next syncpoint + return true; + } + return syncpoints.at(syncpoint_id).load() >= value; + }); } void GPU::IncrementSyncPoint(const u32 syncpoint_id) { @@ -523,6 +529,10 @@ void GPU::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const { } void GPU::ShutDown() { + // Signal that threads should no longer block on syncpoint fences + shutting_down.store(true, std::memory_order_relaxed); + sync_cv.notify_all(); + gpu_thread.ShutDown(); } diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 29a867863..a8e98e51b 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -389,6 +389,8 @@ private: std::unique_ptr<Engines::KeplerMemory> kepler_memory; /// Shader build notifier std::unique_ptr<VideoCore::ShaderNotify> shader_notify; + /// When true, we are about to shut down emulation session, so terminate outstanding tasks + std::atomic_bool shutting_down{}; std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{}; |