diff options
| author | 2020-01-06 00:09:57 -0500 | |
|---|---|---|
| committer | 2020-01-06 00:09:57 -0500 | |
| commit | 89fc75d76993d294ee106402bc78becc95d0bb38 (patch) | |
| tree | 5efd323f3848e1203a72dc69f52f0cd02776ac48 /src/video_core/gpu.cpp | |
| parent | Merge pull request #3264 from ReinUsesLisp/vk-descriptor-pool (diff) | |
| parent | video_core: Block in WaitFence. (diff) | |
| download | yuzu-89fc75d76993d294ee106402bc78becc95d0bb38.tar.gz yuzu-89fc75d76993d294ee106402bc78becc95d0bb38.tar.xz yuzu-89fc75d76993d294ee106402bc78becc95d0bb38.zip | |
Merge pull request #3257 from degasus/no_busy_loops
video_core: Block in WaitFence.
Diffstat (limited to 'src/video_core/gpu.cpp')
| -rw-r--r-- | src/video_core/gpu.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 095660115..b9c5c41a2 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -66,19 +66,20 @@ const DmaPusher& GPU::DmaPusher() const { | |||
| 66 | return *dma_pusher; | 66 | return *dma_pusher; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | void GPU::WaitFence(u32 syncpoint_id, u32 value) const { | 69 | void GPU::WaitFence(u32 syncpoint_id, u32 value) { |
| 70 | // Synced GPU, is always in sync | 70 | // Synced GPU, is always in sync |
| 71 | if (!is_async) { | 71 | if (!is_async) { |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | MICROPROFILE_SCOPE(GPU_wait); | 74 | MICROPROFILE_SCOPE(GPU_wait); |
| 75 | while (syncpoints[syncpoint_id].load(std::memory_order_relaxed) < value) { | 75 | std::unique_lock lock{sync_mutex}; |
| 76 | } | 76 | sync_cv.wait(lock, [=]() { return syncpoints[syncpoint_id].load() >= value; }); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void GPU::IncrementSyncPoint(const u32 syncpoint_id) { | 79 | void GPU::IncrementSyncPoint(const u32 syncpoint_id) { |
| 80 | syncpoints[syncpoint_id]++; | 80 | syncpoints[syncpoint_id]++; |
| 81 | std::lock_guard lock{sync_mutex}; | 81 | std::lock_guard lock{sync_mutex}; |
| 82 | sync_cv.notify_all(); | ||
| 82 | if (!syncpt_interrupts[syncpoint_id].empty()) { | 83 | if (!syncpt_interrupts[syncpoint_id].empty()) { |
| 83 | u32 value = syncpoints[syncpoint_id].load(); | 84 | u32 value = syncpoints[syncpoint_id].load(); |
| 84 | auto it = syncpt_interrupts[syncpoint_id].begin(); | 85 | auto it = syncpt_interrupts[syncpoint_id].begin(); |