summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvdrv/core/syncpoint_manager.cpp46
-rw-r--r--src/core/hle/service/nvdrv/core/syncpoint_manager.h2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp44
3 files changed, 49 insertions, 43 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..aba51d280 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,11 +58,12 @@ 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) {
+bool SyncpointManager::IsSyncpointAllocated(u32 id) const {
return (id <= SyncpointCount) && syncpoints[id].reserved;
}
@@ -69,7 +72,7 @@ bool SyncpointManager::HasSyncpointExpired(u32 id, u32 threshold) const {
if (!syncpoint.reserved) {
ASSERT(false);
- return 0;
+ return false;
}
// If the interface manages counters then we don't keep track of the maximum value as it handles
@@ -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
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.h b/src/core/hle/service/nvdrv/core/syncpoint_manager.h
index b76ef9032..4f2cefae5 100644
--- a/src/core/hle/service/nvdrv/core/syncpoint_manager.h
+++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.h
@@ -44,7 +44,7 @@ public:
/**
* @brief Checks if the given syncpoint is both allocated and below the number of HW syncpoints
*/
- bool IsSyncpointAllocated(u32 id);
+ bool IsSyncpointAllocated(u32 id) const;
/**
* @brief Finds a free syncpoint and reserves it
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 9f4c7c99a..6fc8565c0 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -55,48 +55,40 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
Module::Module(Core::System& system)
: container{system.Host1x()}, service_context{system, "nvdrv"}, events_interface{*this} {
builders["/dev/nvhost-as-gpu"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvhost_as_gpu>(system, *this, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_as_gpu>(system, *this, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvhost-gpu"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvhost_gpu>(system, events_interface, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_gpu>(system, events_interface, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvhost-ctrl-gpu"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvhost_ctrl_gpu>(system, events_interface);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_ctrl_gpu>(system, events_interface);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvmap"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvmap>(system, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvmap>(system, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvdisp_disp0"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvdisp_disp0>(system, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvdisp_disp0>(system, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvhost-ctrl"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvhost_ctrl>(system, events_interface, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_ctrl>(system, events_interface, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvhost-nvdec"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvhost_nvdec>(system, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_nvdec>(system, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvhost-nvjpg"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device = std::make_shared<Devices::nvhost_nvjpg>(system);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_nvjpg>(system);
+ return open_files.emplace(fd, std::move(device)).first;
};
builders["/dev/nvhost-vic"] = [this, &system](DeviceFD fd) {
- std::shared_ptr<Devices::nvdevice> device =
- std::make_shared<Devices::nvhost_vic>(system, container);
- return open_files.emplace(fd, device).first;
+ auto device = std::make_shared<Devices::nvhost_vic>(system, container);
+ return open_files.emplace(fd, std::move(device)).first;
};
}