diff options
| author | 2022-01-03 20:28:54 -0500 | |
|---|---|---|
| committer | 2022-01-03 20:28:54 -0500 | |
| commit | 76525432317fcc4b4847c5414bed6660c85e582b (patch) | |
| tree | 38f9f01b22cb2bc4cd1c012725094133b7587d22 /src/video_core/gpu.cpp | |
| parent | Merge pull request #7668 from ameerj/fence-stop-token (diff) | |
| download | yuzu-76525432317fcc4b4847c5414bed6660c85e582b.tar.gz yuzu-76525432317fcc4b4847c5414bed6660c85e582b.tar.xz yuzu-76525432317fcc4b4847c5414bed6660c85e582b.zip | |
Revert "Merge pull request #7668 from ameerj/fence-stop-token"
This reverts commit e7733544779f2706d108682dd027d44e7fa5ff4b, reversing
changes made to abbbdc2bc027ed7af236625ae8427a46df63f7e7.
Diffstat (limited to 'src/video_core/gpu.cpp')
| -rw-r--r-- | src/video_core/gpu.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index d98874150..8788f5148 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -206,7 +206,7 @@ struct GPU::Impl { | |||
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame. | 208 | /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame. |
| 209 | void WaitFence(u32 syncpoint_id, u32 value, std::stop_token stop_token = {}) { | 209 | void WaitFence(u32 syncpoint_id, u32 value) { |
| 210 | // Synced GPU, is always in sync | 210 | // Synced GPU, is always in sync |
| 211 | if (!is_async) { | 211 | if (!is_async) { |
| 212 | return; | 212 | return; |
| @@ -218,8 +218,13 @@ struct GPU::Impl { | |||
| 218 | } | 218 | } |
| 219 | MICROPROFILE_SCOPE(GPU_wait); | 219 | MICROPROFILE_SCOPE(GPU_wait); |
| 220 | std::unique_lock lock{sync_mutex}; | 220 | std::unique_lock lock{sync_mutex}; |
| 221 | sync_cv.wait(lock, stop_token, | 221 | sync_cv.wait(lock, [=, this] { |
| 222 | [=, this] { return syncpoints.at(syncpoint_id).load() >= value; }); | 222 | if (shutting_down.load(std::memory_order_relaxed)) { |
| 223 | // We're shutting down, ensure no threads continue to wait for the next syncpoint | ||
| 224 | return true; | ||
| 225 | } | ||
| 226 | return syncpoints.at(syncpoint_id).load() >= value; | ||
| 227 | }); | ||
| 223 | } | 228 | } |
| 224 | 229 | ||
| 225 | void IncrementSyncPoint(u32 syncpoint_id) { | 230 | void IncrementSyncPoint(u32 syncpoint_id) { |
| @@ -665,6 +670,8 @@ struct GPU::Impl { | |||
| 665 | std::unique_ptr<Engines::KeplerMemory> kepler_memory; | 670 | std::unique_ptr<Engines::KeplerMemory> kepler_memory; |
| 666 | /// Shader build notifier | 671 | /// Shader build notifier |
| 667 | std::unique_ptr<VideoCore::ShaderNotify> shader_notify; | 672 | std::unique_ptr<VideoCore::ShaderNotify> shader_notify; |
| 673 | /// When true, we are about to shut down emulation session, so terminate outstanding tasks | ||
| 674 | std::atomic_bool shutting_down{}; | ||
| 668 | 675 | ||
| 669 | std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{}; | 676 | std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{}; |
| 670 | 677 | ||
| @@ -673,7 +680,7 @@ struct GPU::Impl { | |||
| 673 | std::mutex sync_mutex; | 680 | std::mutex sync_mutex; |
| 674 | std::mutex device_mutex; | 681 | std::mutex device_mutex; |
| 675 | 682 | ||
| 676 | std::condition_variable_any sync_cv; | 683 | std::condition_variable sync_cv; |
| 677 | 684 | ||
| 678 | struct FlushRequest { | 685 | struct FlushRequest { |
| 679 | explicit FlushRequest(u64 fence_, VAddr addr_, std::size_t size_) | 686 | explicit FlushRequest(u64 fence_, VAddr addr_, std::size_t size_) |
| @@ -812,8 +819,8 @@ const VideoCore::ShaderNotify& GPU::ShaderNotify() const { | |||
| 812 | return impl->ShaderNotify(); | 819 | return impl->ShaderNotify(); |
| 813 | } | 820 | } |
| 814 | 821 | ||
| 815 | void GPU::WaitFence(u32 syncpoint_id, u32 value, std::stop_token stop_token) { | 822 | void GPU::WaitFence(u32 syncpoint_id, u32 value) { |
| 816 | impl->WaitFence(syncpoint_id, value, stop_token); | 823 | impl->WaitFence(syncpoint_id, value); |
| 817 | } | 824 | } |
| 818 | 825 | ||
| 819 | void GPU::IncrementSyncPoint(u32 syncpoint_id) { | 826 | void GPU::IncrementSyncPoint(u32 syncpoint_id) { |