diff options
| author | 2019-06-18 20:53:21 -0400 | |
|---|---|---|
| committer | 2019-07-05 15:49:32 -0400 | |
| commit | d20ede40b1e9cd0539982fb1feb3b13af3501ea2 (patch) | |
| tree | a084fedd90a6a3cc3e11b099f4ddfe194d49c8ea /src/video_core | |
| parent | NVFlinger: Correct GCC compile error (diff) | |
| download | yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.gz yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.xz yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.zip | |
NVServices: Styling, define constructors as explicit and corrections
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/gpu.cpp | 25 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 18 | ||||
| -rw-r--r-- | src/video_core/gpu_asynch.h | 2 | ||||
| -rw-r--r-- | src/video_core/gpu_synch.h | 3 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 278528618..da8c715b6 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -89,24 +89,27 @@ u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const { | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { | 91 | void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { |
| 92 | for (u32 in_value : syncpt_interrupts[syncpoint_id]) { | 92 | auto& interrupt = syncpt_interrupts[syncpoint_id]; |
| 93 | if (in_value == value) | 93 | bool contains = std::any_of(interrupt.begin(), interrupt.end(), |
| 94 | return; | 94 | [value](u32 in_value) { return in_value == value; }); |
| 95 | if (contains) { | ||
| 96 | return; | ||
| 95 | } | 97 | } |
| 96 | syncpt_interrupts[syncpoint_id].emplace_back(value); | 98 | syncpt_interrupts[syncpoint_id].emplace_back(value); |
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { | 101 | bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { |
| 100 | std::lock_guard lock{sync_mutex}; | 102 | std::lock_guard lock{sync_mutex}; |
| 101 | auto it = syncpt_interrupts[syncpoint_id].begin(); | 103 | auto& interrupt = syncpt_interrupts[syncpoint_id]; |
| 102 | while (it != syncpt_interrupts[syncpoint_id].end()) { | 104 | const auto iter = |
| 103 | if (value == *it) { | 105 | std::find_if(interrupt.begin(), interrupt.end(), |
| 104 | it = syncpt_interrupts[syncpoint_id].erase(it); | 106 | [value](u32 interrupt_value) { return value == interrupt_value; }); |
| 105 | return true; | 107 | |
| 106 | } | 108 | if (iter == interrupt.end()) { |
| 107 | it++; | 109 | return false; |
| 108 | } | 110 | } |
| 109 | return false; | 111 | interrupt.erase(iter); |
| 112 | return true; | ||
| 110 | } | 113 | } |
| 111 | 114 | ||
| 112 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | 115 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 94afc91f8..334dec48c 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -168,20 +168,16 @@ public: | |||
| 168 | /// Returns a reference to the GPU DMA pusher. | 168 | /// Returns a reference to the GPU DMA pusher. |
| 169 | Tegra::DmaPusher& DmaPusher(); | 169 | Tegra::DmaPusher& DmaPusher(); |
| 170 | 170 | ||
| 171 | void IncrementSyncPoint(const u32 syncpoint_id); | 171 | void IncrementSyncPoint(u32 syncpoint_id); |
| 172 | 172 | ||
| 173 | u32 GetSyncpointValue(const u32 syncpoint_id) const; | 173 | u32 GetSyncpointValue(u32 syncpoint_id) const; |
| 174 | 174 | ||
| 175 | void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value); | 175 | void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value); |
| 176 | 176 | ||
| 177 | bool CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value); | 177 | bool CancelSyncptInterrupt(u32 syncpoint_id, u32 value); |
| 178 | 178 | ||
| 179 | void Guard(bool guard_set) { | 179 | std::unique_lock<std::mutex> LockSync() { |
| 180 | if (guard_set) { | 180 | return std::unique_lock{sync_mutex}; |
| 181 | sync_mutex.lock(); | ||
| 182 | } else { | ||
| 183 | sync_mutex.unlock(); | ||
| 184 | } | ||
| 185 | } | 181 | } |
| 186 | 182 | ||
| 187 | bool IsAsync() const { | 183 | bool IsAsync() const { |
| @@ -253,7 +249,7 @@ public: | |||
| 253 | virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0; | 249 | virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0; |
| 254 | 250 | ||
| 255 | protected: | 251 | protected: |
| 256 | virtual void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const = 0; | 252 | virtual void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const = 0; |
| 257 | 253 | ||
| 258 | private: | 254 | private: |
| 259 | void ProcessBindMethod(const MethodCall& method_call); | 255 | void ProcessBindMethod(const MethodCall& method_call); |
diff --git a/src/video_core/gpu_asynch.h b/src/video_core/gpu_asynch.h index 5f1b2fb7d..36377d677 100644 --- a/src/video_core/gpu_asynch.h +++ b/src/video_core/gpu_asynch.h | |||
| @@ -28,7 +28,7 @@ public: | |||
| 28 | void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; | 28 | void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; |
| 29 | 29 | ||
| 30 | protected: | 30 | protected: |
| 31 | void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override; | 31 | void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override; |
| 32 | 32 | ||
| 33 | private: | 33 | private: |
| 34 | GPUThread::ThreadManager gpu_thread; | 34 | GPUThread::ThreadManager gpu_thread; |
diff --git a/src/video_core/gpu_synch.h b/src/video_core/gpu_synch.h index 58d258503..07bcc47f1 100644 --- a/src/video_core/gpu_synch.h +++ b/src/video_core/gpu_synch.h | |||
| @@ -27,7 +27,8 @@ public: | |||
| 27 | void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; | 27 | void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; |
| 28 | 28 | ||
| 29 | protected: | 29 | protected: |
| 30 | void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override {} | 30 | void TriggerCpuInterrupt([[maybe_unused]] u32 syncpoint_id, |
| 31 | [[maybe_unused]] u32 value) const override {} | ||
| 31 | }; | 32 | }; |
| 32 | 33 | ||
| 33 | } // namespace VideoCommon | 34 | } // namespace VideoCommon |