summaryrefslogtreecommitdiff
path: root/src/core/hle/service/nvdrv
diff options
context:
space:
mode:
authorGravatar Liam2024-02-14 11:39:42 -0500
committerGravatar Liam2024-02-17 18:01:41 -0500
commitee8eccc5fa473f2ce210eb4e242e8eca40594db7 (patch)
tree5c38fc738e52be88eddd7733e0fdeb248ef4783f /src/core/hle/service/nvdrv
parentam: unify display layer management (diff)
downloadyuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.tar.gz
yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.tar.xz
yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.zip
nvnflinger: convert to process
Diffstat (limited to 'src/core/hle/service/nvdrv')
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp3
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.cpp6
-rw-r--r--src/core/hle/service/nvdrv/nvdrv_interface.h4
4 files changed, 10 insertions, 5 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index cb256e5b4..03eb507b9 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -42,7 +42,7 @@ void EventInterface::FreeEvent(Kernel::KEvent* event) {
42 module.service_context.CloseEvent(event); 42 module.service_context.CloseEvent(event);
43} 43}
44 44
45void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) { 45void LoopProcess(Core::System& system) {
46 auto server_manager = std::make_unique<ServerManager>(system); 46 auto server_manager = std::make_unique<ServerManager>(system);
47 auto module = std::make_shared<Module>(system); 47 auto module = std::make_shared<Module>(system);
48 const auto NvdrvInterfaceFactoryForApplication = [&, module] { 48 const auto NvdrvInterfaceFactoryForApplication = [&, module] {
@@ -62,7 +62,6 @@ void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
62 server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules); 62 server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
63 server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting); 63 server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting);
64 server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system)); 64 server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
65 nvnflinger.SetNVDrvInstance(module);
66 ServerManager::RunServer(std::move(server_manager)); 65 ServerManager::RunServer(std::move(server_manager));
67} 66}
68 67
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index c594f0e5e..154c38951 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -118,6 +118,6 @@ private:
118 std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders; 118 std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
119}; 119};
120 120
121void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system); 121void LoopProcess(Core::System& system);
122 122
123} // namespace Service::Nvidia 123} // namespace Service::Nvidia
diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.cpp b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
index ffe72f281..241006cc8 100644
--- a/src/core/hle/service/nvdrv/nvdrv_interface.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.cpp
@@ -263,8 +263,10 @@ NVDRV::NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char*
263} 263}
264 264
265NVDRV::~NVDRV() { 265NVDRV::~NVDRV() {
266 auto& container = nvdrv->GetContainer(); 266 if (is_initialized) {
267 container.CloseSession(session_id); 267 auto& container = nvdrv->GetContainer();
268 container.CloseSession(session_id);
269 }
268} 270}
269 271
270} // namespace Service::Nvidia 272} // namespace Service::Nvidia
diff --git a/src/core/hle/service/nvdrv/nvdrv_interface.h b/src/core/hle/service/nvdrv/nvdrv_interface.h
index f2195ae1e..c72f92597 100644
--- a/src/core/hle/service/nvdrv/nvdrv_interface.h
+++ b/src/core/hle/service/nvdrv/nvdrv_interface.h
@@ -16,6 +16,10 @@ public:
16 explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name); 16 explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name);
17 ~NVDRV() override; 17 ~NVDRV() override;
18 18
19 std::shared_ptr<Module> GetModule() const {
20 return nvdrv;
21 }
22
19private: 23private:
20 void Open(HLERequestContext& ctx); 24 void Open(HLERequestContext& ctx);
21 void Ioctl1(HLERequestContext& ctx); 25 void Ioctl1(HLERequestContext& ctx);