Explorar o código

Gpu: use an std mutex instead of a spin_lock to guard syncpoints

Fernando Sahmkow %!s(int64=7) %!d(string=hai) anos
pai
achega
c13433aee4
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 2 2
      src/video_core/gpu.cpp
  2. 4 4
      src/video_core/gpu.h

+ 2 - 2
src/video_core/gpu.cpp

@@ -69,7 +69,7 @@ const DmaPusher& GPU::DmaPusher() const {
 
 
 void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
 void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
     syncpoints[syncpoint_id]++;
     syncpoints[syncpoint_id]++;
-    sync_guard.lock();
+    sync_mutex.lock();
     if (!events[syncpoint_id].empty()) {
     if (!events[syncpoint_id].empty()) {
         u32 value = syncpoints[syncpoint_id].load();
         u32 value = syncpoints[syncpoint_id].load();
         auto it = events[syncpoint_id].begin();
         auto it = events[syncpoint_id].begin();
@@ -82,7 +82,7 @@ void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
             it++;
             it++;
         }
         }
     }
     }
-    sync_guard.unlock();
+    sync_mutex.unlock();
 }
 }
 
 
 u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const {
 u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const {

+ 4 - 4
src/video_core/gpu.h

@@ -8,11 +8,11 @@
 #include <atomic>
 #include <atomic>
 #include <list>
 #include <list>
 #include <memory>
 #include <memory>
+#include <mutex>
 #include "common/common_types.h"
 #include "common/common_types.h"
 #include "core/hle/service/nvdrv/nvdata.h"
 #include "core/hle/service/nvdrv/nvdata.h"
 #include "core/hle/service/nvflinger/buffer_queue.h"
 #include "core/hle/service/nvflinger/buffer_queue.h"
 #include "video_core/dma_pusher.h"
 #include "video_core/dma_pusher.h"
-#include "common/spin_lock.h"
 
 
 using CacheAddr = std::uintptr_t;
 using CacheAddr = std::uintptr_t;
 inline CacheAddr ToCacheAddr(const void* host_ptr) {
 inline CacheAddr ToCacheAddr(const void* host_ptr) {
@@ -178,9 +178,9 @@ public:
 
 
     void Guard(bool guard_set) {
     void Guard(bool guard_set) {
         if (guard_set) {
         if (guard_set) {
-            sync_guard.lock();
+            sync_mutex.lock();
         } else {
         } else {
-            sync_guard.unlock();
+            sync_mutex.unlock();
         }
         }
     }
     }
 
 
@@ -297,7 +297,7 @@ private:
 
 
     std::array<std::list<Event>, Service::Nvidia::MaxSyncPoints> events;
     std::array<std::list<Event>, Service::Nvidia::MaxSyncPoints> events;
 
 
-    Common::SpinLock sync_guard{};
+    std::mutex sync_mutex;
 };
 };
 
 
 #define ASSERT_REG_POSITION(field_name, position)                                                  \
 #define ASSERT_REG_POSITION(field_name, position)                                                  \