service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the services code by passing in the using system instance to the services.
This commit is contained in:
parent
322349e8cc
commit
1a954b2a59
222 changed files with 1221 additions and 907 deletions
|
@ -492,8 +492,8 @@ private:
|
|||
|
||||
class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
|
||||
public:
|
||||
explicit IHOSBinderDriver(NVFlinger::NVFlinger& nv_flinger)
|
||||
: ServiceFramework("IHOSBinderDriver"), nv_flinger(nv_flinger) {
|
||||
explicit IHOSBinderDriver(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
|
||||
: ServiceFramework{system_, "IHOSBinderDriver"}, nv_flinger(nv_flinger_) {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &IHOSBinderDriver::TransactParcel, "TransactParcel"},
|
||||
{1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"},
|
||||
|
@ -689,7 +689,8 @@ private:
|
|||
|
||||
class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
|
||||
public:
|
||||
explicit ISystemDisplayService() : ServiceFramework("ISystemDisplayService") {
|
||||
explicit ISystemDisplayService(Core::System& system_)
|
||||
: ServiceFramework{system_, "ISystemDisplayService"} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{1200, nullptr, "GetZOrderCountMin"},
|
||||
{1202, nullptr, "GetZOrderCountMax"},
|
||||
|
@ -790,8 +791,8 @@ private:
|
|||
|
||||
class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
|
||||
public:
|
||||
explicit IManagerDisplayService(NVFlinger::NVFlinger& nv_flinger)
|
||||
: ServiceFramework("IManagerDisplayService"), nv_flinger(nv_flinger) {
|
||||
explicit IManagerDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
|
||||
: ServiceFramework{system_, "IManagerDisplayService"}, nv_flinger{nv_flinger_} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{200, nullptr, "AllocateProcessHeapBlock"},
|
||||
|
@ -935,7 +936,7 @@ private:
|
|||
|
||||
class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
|
||||
public:
|
||||
explicit IApplicationDisplayService(NVFlinger::NVFlinger& nv_flinger);
|
||||
explicit IApplicationDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
|
||||
|
||||
private:
|
||||
enum class ConvertedScaleMode : u64 {
|
||||
|
@ -959,7 +960,7 @@ private:
|
|||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger);
|
||||
rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger);
|
||||
}
|
||||
|
||||
void GetSystemDisplayService(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -967,7 +968,7 @@ private:
|
|||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<ISystemDisplayService>();
|
||||
rb.PushIpcInterface<ISystemDisplayService>(system);
|
||||
}
|
||||
|
||||
void GetManagerDisplayService(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -975,7 +976,7 @@ private:
|
|||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IManagerDisplayService>(nv_flinger);
|
||||
rb.PushIpcInterface<IManagerDisplayService>(system, nv_flinger);
|
||||
}
|
||||
|
||||
void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -983,7 +984,7 @@ private:
|
|||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger);
|
||||
rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger);
|
||||
}
|
||||
|
||||
void OpenDisplay(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -1261,8 +1262,9 @@ private:
|
|||
NVFlinger::NVFlinger& nv_flinger;
|
||||
};
|
||||
|
||||
IApplicationDisplayService::IApplicationDisplayService(NVFlinger::NVFlinger& nv_flinger)
|
||||
: ServiceFramework("IApplicationDisplayService"), nv_flinger(nv_flinger) {
|
||||
IApplicationDisplayService::IApplicationDisplayService(Core::System& system_,
|
||||
NVFlinger::NVFlinger& nv_flinger_)
|
||||
: ServiceFramework{system_, "IApplicationDisplayService"}, nv_flinger{nv_flinger_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{100, &IApplicationDisplayService::GetRelayService, "GetRelayService"},
|
||||
{101, &IApplicationDisplayService::GetSystemDisplayService, "GetSystemDisplayService"},
|
||||
|
@ -1303,8 +1305,8 @@ static bool IsValidServiceAccess(Permission permission, Policy policy) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NVFlinger& nv_flinger,
|
||||
Permission permission) {
|
||||
void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system,
|
||||
NVFlinger::NVFlinger& nv_flinger, Permission permission) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto policy = rp.PopEnum<Policy>();
|
||||
|
||||
|
@ -1317,13 +1319,14 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NV
|
|||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
|
||||
rb.PushIpcInterface<IApplicationDisplayService>(system, nv_flinger);
|
||||
}
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nv_flinger) {
|
||||
std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager);
|
||||
std::make_shared<VI_S>(nv_flinger)->InstallAsService(service_manager);
|
||||
std::make_shared<VI_U>(nv_flinger)->InstallAsService(service_manager);
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system,
|
||||
NVFlinger::NVFlinger& nv_flinger) {
|
||||
std::make_shared<VI_M>(system, nv_flinger)->InstallAsService(service_manager);
|
||||
std::make_shared<VI_S>(system, nv_flinger)->InstallAsService(service_manager);
|
||||
std::make_shared<VI_U>(system, nv_flinger)->InstallAsService(service_manager);
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#include <memory>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class HLERequestContext;
|
||||
}
|
||||
|
@ -43,11 +47,12 @@ enum class Policy {
|
|||
};
|
||||
|
||||
namespace detail {
|
||||
void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NVFlinger& nv_flinger,
|
||||
Permission permission);
|
||||
void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system,
|
||||
NVFlinger::NVFlinger& nv_flinger, Permission permission);
|
||||
} // namespace detail
|
||||
|
||||
/// Registers all VI services with the specified service manager.
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nv_flinger);
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system,
|
||||
NVFlinger::NVFlinger& nv_flinger);
|
||||
|
||||
} // namespace Service::VI
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
namespace Service::VI {
|
||||
|
||||
VI_M::VI_M(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:m"}, nv_flinger{nv_flinger} {
|
||||
VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
|
||||
: ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{2, &VI_M::GetDisplayService, "GetDisplayService"},
|
||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
|
@ -21,7 +22,7 @@ VI_M::~VI_M() = default;
|
|||
void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
|
||||
detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::Manager);
|
||||
detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::Manager);
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class HLERequestContext;
|
||||
}
|
||||
|
@ -18,7 +22,7 @@ namespace Service::VI {
|
|||
|
||||
class VI_M final : public ServiceFramework<VI_M> {
|
||||
public:
|
||||
explicit VI_M(NVFlinger::NVFlinger& nv_flinger);
|
||||
explicit VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
|
||||
~VI_M() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
namespace Service::VI {
|
||||
|
||||
VI_S::VI_S(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:s"}, nv_flinger{nv_flinger} {
|
||||
VI_S::VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
|
||||
: ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{1, &VI_S::GetDisplayService, "GetDisplayService"},
|
||||
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
|
@ -21,7 +22,7 @@ VI_S::~VI_S() = default;
|
|||
void VI_S::GetDisplayService(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
|
||||
detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::System);
|
||||
detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::System);
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class HLERequestContext;
|
||||
}
|
||||
|
@ -18,7 +22,7 @@ namespace Service::VI {
|
|||
|
||||
class VI_S final : public ServiceFramework<VI_S> {
|
||||
public:
|
||||
explicit VI_S(NVFlinger::NVFlinger& nv_flinger);
|
||||
explicit VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
|
||||
~VI_S() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
namespace Service::VI {
|
||||
|
||||
VI_U::VI_U(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:u"}, nv_flinger{nv_flinger} {
|
||||
VI_U::VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
|
||||
: ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &VI_U::GetDisplayService, "GetDisplayService"},
|
||||
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
|
||||
|
@ -21,7 +22,7 @@ VI_U::~VI_U() = default;
|
|||
void VI_U::GetDisplayService(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_VI, "called");
|
||||
|
||||
detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::User);
|
||||
detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::User);
|
||||
}
|
||||
|
||||
} // namespace Service::VI
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class HLERequestContext;
|
||||
}
|
||||
|
@ -18,7 +22,7 @@ namespace Service::VI {
|
|||
|
||||
class VI_U final : public ServiceFramework<VI_U> {
|
||||
public:
|
||||
explicit VI_U(NVFlinger::NVFlinger& nv_flinger);
|
||||
explicit VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
|
||||
~VI_U() override;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue