VERY experimental Nintendo Switch 2 emulator
C++
nvflinger: Use return value of Lock()
Lioncash94ae1a0bf1fa
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cppindex 7898561185..e561bf6549 100644--- a/src/core/hle/service/nvflinger/nvflinger.cpp+++ b/src/core/hle/service/nvflinger/nvflinger.cpp@@ -68,7 +68,7 @@ NVFlinger::NVFlinger(Core::System& system) : system(system) {// Schedule the screen composition eventscomposition_event = Core::Timing::CreateEvent("ScreenComposition", [this](u64, std::chrono::nanoseconds ns_late) {- Lock();+ const auto guard = Lock();Compose();const auto ticks = std::chrono::nanoseconds{GetNextTicks()};diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.hindex e4959a9afc..0be55e442a 100644--- a/src/core/hle/service/nvflinger/nvflinger.h+++ b/src/core/hle/service/nvflinger/nvflinger.h@@ -86,7 +86,7 @@ public:s64 GetNextTicks() const;- std::unique_lock<std::mutex> Lock() {+ std::unique_lock<std::mutex> Lock() const {return std::unique_lock{*guard};}diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cppindex ea7b4ae13c..825d11a3fd 100644--- a/src/core/hle/service/vi/vi.cpp+++ b/src/core/hle/service/vi/vi.cpp@@ -511,7 +511,7 @@ private:LOG_DEBUG(Service_VI, "called. id=0x{:08X} transaction={:X}, flags=0x{:08X}", id,static_cast<u32>(transaction), flags);- nv_flinger->Lock();+ const auto guard = nv_flinger->Lock();auto& buffer_queue = nv_flinger->FindBufferQueue(id);switch (transaction) {@@ -551,7 +551,7 @@ private:[=](std::shared_ptr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx,Kernel::ThreadWakeupReason reason) {// Repeat TransactParcel DequeueBuffer when a buffer is available- nv_flinger->Lock();+ const auto guard = nv_flinger->Lock();auto& buffer_queue = nv_flinger->FindBufferQueue(id);auto result = buffer_queue.DequeueBuffer(width, height);ASSERT_MSG(result != std::nullopt, "Could not dequeue buffer.");