summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-06-18 20:53:21 -0400
committerGravatar FernandoS272019-07-05 15:49:32 -0400
commitd20ede40b1e9cd0539982fb1feb3b13af3501ea2 (patch)
treea084fedd90a6a3cc3e11b099f4ddfe194d49c8ea /src/video_core
parentNVFlinger: Correct GCC compile error (diff)
downloadyuzu-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.cpp25
-rw-r--r--src/video_core/gpu.h18
-rw-r--r--src/video_core/gpu_asynch.h2
-rw-r--r--src/video_core/gpu_synch.h3
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
91void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { 91void 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
99bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { 101bool 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
112u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { 115u32 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
255protected: 251protected:
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
258private: 254private:
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
30protected: 30protected:
31 void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override; 31 void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override;
32 32
33private: 33private:
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
29protected: 29protected:
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