diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-08-07 09:17:09 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-08-07 21:53:05 -0400 |
| commit | d378d98e2628f83fa56242ec6b53e3cce7c6bb56 (patch) | |
| tree | c50db5a6d7840f493d970ba449aa7010124e9a88 /src/core/hle/service/nvdrv | |
| parent | 825e8cb9252cdffd3f150ef667ecb95655ab0696 (diff) | |
nvdrv: Get rid of global std::weak_ptr
Rather than use global state, we can simply pass the instance into the
NVFlinger instance directly.
Diffstat (limited to 'src/core/hle/service/nvdrv')
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index e8b30921a..427f4b574 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -16,19 +16,18 @@ #include "core/hle/service/nvdrv/interface.h" #include "core/hle/service/nvdrv/nvdrv.h" #include "core/hle/service/nvdrv/nvmemp.h" +#include "core/hle/service/nvflinger/nvflinger.h" namespace Service::Nvidia { -std::weak_ptr<Module> nvdrv; - -void InstallInterfaces(SM::ServiceManager& service_manager) { +void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger) { auto module_ = std::make_shared<Module>(); std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager); std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager); std::make_shared<NVDRV>(module_, "nvdrv:s")->InstallAsService(service_manager); std::make_shared<NVDRV>(module_, "nvdrv:t")->InstallAsService(service_manager); std::make_shared<NVMEMP>()->InstallAsService(service_manager); - nvdrv = module_; + nvflinger.SetNVDrvInstance(module_); } Module::Module() { diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index 184f3c9fc..99eb1128a 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -10,6 +10,10 @@ #include "common/common_types.h" #include "core/hle/service/service.h" +namespace Service::NVFlinger { +class NVFlinger; +} + namespace Service::Nvidia { namespace Devices { @@ -56,8 +60,6 @@ private: }; /// Registers all NVDRV services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager); - -extern std::weak_ptr<Module> nvdrv; +void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger); } // namespace Service::Nvidia |
