diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/gpu.cpp | 30 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 14 | ||||
| -rw-r--r-- | src/video_core/gpu_asynch.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/gpu_asynch.h | 2 | ||||
| -rw-r--r-- | src/video_core/gpu_synch.h | 2 |
5 files changed, 23 insertions, 29 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 086db0e69..efea23bf2 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -70,13 +70,13 @@ const DmaPusher& GPU::DmaPusher() const { | |||
| 70 | void GPU::IncrementSyncPoint(const u32 syncpoint_id) { | 70 | void GPU::IncrementSyncPoint(const u32 syncpoint_id) { |
| 71 | syncpoints[syncpoint_id]++; | 71 | syncpoints[syncpoint_id]++; |
| 72 | sync_mutex.lock(); | 72 | sync_mutex.lock(); |
| 73 | if (!events[syncpoint_id].empty()) { | 73 | if (!syncpt_interrupts[syncpoint_id].empty()) { |
| 74 | u32 value = syncpoints[syncpoint_id].load(); | 74 | u32 value = syncpoints[syncpoint_id].load(); |
| 75 | auto it = events[syncpoint_id].begin(); | 75 | auto it = syncpt_interrupts[syncpoint_id].begin(); |
| 76 | while (it != events[syncpoint_id].end()) { | 76 | while (it != syncpt_interrupts[syncpoint_id].end()) { |
| 77 | if (value >= it->value) { | 77 | if (value >= *it) { |
| 78 | TriggerCpuInterrupt(it->event_id); | 78 | TriggerCpuInterrupt(syncpoint_id, *it); |
| 79 | it = events[syncpoint_id].erase(it); | 79 | it = syncpt_interrupts[syncpoint_id].erase(it); |
| 80 | continue; | 80 | continue; |
| 81 | } | 81 | } |
| 82 | it++; | 82 | it++; |
| @@ -89,19 +89,19 @@ u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const { | |||
| 89 | return syncpoints[syncpoint_id].load(); | 89 | return syncpoints[syncpoint_id].load(); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | void GPU::RegisterEvent(const u32 event_id, const u32 syncpoint_id, const u32 value) { | 92 | void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { |
| 93 | for (auto& ev : events[syncpoint_id]) { | 93 | for (u32 in_value : syncpt_interrupts[syncpoint_id]) { |
| 94 | if (ev.event_id == event_id && ev.value == value) | 94 | if (in_value == value) |
| 95 | return; | 95 | return; |
| 96 | } | 96 | } |
| 97 | events[syncpoint_id].emplace_back(event_id, value); | 97 | syncpt_interrupts[syncpoint_id].emplace_back(value); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | void GPU::CancelEvent(const u32 event_id, const u32 syncpoint_id, const u32 value) { | 100 | void GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { |
| 101 | auto it = events[syncpoint_id].begin(); | 101 | auto it = syncpt_interrupts[syncpoint_id].begin(); |
| 102 | while (it != events[syncpoint_id].end()) { | 102 | while (it != syncpt_interrupts[syncpoint_id].end()) { |
| 103 | if (value == it->value) { | 103 | if (value == *it) { |
| 104 | it = events[syncpoint_id].erase(it); | 104 | it = syncpt_interrupts[syncpoint_id].erase(it); |
| 105 | return; | 105 | return; |
| 106 | } | 106 | } |
| 107 | it++; | 107 | it++; |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 18ac3237e..9bd618941 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -172,9 +172,9 @@ public: | |||
| 172 | 172 | ||
| 173 | u32 GetSyncpointValue(const u32 syncpoint_id) const; | 173 | u32 GetSyncpointValue(const u32 syncpoint_id) const; |
| 174 | 174 | ||
| 175 | void RegisterEvent(const u32 event_id, const u32 syncpoint_id, const u32 value); | 175 | void RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value); |
| 176 | 176 | ||
| 177 | void CancelEvent(const u32 event_id, const u32 syncpoint_id, const u32 value); | 177 | void CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value); |
| 178 | 178 | ||
| 179 | void Guard(bool guard_set) { | 179 | void Guard(bool guard_set) { |
| 180 | if (guard_set) { | 180 | if (guard_set) { |
| @@ -253,7 +253,7 @@ public: | |||
| 253 | virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0; | 253 | virtual void FlushAndInvalidateRegion(CacheAddr addr, u64 size) = 0; |
| 254 | 254 | ||
| 255 | protected: | 255 | protected: |
| 256 | virtual void TriggerCpuInterrupt(const u32 event_id) const = 0; | 256 | virtual void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const = 0; |
| 257 | 257 | ||
| 258 | private: | 258 | private: |
| 259 | void ProcessBindMethod(const MethodCall& method_call); | 259 | void ProcessBindMethod(const MethodCall& method_call); |
| @@ -293,13 +293,7 @@ private: | |||
| 293 | 293 | ||
| 294 | std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{}; | 294 | std::array<std::atomic<u32>, Service::Nvidia::MaxSyncPoints> syncpoints{}; |
| 295 | 295 | ||
| 296 | struct Event { | 296 | std::array<std::list<u32>, Service::Nvidia::MaxSyncPoints> syncpt_interrupts; |
| 297 | Event(const u32 event_id, const u32 value) : event_id(event_id), value(value) {} | ||
| 298 | u32 event_id; | ||
| 299 | u32 value; | ||
| 300 | }; | ||
| 301 | |||
| 302 | std::array<std::list<Event>, Service::Nvidia::MaxSyncPoints> events; | ||
| 303 | 297 | ||
| 304 | std::mutex sync_mutex; | 298 | std::mutex sync_mutex; |
| 305 | 299 | ||
diff --git a/src/video_core/gpu_asynch.cpp b/src/video_core/gpu_asynch.cpp index 6b6f0f6ec..ea67be831 100644 --- a/src/video_core/gpu_asynch.cpp +++ b/src/video_core/gpu_asynch.cpp | |||
| @@ -40,9 +40,9 @@ void GPUAsynch::FlushAndInvalidateRegion(CacheAddr addr, u64 size) { | |||
| 40 | gpu_thread.FlushAndInvalidateRegion(addr, size); | 40 | gpu_thread.FlushAndInvalidateRegion(addr, size); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void GPUAsynch::TriggerCpuInterrupt(const u32 event_id) const { | 43 | void GPUAsynch::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const { |
| 44 | auto& interrupt_manager = system.InterruptManager(); | 44 | auto& interrupt_manager = system.InterruptManager(); |
| 45 | interrupt_manager.InterruptGPU(event_id); | 45 | interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | } // namespace VideoCommon | 48 | } // namespace VideoCommon |
diff --git a/src/video_core/gpu_asynch.h b/src/video_core/gpu_asynch.h index d49e9b96e..5f1b2fb7d 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 event_id) const override; | 31 | void TriggerCpuInterrupt(const u32 syncpoint_id, const 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 09bda854a..58d258503 100644 --- a/src/video_core/gpu_synch.h +++ b/src/video_core/gpu_synch.h | |||
| @@ -27,7 +27,7 @@ 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 event_id) const override {} | 30 | void TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const override {} |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | } // namespace VideoCommon | 33 | } // namespace VideoCommon |