2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

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:
Subv 2018-01-22 13:40:02 -05:00
parent 7f19a7d305
commit 42859461f3
5 changed files with 13 additions and 7 deletions

View file

@ -165,6 +165,10 @@ void AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
/// Initialize ServiceManager
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::ServiceManager::InstallInterfaces(SM::g_service_manager);
@ -180,7 +184,7 @@ void Init() {
PCTL::InstallInterfaces(*SM::g_service_manager);
Sockets::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);
LOG_DEBUG(Service, "initialized OK");

View file

@ -753,8 +753,9 @@ IApplicationDisplayService::IApplicationDisplayService(
RegisterHandlers(functions);
}
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<VI_M>()->InstallAsService(service_manager);
void InstallInterfaces(SM::ServiceManager& service_manager,
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) {
std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager);
}
} // namespace VI

View file

@ -39,7 +39,8 @@ private:
};
/// 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 Service

View file

@ -17,13 +17,13 @@ void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
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[] = {
{2, &VI_M::GetDisplayService, "GetDisplayService"},
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
};
RegisterHandlers(functions);
nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
}
} // namespace VI

View file

@ -16,7 +16,7 @@ namespace VI {
class VI_M final : public ServiceFramework<VI_M> {
public:
VI_M();
VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
~VI_M() = default;
private: