diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-06-18 20:53:21 -0400 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-07-05 15:49:32 -0400 |
commit | d20ede40b1e9cd0539982fb1feb3b13af3501ea2 (patch) | |
tree | a084fedd90a6a3cc3e11b099f4ddfe194d49c8ea /src/video_core | |
parent | b391e5f6386eecf6170b544245e3e4e31427913c (diff) |
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 { } void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { - for (u32 in_value : syncpt_interrupts[syncpoint_id]) { - if (in_value == value) - return; + auto& interrupt = syncpt_interrupts[syncpoint_id]; + bool contains = std::any_of(interrupt.begin(), interrupt.end(), + [value](u32 in_value) { return in_value == value; }); + if (contains) { + return; } syncpt_interrupts[syncpoint_id].emplace_back(value); } bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { std::lock_guard lock{sync_mutex}; - auto it = syncpt_interrupts[syncpoint_id].begin(); - while (it != syncpt_interrupts[syncpoint_id].end()) { - if (value == *it) { - it = syncpt_interrupts[syncpoint_id].erase(it); - return true; - } - it++; + auto& interrupt = syncpt_interrupts[syncpoint_id]; + const auto iter = + std::find_if(interrupt.begin(), interrupt.end(), + [value](u32 interrupt_value) { return value == interrupt_value; }); + + if (iter == interrupt.end()) { + return false; } - return false; + interrupt.erase(iter); + return true; } 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: /// Returns a reference to the GPU DMA pusher. Tegra::DmaPusher& DmaPusher(); - void IncrementSyncPoint(const u32 syncpoint_id); + void IncrementSyncPoint(u32 syncpoint_id); - u32 GetSyncpointValue(const u32 syncpoint_id) const; + u32 GetSyncpointValue(u32 syncpoint_id) const; - void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value); + void RegisterSyncptInterrupt(u32 syncpoint_id, u32 value); - bool CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value); + bool CancelSyncptInterrupt(u32 syncpoint_id, u32 value); - void Guard(bool guard_set) { - if (guard_set) { - sync_mutex.lock(); - } else { - sync_mutex.unlock(); - } + std::unique_lock<std::mutex> LockSync() { + return std::unique_lock{sync_mutex}; } bool IsAsync() const { @@ -253,7 +249,7 @@ public: virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0; protected: - virtual void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const = 0; + virtual void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const = 0; private: 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: void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; protected: - void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override; + void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override; private: 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: void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override; protected: - void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override {} + void TriggerCpuInterrupt([[maybe_unused]] u32 syncpoint_id, + [[maybe_unused]] u32 value) const override {} }; } // namespace VideoCommon |