From f89bacf8ae2fc301978cace1f9ff678ad54a5d7a Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 11 May 2022 22:04:02 +0100 Subject: [PATCH] Fixup Host1x syncpoint locking --- app/src/main/cpp/skyline/soc/host1x/command_fifo.cpp | 2 +- .../main/cpp/skyline/soc/host1x/tegra_host_interface.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/skyline/soc/host1x/command_fifo.cpp b/app/src/main/cpp/skyline/soc/host1x/command_fifo.cpp index 1f7046e1..705151bd 100644 --- a/app/src/main/cpp/skyline/soc/host1x/command_fifo.cpp +++ b/app/src/main/cpp/skyline/soc/host1x/command_fifo.cpp @@ -76,7 +76,7 @@ namespace skyline::soc::host1x { case Host1xOpcode::SetClass: targetClass = methodHeader.classId; - for (u32 i{}; i < std::numeric_limits::max(); i++) + for (u32 i{}; i < std::numeric_limits::digits; i++) if (methodHeader.classMethodMask & (1 << i)) Send(targetClass, methodHeader.methodAddress + i, *++entry); diff --git a/app/src/main/cpp/skyline/soc/host1x/tegra_host_interface.h b/app/src/main/cpp/skyline/soc/host1x/tegra_host_interface.h index 563eba48..97f50fa9 100644 --- a/app/src/main/cpp/skyline/soc/host1x/tegra_host_interface.h +++ b/app/src/main/cpp/skyline/soc/host1x/tegra_host_interface.h @@ -23,6 +23,11 @@ namespace skyline::soc::host1x { std::queue incrQueue; //!< Queue of syncpoint IDs to be incremented when a device operation is finished, the same syncpoint may be held multiple times within the queue std::mutex incrMutex; + void AddIncr(u32 syncpointId) { + std::scoped_lock lock(incrMutex); + incrQueue.push(syncpointId); + } + void SubmitPendingIncrs() { std::scoped_lock lock(incrMutex); @@ -55,9 +60,9 @@ namespace skyline::soc::host1x { break; case IncrementSyncpointMethod::Condition::OpDone: Logger::Debug("Queue syncpoint for OpDone: {}", incrSyncpoint.index); - incrQueue.push(incrSyncpoint.index); - + AddIncr(incrSyncpoint.index); SubmitPendingIncrs(); // FIXME: immediately submit the incrs as classes are not yet implemented + break; default: Logger::Warn("Unimplemented syncpoint condition: {}", static_cast(incrSyncpoint.condition)); break;