summaryrefslogtreecommitdiff
path: root/src/core/hle/service/vi
diff options
context:
space:
mode:
authorGravatar Lioncash2020-11-26 15:19:08 -0500
committerGravatar Lioncash2020-11-26 20:03:11 -0500
commit1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch)
tree3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/vi
parentMerge pull request #4975 from comex/invalid-syncpoint-id (diff)
downloadyuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip
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.
Diffstat (limited to 'src/core/hle/service/vi')
-rw-r--r--src/core/hle/service/vi/vi.cpp41
-rw-r--r--src/core/hle/service/vi/vi.h11
-rw-r--r--src/core/hle/service/vi/vi_m.cpp5
-rw-r--r--src/core/hle/service/vi/vi_m.h6
-rw-r--r--src/core/hle/service/vi/vi_s.cpp5
-rw-r--r--src/core/hle/service/vi/vi_s.h6
-rw-r--r--src/core/hle/service/vi/vi_u.cpp5
-rw-r--r--src/core/hle/service/vi/vi_u.h6
8 files changed, 54 insertions, 31 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 86bd604f4..af5b8b0b9 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -492,8 +492,8 @@ private:
492 492
493class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> { 493class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
494public: 494public:
495 explicit IHOSBinderDriver(NVFlinger::NVFlinger& nv_flinger) 495 explicit IHOSBinderDriver(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
496 : ServiceFramework("IHOSBinderDriver"), nv_flinger(nv_flinger) { 496 : ServiceFramework{system_, "IHOSBinderDriver"}, nv_flinger(nv_flinger_) {
497 static const FunctionInfo functions[] = { 497 static const FunctionInfo functions[] = {
498 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"}, 498 {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"},
499 {1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"}, 499 {1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"},
@@ -689,7 +689,8 @@ private:
689 689
690class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> { 690class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
691public: 691public:
692 explicit ISystemDisplayService() : ServiceFramework("ISystemDisplayService") { 692 explicit ISystemDisplayService(Core::System& system_)
693 : ServiceFramework{system_, "ISystemDisplayService"} {
693 static const FunctionInfo functions[] = { 694 static const FunctionInfo functions[] = {
694 {1200, nullptr, "GetZOrderCountMin"}, 695 {1200, nullptr, "GetZOrderCountMin"},
695 {1202, nullptr, "GetZOrderCountMax"}, 696 {1202, nullptr, "GetZOrderCountMax"},
@@ -790,8 +791,8 @@ private:
790 791
791class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { 792class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
792public: 793public:
793 explicit IManagerDisplayService(NVFlinger::NVFlinger& nv_flinger) 794 explicit IManagerDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
794 : ServiceFramework("IManagerDisplayService"), nv_flinger(nv_flinger) { 795 : ServiceFramework{system_, "IManagerDisplayService"}, nv_flinger{nv_flinger_} {
795 // clang-format off 796 // clang-format off
796 static const FunctionInfo functions[] = { 797 static const FunctionInfo functions[] = {
797 {200, nullptr, "AllocateProcessHeapBlock"}, 798 {200, nullptr, "AllocateProcessHeapBlock"},
@@ -935,7 +936,7 @@ private:
935 936
936class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> { 937class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
937public: 938public:
938 explicit IApplicationDisplayService(NVFlinger::NVFlinger& nv_flinger); 939 explicit IApplicationDisplayService(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
939 940
940private: 941private:
941 enum class ConvertedScaleMode : u64 { 942 enum class ConvertedScaleMode : u64 {
@@ -959,7 +960,7 @@ private:
959 960
960 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 961 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
961 rb.Push(RESULT_SUCCESS); 962 rb.Push(RESULT_SUCCESS);
962 rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger); 963 rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger);
963 } 964 }
964 965
965 void GetSystemDisplayService(Kernel::HLERequestContext& ctx) { 966 void GetSystemDisplayService(Kernel::HLERequestContext& ctx) {
@@ -967,7 +968,7 @@ private:
967 968
968 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 969 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
969 rb.Push(RESULT_SUCCESS); 970 rb.Push(RESULT_SUCCESS);
970 rb.PushIpcInterface<ISystemDisplayService>(); 971 rb.PushIpcInterface<ISystemDisplayService>(system);
971 } 972 }
972 973
973 void GetManagerDisplayService(Kernel::HLERequestContext& ctx) { 974 void GetManagerDisplayService(Kernel::HLERequestContext& ctx) {
@@ -975,7 +976,7 @@ private:
975 976
976 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 977 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
977 rb.Push(RESULT_SUCCESS); 978 rb.Push(RESULT_SUCCESS);
978 rb.PushIpcInterface<IManagerDisplayService>(nv_flinger); 979 rb.PushIpcInterface<IManagerDisplayService>(system, nv_flinger);
979 } 980 }
980 981
981 void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) { 982 void GetIndirectDisplayTransactionService(Kernel::HLERequestContext& ctx) {
@@ -983,7 +984,7 @@ private:
983 984
984 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 985 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
985 rb.Push(RESULT_SUCCESS); 986 rb.Push(RESULT_SUCCESS);
986 rb.PushIpcInterface<IHOSBinderDriver>(nv_flinger); 987 rb.PushIpcInterface<IHOSBinderDriver>(system, nv_flinger);
987 } 988 }
988 989
989 void OpenDisplay(Kernel::HLERequestContext& ctx) { 990 void OpenDisplay(Kernel::HLERequestContext& ctx) {
@@ -1261,8 +1262,9 @@ private:
1261 NVFlinger::NVFlinger& nv_flinger; 1262 NVFlinger::NVFlinger& nv_flinger;
1262}; 1263};
1263 1264
1264IApplicationDisplayService::IApplicationDisplayService(NVFlinger::NVFlinger& nv_flinger) 1265IApplicationDisplayService::IApplicationDisplayService(Core::System& system_,
1265 : ServiceFramework("IApplicationDisplayService"), nv_flinger(nv_flinger) { 1266 NVFlinger::NVFlinger& nv_flinger_)
1267 : ServiceFramework{system_, "IApplicationDisplayService"}, nv_flinger{nv_flinger_} {
1266 static const FunctionInfo functions[] = { 1268 static const FunctionInfo functions[] = {
1267 {100, &IApplicationDisplayService::GetRelayService, "GetRelayService"}, 1269 {100, &IApplicationDisplayService::GetRelayService, "GetRelayService"},
1268 {101, &IApplicationDisplayService::GetSystemDisplayService, "GetSystemDisplayService"}, 1270 {101, &IApplicationDisplayService::GetSystemDisplayService, "GetSystemDisplayService"},
@@ -1303,8 +1305,8 @@ static bool IsValidServiceAccess(Permission permission, Policy policy) {
1303 return false; 1305 return false;
1304} 1306}
1305 1307
1306void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NVFlinger& nv_flinger, 1308void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system,
1307 Permission permission) { 1309 NVFlinger::NVFlinger& nv_flinger, Permission permission) {
1308 IPC::RequestParser rp{ctx}; 1310 IPC::RequestParser rp{ctx};
1309 const auto policy = rp.PopEnum<Policy>(); 1311 const auto policy = rp.PopEnum<Policy>();
1310 1312
@@ -1317,13 +1319,14 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NV
1317 1319
1318 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1320 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1319 rb.Push(RESULT_SUCCESS); 1321 rb.Push(RESULT_SUCCESS);
1320 rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); 1322 rb.PushIpcInterface<IApplicationDisplayService>(system, nv_flinger);
1321} 1323}
1322 1324
1323void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nv_flinger) { 1325void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system,
1324 std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager); 1326 NVFlinger::NVFlinger& nv_flinger) {
1325 std::make_shared<VI_S>(nv_flinger)->InstallAsService(service_manager); 1327 std::make_shared<VI_M>(system, nv_flinger)->InstallAsService(service_manager);
1326 std::make_shared<VI_U>(nv_flinger)->InstallAsService(service_manager); 1328 std::make_shared<VI_S>(system, nv_flinger)->InstallAsService(service_manager);
1329 std::make_shared<VI_U>(system, nv_flinger)->InstallAsService(service_manager);
1327} 1330}
1328 1331
1329} // namespace Service::VI 1332} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 5229fa753..eec531d54 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -7,6 +7,10 @@
7#include <memory> 7#include <memory>
8#include "common/common_types.h" 8#include "common/common_types.h"
9 9
10namespace Core {
11class System;
12}
13
10namespace Kernel { 14namespace Kernel {
11class HLERequestContext; 15class HLERequestContext;
12} 16}
@@ -43,11 +47,12 @@ enum class Policy {
43}; 47};
44 48
45namespace detail { 49namespace detail {
46void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, NVFlinger::NVFlinger& nv_flinger, 50void GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System& system,
47 Permission permission); 51 NVFlinger::NVFlinger& nv_flinger, Permission permission);
48} // namespace detail 52} // namespace detail
49 53
50/// Registers all VI services with the specified service manager. 54/// Registers all VI services with the specified service manager.
51void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nv_flinger); 55void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system,
56 NVFlinger::NVFlinger& nv_flinger);
52 57
53} // namespace Service::VI 58} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 41da3ee93..87db1c416 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -8,7 +8,8 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11VI_M::VI_M(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:m"}, nv_flinger{nv_flinger} { 11VI_M::VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
12 : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_} {
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {2, &VI_M::GetDisplayService, "GetDisplayService"}, 14 {2, &VI_M::GetDisplayService, "GetDisplayService"},
14 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 15 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -21,7 +22,7 @@ VI_M::~VI_M() = default;
21void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) { 22void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
22 LOG_DEBUG(Service_VI, "called"); 23 LOG_DEBUG(Service_VI, "called");
23 24
24 detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::Manager); 25 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::Manager);
25} 26}
26 27
27} // namespace Service::VI 28} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_m.h b/src/core/hle/service/vi/vi_m.h
index ee2489874..d79c41beb 100644
--- a/src/core/hle/service/vi/vi_m.h
+++ b/src/core/hle/service/vi/vi_m.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -18,7 +22,7 @@ namespace Service::VI {
18 22
19class VI_M final : public ServiceFramework<VI_M> { 23class VI_M final : public ServiceFramework<VI_M> {
20public: 24public:
21 explicit VI_M(NVFlinger::NVFlinger& nv_flinger); 25 explicit VI_M(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
22 ~VI_M() override; 26 ~VI_M() override;
23 27
24private: 28private:
diff --git a/src/core/hle/service/vi/vi_s.cpp b/src/core/hle/service/vi/vi_s.cpp
index 6acb51e2a..5cd22f7df 100644
--- a/src/core/hle/service/vi/vi_s.cpp
+++ b/src/core/hle/service/vi/vi_s.cpp
@@ -8,7 +8,8 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11VI_S::VI_S(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:s"}, nv_flinger{nv_flinger} { 11VI_S::VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
12 : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_} {
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {1, &VI_S::GetDisplayService, "GetDisplayService"}, 14 {1, &VI_S::GetDisplayService, "GetDisplayService"},
14 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 15 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -21,7 +22,7 @@ VI_S::~VI_S() = default;
21void VI_S::GetDisplayService(Kernel::HLERequestContext& ctx) { 22void VI_S::GetDisplayService(Kernel::HLERequestContext& ctx) {
22 LOG_DEBUG(Service_VI, "called"); 23 LOG_DEBUG(Service_VI, "called");
23 24
24 detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::System); 25 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::System);
25} 26}
26 27
27} // namespace Service::VI 28} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_s.h b/src/core/hle/service/vi/vi_s.h
index 6790673ab..5f1f8f290 100644
--- a/src/core/hle/service/vi/vi_s.h
+++ b/src/core/hle/service/vi/vi_s.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -18,7 +22,7 @@ namespace Service::VI {
18 22
19class VI_S final : public ServiceFramework<VI_S> { 23class VI_S final : public ServiceFramework<VI_S> {
20public: 24public:
21 explicit VI_S(NVFlinger::NVFlinger& nv_flinger); 25 explicit VI_S(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
22 ~VI_S() override; 26 ~VI_S() override;
23 27
24private: 28private:
diff --git a/src/core/hle/service/vi/vi_u.cpp b/src/core/hle/service/vi/vi_u.cpp
index 44e00a4f6..0079d51f0 100644
--- a/src/core/hle/service/vi/vi_u.cpp
+++ b/src/core/hle/service/vi/vi_u.cpp
@@ -8,7 +8,8 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11VI_U::VI_U(NVFlinger::NVFlinger& nv_flinger) : ServiceFramework{"vi:u"}, nv_flinger{nv_flinger} { 11VI_U::VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_)
12 : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_} {
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {0, &VI_U::GetDisplayService, "GetDisplayService"}, 14 {0, &VI_U::GetDisplayService, "GetDisplayService"},
14 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 15 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -21,7 +22,7 @@ VI_U::~VI_U() = default;
21void VI_U::GetDisplayService(Kernel::HLERequestContext& ctx) { 22void VI_U::GetDisplayService(Kernel::HLERequestContext& ctx) {
22 LOG_DEBUG(Service_VI, "called"); 23 LOG_DEBUG(Service_VI, "called");
23 24
24 detail::GetDisplayServiceImpl(ctx, nv_flinger, Permission::User); 25 detail::GetDisplayServiceImpl(ctx, system, nv_flinger, Permission::User);
25} 26}
26 27
27} // namespace Service::VI 28} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi_u.h b/src/core/hle/service/vi/vi_u.h
index b59f986f0..8e3885c73 100644
--- a/src/core/hle/service/vi/vi_u.h
+++ b/src/core/hle/service/vi/vi_u.h
@@ -6,6 +6,10 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Kernel { 13namespace Kernel {
10class HLERequestContext; 14class HLERequestContext;
11} 15}
@@ -18,7 +22,7 @@ namespace Service::VI {
18 22
19class VI_U final : public ServiceFramework<VI_U> { 23class VI_U final : public ServiceFramework<VI_U> {
20public: 24public:
21 explicit VI_U(NVFlinger::NVFlinger& nv_flinger); 25 explicit VI_U(Core::System& system_, NVFlinger::NVFlinger& nv_flinger_);
22 ~VI_U() override; 26 ~VI_U() override;
23 27
24private: 28private: