diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-05 02:57:14 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-10-06 21:00:51 +0200 |
commit | ad038609c877ad54dde7b9592f0584deb56a27c5 (patch) | |
tree | 1588b1ae2babbf23d40cd1105d02edbaec42e04f /src/core/hle/service/nvdrv | |
parent | NVMAP: Fix the Free return parameters. (diff) | |
download | yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.gz yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.bz2 yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.lz yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.xz yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.tar.zst yuzu-ad038609c877ad54dde7b9592f0584deb56a27c5.zip |
Diffstat (limited to 'src/core/hle/service/nvdrv')
-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 { nvhost_ctrl::nvhost_ctrl(Core::System& system_, EventInterface& events_interface_, NvCore::Container& core_) : nvdevice{system_}, events_interface{events_interface_}, core{core_}, - syncpoint_manager{core_.GetSyncpointManager()} { - events_interface.RegisterForSignal(this); -} + syncpoint_manager{core_.GetSyncpointManager()} {} nvhost_ctrl::~nvhost_ctrl() { - events_interface.UnregisterForSignal(this); for (auto& event : events) { if (!event.registered) { continue; @@ -77,8 +74,12 @@ NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& return NvResult::NotImplemented; } -void nvhost_ctrl::OnOpen(DeviceFD fd) {} -void nvhost_ctrl::OnClose(DeviceFD fd) {} +void nvhost_ctrl::OnOpen(DeviceFD fd) { + events_interface.RegisterForSignal(this); +} +void nvhost_ctrl::OnClose(DeviceFD fd) { + events_interface.UnregisterForSignal(this); +} NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { 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 @@ namespace Service::Nvidia { -EventInterface::EventInterface(Module& module_) : module{module_} {} +EventInterface::EventInterface(Module& module_) : module{module_}, guard{}, on_signal{} {} EventInterface::~EventInterface() = default; @@ -40,10 +40,7 @@ void EventInterface::RegisterForSignal(Devices::nvhost_ctrl* device) { void EventInterface::UnregisterForSignal(Devices::nvhost_ctrl* device) { std::unique_lock<std::mutex> lk(guard); - auto it = std::find(on_signal.begin(), on_signal.end(), device); - if (it != on_signal.end()) { - on_signal.erase(it); - } + on_signal.remove(device); } 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: /// Mapping of file descriptors to the devices they reference. FilesContainerType open_files; - /// Mapping of device node names to their implementation. - std::unordered_map<std::string, std::shared_ptr<Devices::nvdevice>> devices; - KernelHelpers::ServiceContext service_context; EventInterface events_interface; |