summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-01-22 13:40:02 -0500
committerGravatar Subv2018-01-22 13:40:02 -0500
commit42859461f3d6db8ea64facdf388d4791f713c7b1 (patch)
tree379f83f27aa9718926733bf3e8c9e10cfd50b409 /src
parentMerge pull request #132 from Subv/nvflinger (diff)
downloadyuzu-42859461f3d6db8ea64facdf388d4791f713c7b1.tar.gz
yuzu-42859461f3d6db8ea64facdf388d4791f713c7b1.tar.xz
yuzu-42859461f3d6db8ea64facdf388d4791f713c7b1.zip
Services: Vi shouldn't be responsible for creating nvflinger.
It is now created during Service initialization and passed to all the services that need it.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/core/hle/service/vi/vi.cpp5
-rw-r--r--src/core/hle/service/vi/vi.h3
-rw-r--r--src/core/hle/service/vi/vi_m.cpp4
-rw-r--r--src/core/hle/service/vi/vi_m.h2
5 files changed, 13 insertions, 7 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 3f5ce56c6..403cce8e5 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -165,6 +165,10 @@ void AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
165 165
166/// Initialize ServiceManager 166/// Initialize ServiceManager
167void Init() { 167void Init() {
168 // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it
169 // here and pass it into the respective InstallInterfaces functions.
170 auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
171
168 SM::g_service_manager = std::make_shared<SM::ServiceManager>(); 172 SM::g_service_manager = std::make_shared<SM::ServiceManager>();
169 SM::ServiceManager::InstallInterfaces(SM::g_service_manager); 173 SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
170 174
@@ -180,7 +184,7 @@ void Init() {
180 PCTL::InstallInterfaces(*SM::g_service_manager); 184 PCTL::InstallInterfaces(*SM::g_service_manager);
181 Sockets::InstallInterfaces(*SM::g_service_manager); 185 Sockets::InstallInterfaces(*SM::g_service_manager);
182 Time::InstallInterfaces(*SM::g_service_manager); 186 Time::InstallInterfaces(*SM::g_service_manager);
183 VI::InstallInterfaces(*SM::g_service_manager); 187 VI::InstallInterfaces(*SM::g_service_manager, nv_flinger);
184 Set::InstallInterfaces(*SM::g_service_manager); 188 Set::InstallInterfaces(*SM::g_service_manager);
185 189
186 LOG_DEBUG(Service, "initialized OK"); 190 LOG_DEBUG(Service, "initialized OK");
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index e0bfad290..6576f81db 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -753,8 +753,9 @@ IApplicationDisplayService::IApplicationDisplayService(
753 RegisterHandlers(functions); 753 RegisterHandlers(functions);
754} 754}
755 755
756void InstallInterfaces(SM::ServiceManager& service_manager) { 756void InstallInterfaces(SM::ServiceManager& service_manager,
757 std::make_shared<VI_M>()->InstallAsService(service_manager); 757 std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) {
758 std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager);
758} 759}
759 760
760} // namespace VI 761} // namespace VI
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 5e9b7e6cf..a6e084f87 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -39,7 +39,8 @@ private:
39}; 39};
40 40
41/// Registers all VI services with the specified service manager. 41/// Registers all VI services with the specified service manager.
42void InstallInterfaces(SM::ServiceManager& service_manager); 42void InstallInterfaces(SM::ServiceManager& service_manager,
43 std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
43 44
44} // namespace VI 45} // namespace VI
45} // namespace Service 46} // namespace Service
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 6deedf842..20b24658e 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -17,13 +17,13 @@ void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
17 rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); 17 rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
18} 18}
19 19
20VI_M::VI_M() : ServiceFramework("vi:m") { 20VI_M::VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger)
21 : ServiceFramework("vi:m"), nv_flinger(std::move(nv_flinger)) {
21 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
22 {2, &VI_M::GetDisplayService, "GetDisplayService"}, 23 {2, &VI_M::GetDisplayService, "GetDisplayService"},
23 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 24 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
24 }; 25 };
25 RegisterHandlers(functions); 26 RegisterHandlers(functions);
26 nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
27} 27}
28 28
29} // namespace VI 29} // namespace VI
diff --git a/src/core/hle/service/vi/vi_m.h b/src/core/hle/service/vi/vi_m.h
index ebe79d5c7..e5319b1e7 100644
--- a/src/core/hle/service/vi/vi_m.h
+++ b/src/core/hle/service/vi/vi_m.h
@@ -16,7 +16,7 @@ namespace VI {
16 16
17class VI_M final : public ServiceFramework<VI_M> { 17class VI_M final : public ServiceFramework<VI_M> {
18public: 18public:
19 VI_M(); 19 VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
20 ~VI_M() = default; 20 ~VI_M() = default;
21 21
22private: 22private: