summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/gpu.cpp2
-rw-r--r--src/video_core/gpu.h11
2 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 1fa6770ca..ee976f81f 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -69,6 +69,7 @@ const DmaPusher& GPU::DmaPusher() const {
69 69
70void GPU::IncrementSyncPoint(const u32 syncpoint_id) { 70void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
71 syncpoints[syncpoint_id]++; 71 syncpoints[syncpoint_id]++;
72 sync_guard.lock();
72 if (!events[syncpoint_id].empty()) { 73 if (!events[syncpoint_id].empty()) {
73 u32 value = syncpoints[syncpoint_id].load(); 74 u32 value = syncpoints[syncpoint_id].load();
74 auto it = events[syncpoint_id].begin(); 75 auto it = events[syncpoint_id].begin();
@@ -81,6 +82,7 @@ void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
81 it++; 82 it++;
82 } 83 }
83 } 84 }
85 sync_guard.unlock();
84} 86}
85 87
86u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const { 88u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const {
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 4805a5fbc..bc63920f2 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -12,6 +12,7 @@
12#include "core/hle/service/nvdrv/nvdata.h" 12#include "core/hle/service/nvdrv/nvdata.h"
13#include "core/hle/service/nvflinger/buffer_queue.h" 13#include "core/hle/service/nvflinger/buffer_queue.h"
14#include "video_core/dma_pusher.h" 14#include "video_core/dma_pusher.h"
15#include "common/spin_lock.h"
15 16
16using CacheAddr = std::uintptr_t; 17using CacheAddr = std::uintptr_t;
17inline CacheAddr ToCacheAddr(const void* host_ptr) { 18inline CacheAddr ToCacheAddr(const void* host_ptr) {
@@ -175,6 +176,14 @@ public:
175 176
176 void CancelEvent(const u32 event_id, const u32 syncpoint_id, const u32 value); 177 void CancelEvent(const u32 event_id, const u32 syncpoint_id, const u32 value);
177 178
179 void Guard(bool guard_set) {
180 if (guard_set) {
181 sync_guard.lock();
182 } else {
183 sync_guard.unlock();
184 }
185 }
186
178 /// Returns a const reference to the GPU DMA pusher. 187 /// Returns a const reference to the GPU DMA pusher.
179 const Tegra::DmaPusher& DmaPusher() const; 188 const Tegra::DmaPusher& DmaPusher() const;
180 189
@@ -287,6 +296,8 @@ private:
287 }; 296 };
288 297
289 std::array<std::list<Event>, Service::Nvidia::MaxSyncPoints> events; 298 std::array<std::list<Event>, Service::Nvidia::MaxSyncPoints> events;
299
300 Common::SpinLock sync_guard{};
290}; 301};
291 302
292#define ASSERT_REG_POSITION(field_name, position) \ 303#define ASSERT_REG_POSITION(field_name, position) \