diff options
| author | 2021-11-05 02:57:14 +0100 | |
|---|---|---|
| committer | 2022-10-06 21:00:51 +0200 | |
| commit | ad038609c877ad54dde7b9592f0584deb56a27c5 (patch) | |
| tree | 1588b1ae2babbf23d40cd1105d02edbaec42e04f | |
| parent | NVMAP: Fix the Free return parameters. (diff) | |
| download | yuzu-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.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 3 |
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 { | |||
| 24 | nvhost_ctrl::nvhost_ctrl(Core::System& system_, EventInterface& events_interface_, | 24 | nvhost_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 | ||
| 31 | nvhost_ctrl::~nvhost_ctrl() { | 29 | nvhost_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 | ||
| 80 | void nvhost_ctrl::OnOpen(DeviceFD fd) {} | 77 | void nvhost_ctrl::OnOpen(DeviceFD fd) { |
| 81 | void nvhost_ctrl::OnClose(DeviceFD fd) {} | 78 | events_interface.RegisterForSignal(this); |
| 79 | } | ||
| 80 | void nvhost_ctrl::OnClose(DeviceFD fd) { | ||
| 81 | events_interface.UnregisterForSignal(this); | ||
| 82 | } | ||
| 82 | 83 | ||
| 83 | NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { | 84 | NvResult 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 | ||
| 30 | namespace Service::Nvidia { | 30 | namespace Service::Nvidia { |
| 31 | 31 | ||
| 32 | EventInterface::EventInterface(Module& module_) : module{module_} {} | 32 | EventInterface::EventInterface(Module& module_) : module{module_}, guard{}, on_signal{} {} |
| 33 | 33 | ||
| 34 | EventInterface::~EventInterface() = default; | 34 | EventInterface::~EventInterface() = default; |
| 35 | 35 | ||
| @@ -40,10 +40,7 @@ void EventInterface::RegisterForSignal(Devices::nvhost_ctrl* device) { | |||
| 40 | 40 | ||
| 41 | void EventInterface::UnregisterForSignal(Devices::nvhost_ctrl* device) { | 41 | void 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 | ||
| 49 | void EventInterface::Signal(u32 syncpoint_id, u32 value) { | 46 | void 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; |