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.
This commit is contained in:
parent
7f19a7d305
commit
42859461f3
|
@ -165,6 +165,10 @@ void AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
|
||||||
|
|
||||||
/// Initialize ServiceManager
|
/// Initialize ServiceManager
|
||||||
void Init() {
|
void Init() {
|
||||||
|
// NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it
|
||||||
|
// here and pass it into the respective InstallInterfaces functions.
|
||||||
|
auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
|
||||||
|
|
||||||
SM::g_service_manager = std::make_shared<SM::ServiceManager>();
|
SM::g_service_manager = std::make_shared<SM::ServiceManager>();
|
||||||
SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
|
SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
|
||||||
|
|
||||||
|
@ -180,7 +184,7 @@ void Init() {
|
||||||
PCTL::InstallInterfaces(*SM::g_service_manager);
|
PCTL::InstallInterfaces(*SM::g_service_manager);
|
||||||
Sockets::InstallInterfaces(*SM::g_service_manager);
|
Sockets::InstallInterfaces(*SM::g_service_manager);
|
||||||
Time::InstallInterfaces(*SM::g_service_manager);
|
Time::InstallInterfaces(*SM::g_service_manager);
|
||||||
VI::InstallInterfaces(*SM::g_service_manager);
|
VI::InstallInterfaces(*SM::g_service_manager, nv_flinger);
|
||||||
Set::InstallInterfaces(*SM::g_service_manager);
|
Set::InstallInterfaces(*SM::g_service_manager);
|
||||||
|
|
||||||
LOG_DEBUG(Service, "initialized OK");
|
LOG_DEBUG(Service, "initialized OK");
|
||||||
|
|
|
@ -753,8 +753,9 @@ IApplicationDisplayService::IApplicationDisplayService(
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
void InstallInterfaces(SM::ServiceManager& service_manager,
|
||||||
std::make_shared<VI_M>()->InstallAsService(service_manager);
|
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) {
|
||||||
|
std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VI
|
} // namespace VI
|
||||||
|
|
|
@ -39,7 +39,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all VI services with the specified service manager.
|
/// Registers all VI services with the specified service manager.
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager);
|
void InstallInterfaces(SM::ServiceManager& service_manager,
|
||||||
|
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
|
||||||
|
|
||||||
} // namespace VI
|
} // namespace VI
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
|
|
@ -17,13 +17,13 @@ void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
|
||||||
rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
|
rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
|
||||||
}
|
}
|
||||||
|
|
||||||
VI_M::VI_M() : ServiceFramework("vi:m") {
|
VI_M::VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger)
|
||||||
|
: ServiceFramework("vi:m"), nv_flinger(std::move(nv_flinger)) {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
||||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||||
};
|
};
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VI
|
} // namespace VI
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace VI {
|
||||||
|
|
||||||
class VI_M final : public ServiceFramework<VI_M> {
|
class VI_M final : public ServiceFramework<VI_M> {
|
||||||
public:
|
public:
|
||||||
VI_M();
|
VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
|
||||||
~VI_M() = default;
|
~VI_M() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue