diff options
| author | 2019-12-30 13:03:20 +0100 | |
|---|---|---|
| committer | 2019-12-30 13:04:53 +0100 | |
| commit | cb9dd01ffd3f54f5592330e3a37e2b26975bf209 (patch) | |
| tree | dc41e5bea7e4844fceebbbb2d7481eb026bfcfd9 /src/video_core/gpu.cpp | |
| parent | Merge pull request #3250 from ReinUsesLisp/empty-fragment (diff) | |
| download | yuzu-cb9dd01ffd3f54f5592330e3a37e2b26975bf209.tar.gz yuzu-cb9dd01ffd3f54f5592330e3a37e2b26975bf209.tar.xz yuzu-cb9dd01ffd3f54f5592330e3a37e2b26975bf209.zip | |
video_core: Block in WaitFence.
This function is called rarely and blocks quite often for a long time.
So don't waste power and let the CPU sleep.
This might also increase the performance as the other cores might be allowed to clock higher.
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(); |