summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2021-11-05 02:57:14 +0100
committerGravatar Fernando Sahmkow2022-10-06 21:00:51 +0200
commitad038609c877ad54dde7b9592f0584deb56a27c5 (patch)
tree1588b1ae2babbf23d40cd1105d02edbaec42e04f
parentNVMAP: Fix the Free return parameters. (diff)
downloadyuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.gz
yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.xz
yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.zip
NVDRV: Fix clearing when destroying.
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp13
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp7
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h3
3 files changed, 9 insertions, 14 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 122c1d5e1..abde2a6d3 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -24,12 +24,9 @@ namespace Service::Nvidia::Devices {
24nvhost_ctrl::nvhost_ctrl(Core::System& system_, EventInterface& events_interface_, 24nvhost_ctrl::nvhost_ctrl(Core::System& system_, EventInterface& events_interface_,
25 NvCore::Container& core_) 25 NvCore::Container& core_)
26 : nvdevice{system_}, events_interface{events_interface_}, core{core_}, 26 : nvdevice{system_}, events_interface{events_interface_}, core{core_},
27 syncpoint_manager{core_.GetSyncpointManager()} { 27 syncpoint_manager{core_.GetSyncpointManager()} {}
28 events_interface.RegisterForSignal(this);
29}
30 28
31nvhost_ctrl::~nvhost_ctrl() { 29nvhost_ctrl::~nvhost_ctrl() {
32 events_interface.UnregisterForSignal(this);
33 for (auto& event : events) { 30 for (auto& event : events) {
34 if (!event.registered) { 31 if (!event.registered) {
35 continue; 32 continue;
@@ -77,8 +74,12 @@ NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>&
77 return NvResult::NotImplemented; 74 return NvResult::NotImplemented;
78} 75}
79 76
80void nvhost_ctrl::OnOpen(DeviceFD fd) {} 77void nvhost_ctrl::OnOpen(DeviceFD fd) {
81void nvhost_ctrl::OnClose(DeviceFD fd) {} 78 events_interface.RegisterForSignal(this);
79}
80void nvhost_ctrl::OnClose(DeviceFD fd) {
81 events_interface.UnregisterForSignal(this);
82}
82 83
83NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { 84NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
84 IocGetConfigParams params{}; 85 IocGetConfigParams params{};
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index ff8c7c13c..208de0b75 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -29,7 +29,7 @@
29 29
30namespace Service::Nvidia { 30namespace Service::Nvidia {
31 31
32EventInterface::EventInterface(Module& module_) : module{module_} {} 32EventInterface::EventInterface(Module& module_) : module{module_}, guard{}, on_signal{} {}
33 33
34EventInterface::~EventInterface() = default; 34EventInterface::~EventInterface() = default;
35 35
@@ -40,10 +40,7 @@ void EventInterface::RegisterForSignal(Devices::nvhost_ctrl* device) {
40 40
41void EventInterface::UnregisterForSignal(Devices::nvhost_ctrl* device) { 41void EventInterface::UnregisterForSignal(Devices::nvhost_ctrl* device) {
42 std::unique_lock<std::mutex> lk(guard); 42 std::unique_lock<std::mutex> lk(guard);
43 auto it = std::find(on_signal.begin(), on_signal.end(), device); 43 on_signal.remove(device);
44 if (it != on_signal.end()) {
45 on_signal.erase(it);
46 }
47} 44}
48 45
49void EventInterface::Signal(u32 syncpoint_id, u32 value) { 46void EventInterface::Signal(u32 syncpoint_id, u32 value) {
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 3983794bb..1fe98cf32 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -110,9 +110,6 @@ private:
110 /// Mapping of file descriptors to the devices they reference. 110 /// Mapping of file descriptors to the devices they reference.
111 FilesContainerType open_files; 111 FilesContainerType open_files;
112 112
113 /// Mapping of device node names to their implementation.
114 std::unordered_map<std::string, std::shared_ptr<Devices::nvdevice>> devices;
115
116 KernelHelpers::ServiceContext service_context; 113 KernelHelpers::ServiceContext service_context;
117 114
118 EventInterface events_interface; 115 EventInterface events_interface;