summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2022-11-28 22:05:59 +0100
committerLioncash <mathew1800@gmail.com>2022-11-28 22:06:01 +0100
commitd0883027d60c0d6d289e23900972cfa067fc9c54 (patch)
treed8d6fef49b726db0bbb0e60f1f3eb1843f7311c3 /src/core/hle/service
parentMerge pull request #9325 from german77/default_by_default (diff)
downloadyuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.tar
yuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.tar.gz
yuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.tar.bz2
yuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.tar.lz
yuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.tar.xz
yuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.tar.zst
yuzu-d0883027d60c0d6d289e23900972cfa067fc9c54.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvdrv/core/syncpoint_manager.cpp42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp
index eda2041a0..8d14116d5 100644
--- a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp
+++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp
@@ -28,13 +28,15 @@ SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host
SyncpointManager::~SyncpointManager() = default;
u32 SyncpointManager::ReserveSyncpoint(u32 id, bool client_managed) {
- if (syncpoints.at(id).reserved) {
+ auto& syncpoint = syncpoints.at(id);
+
+ if (syncpoint.reserved) {
ASSERT_MSG(false, "Requested syncpoint is in use");
return 0;
}
- syncpoints.at(id).reserved = true;
- syncpoints.at(id).interface_managed = client_managed;
+ syncpoint.reserved = true;
+ syncpoint.interface_managed = client_managed;
return id;
}
@@ -56,8 +58,9 @@ u32 SyncpointManager::AllocateSyncpoint(bool client_managed) {
void SyncpointManager::FreeSyncpoint(u32 id) {
std::lock_guard lock(reservation_lock);
- ASSERT(syncpoints.at(id).reserved);
- syncpoints.at(id).reserved = false;
+ auto& syncpoint = syncpoints.at(id);
+ ASSERT(syncpoint.reserved);
+ syncpoint.reserved = false;
}
bool SyncpointManager::IsSyncpointAllocated(u32 id) {
@@ -82,40 +85,51 @@ bool SyncpointManager::HasSyncpointExpired(u32 id, u32 threshold) const {
}
u32 SyncpointManager::IncrementSyncpointMaxExt(u32 id, u32 amount) {
- if (!syncpoints.at(id).reserved) {
+ auto& syncpoint = syncpoints.at(id);
+
+ if (!syncpoint.reserved) {
ASSERT(false);
return 0;
}
- return syncpoints.at(id).counter_max += amount;
+ return syncpoint.counter_max += amount;
}
u32 SyncpointManager::ReadSyncpointMinValue(u32 id) {
- if (!syncpoints.at(id).reserved) {
+ auto& syncpoint = syncpoints.at(id);
+
+ if (!syncpoint.reserved) {
ASSERT(false);
return 0;
}
- return syncpoints.at(id).counter_min;
+ return syncpoint.counter_min;
}
u32 SyncpointManager::UpdateMin(u32 id) {
- if (!syncpoints.at(id).reserved) {
+ auto& syncpoint = syncpoints.at(id);
+
+ if (!syncpoint.reserved) {
ASSERT(false);
return 0;
}
- syncpoints.at(id).counter_min = host1x.GetSyncpointManager().GetHostSyncpointValue(id);
- return syncpoints.at(id).counter_min;
+ syncpoint.counter_min = host1x.GetSyncpointManager().GetHostSyncpointValue(id);
+ return syncpoint.counter_min;
}
NvFence SyncpointManager::GetSyncpointFence(u32 id) {
- if (!syncpoints.at(id).reserved) {
+ auto& syncpoint = syncpoints.at(id);
+
+ if (!syncpoint.reserved) {
ASSERT(false);
return NvFence{};
}
- return {.id = static_cast<s32>(id), .value = syncpoints.at(id).counter_max};
+ return {
+ .id = static_cast<s32>(id),
+ .value = syncpoint.counter_max,
+ };
}
} // namespace Service::Nvidia::NvCore