summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-04 09:56:09 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:50 +0200
commitaddc0bf0379e075786048921bede6e089552a6db (patch)
tree7fa8819b52db29e1b354410441dd8f2438e2ed4a /src/core/hle/service/nvdrv
parenthle: kernel: Migrate KSharedMemory to KAutoObject. (diff)
downloadyuzu-addc0bf0379e075786048921bede6e089552a6db.tar
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.gz
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.bz2
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.lz
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.xz
yuzu-addc0bf0379e075786048921bede6e089552a6db.tar.zst
yuzu-addc0bf0379e075786048921bede6e089552a6db.zip
Diffstat (limited to 'src/core/hle/service/nvdrv')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp12
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 6f4007294..e99da24ab 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -102,7 +102,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
return NvResult::Success;
}
- auto event = events_interface.events[event_id];
+ auto& event = events_interface.events[event_id];
auto& gpu = system.GPU();
// This is mostly to take into account unimplemented features. As synced
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 6bba9c0b3..74399bcdb 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -42,9 +42,8 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
Module::Module(Core::System& system) : syncpoint_manager{system.GPU()} {
auto& kernel = system.Kernel();
for (u32 i = 0; i < MaxNvEvents; i++) {
- std::string event_label = fmt::format("NVDRV::NvEvent_{}", i);
- events_interface.events[i] = {Kernel::KEvent::Create(kernel, std::move(event_label))};
- events_interface.events[i].event->Initialize();
+ events_interface.events[i].event = std::make_unique<Kernel::KEvent>(kernel);
+ events_interface.events[i].event->Initialize(fmt::format("NVDRV::NvEvent_{}", i));
events_interface.status[i] = EventState::Free;
events_interface.registered[i] = false;
}
@@ -64,7 +63,12 @@ Module::Module(Core::System& system) : syncpoint_manager{system.GPU()} {
std::make_shared<Devices::nvhost_vic>(system, nvmap_dev, syncpoint_manager);
}
-Module::~Module() = default;
+Module::~Module() {
+ for (u32 i = 0; i < MaxNvEvents; i++) {
+ events_interface.events[i].event->Close();
+ events_interface.events[i].event = nullptr;
+ }
+}
NvResult Module::VerifyFD(DeviceFD fd) const {
if (fd < 0) {
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 53719aadd..76f77cbb1 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -35,7 +35,7 @@ class nvdevice;
/// Represents an Nvidia event
struct NvEvent {
- std::shared_ptr<Kernel::KEvent> event;
+ std::unique_ptr<Kernel::KEvent> event;
Fence fence{};
};