summaryrefslogtreecommitdiff
path: root/src/core/hle/service/vi
diff options
context:
space:
mode:
authorGravatar Liam2024-02-14 11:39:42 -0500
committerGravatar Liam2024-02-17 18:01:41 -0500
commitee8eccc5fa473f2ce210eb4e242e8eca40594db7 (patch)
tree5c38fc738e52be88eddd7733e0fdeb248ef4783f /src/core/hle/service/vi
parentam: unify display layer management (diff)
downloadyuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.tar.gz
yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.tar.xz
yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.zip
nvnflinger: convert to process
Diffstat (limited to 'src/core/hle/service/vi')
-rw-r--r--src/core/hle/service/vi/application_display_service.cpp47
-rw-r--r--src/core/hle/service/vi/application_display_service.h18
-rw-r--r--src/core/hle/service/vi/application_root_service.cpp10
-rw-r--r--src/core/hle/service/vi/application_root_service.h10
-rw-r--r--src/core/hle/service/vi/hos_binder_driver.cpp53
-rw-r--r--src/core/hle/service/vi/hos_binder_driver.h30
-rw-r--r--src/core/hle/service/vi/manager_display_service.cpp9
-rw-r--r--src/core/hle/service/vi/manager_display_service.h5
-rw-r--r--src/core/hle/service/vi/manager_root_service.cpp10
-rw-r--r--src/core/hle/service/vi/manager_root_service.h10
-rw-r--r--src/core/hle/service/vi/service_creator.cpp7
-rw-r--r--src/core/hle/service/vi/service_creator.h8
-rw-r--r--src/core/hle/service/vi/system_display_service.cpp17
-rw-r--r--src/core/hle/service/vi/system_display_service.h8
-rw-r--r--src/core/hle/service/vi/system_root_service.cpp11
-rw-r--r--src/core/hle/service/vi/system_root_service.h10
-rw-r--r--src/core/hle/service/vi/vi.cpp18
-rw-r--r--src/core/hle/service/vi/vi.h8
18 files changed, 100 insertions, 189 deletions
diff --git a/src/core/hle/service/vi/application_display_service.cpp b/src/core/hle/service/vi/application_display_service.cpp
index 78229e30f..a6e04bf60 100644
--- a/src/core/hle/service/vi/application_display_service.cpp
+++ b/src/core/hle/service/vi/application_display_service.cpp
@@ -2,10 +2,10 @@
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/cmif_serialization.h" 4#include "core/hle/service/cmif_serialization.h"
5#include "core/hle/service/nvnflinger/hos_binder_driver.h"
5#include "core/hle/service/nvnflinger/nvnflinger.h" 6#include "core/hle/service/nvnflinger/nvnflinger.h"
6#include "core/hle/service/nvnflinger/parcel.h" 7#include "core/hle/service/nvnflinger/parcel.h"
7#include "core/hle/service/vi/application_display_service.h" 8#include "core/hle/service/vi/application_display_service.h"
8#include "core/hle/service/vi/hos_binder_driver.h"
9#include "core/hle/service/vi/manager_display_service.h" 9#include "core/hle/service/vi/manager_display_service.h"
10#include "core/hle/service/vi/system_display_service.h" 10#include "core/hle/service/vi/system_display_service.h"
11#include "core/hle/service/vi/vi_results.h" 11#include "core/hle/service/vi/vi_results.h"
@@ -13,10 +13,10 @@
13namespace Service::VI { 13namespace Service::VI {
14 14
15IApplicationDisplayService::IApplicationDisplayService( 15IApplicationDisplayService::IApplicationDisplayService(
16 Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 16 Core::System& system_, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
17 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) 17 : ServiceFramework{system_, "IApplicationDisplayService"},
18 : ServiceFramework{system_, "IApplicationDisplayService"}, m_nvnflinger{nvnflinger}, 18 m_binder_service{std::move(binder_service)},
19 m_hos_binder_driver_server{hos_binder_driver_server} { 19 m_surface_flinger{m_binder_service->GetSurfaceFlinger()} {
20 20
21 // clang-format off 21 // clang-format off
22 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
@@ -49,36 +49,37 @@ IApplicationDisplayService::IApplicationDisplayService(
49 49
50IApplicationDisplayService::~IApplicationDisplayService() { 50IApplicationDisplayService::~IApplicationDisplayService() {
51 for (const auto layer_id : m_stray_layer_ids) { 51 for (const auto layer_id : m_stray_layer_ids) {
52 m_nvnflinger.DestroyLayer(layer_id); 52 m_surface_flinger->DestroyLayer(layer_id);
53 } 53 }
54} 54}
55 55
56Result IApplicationDisplayService::GetRelayService( 56Result IApplicationDisplayService::GetRelayService(
57 Out<SharedPointer<IHOSBinderDriver>> out_relay_service) { 57 Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_relay_service) {
58 LOG_WARNING(Service_VI, "(STUBBED) called"); 58 LOG_WARNING(Service_VI, "(STUBBED) called");
59 *out_relay_service = std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server); 59 *out_relay_service = m_binder_service;
60 R_SUCCEED(); 60 R_SUCCEED();
61} 61}
62 62
63Result IApplicationDisplayService::GetSystemDisplayService( 63Result IApplicationDisplayService::GetSystemDisplayService(
64 Out<SharedPointer<ISystemDisplayService>> out_system_display_service) { 64 Out<SharedPointer<ISystemDisplayService>> out_system_display_service) {
65 LOG_WARNING(Service_VI, "(STUBBED) called"); 65 LOG_WARNING(Service_VI, "(STUBBED) called");
66 *out_system_display_service = std::make_shared<ISystemDisplayService>(system, m_nvnflinger); 66 *out_system_display_service =
67 std::make_shared<ISystemDisplayService>(system, m_surface_flinger);
67 R_SUCCEED(); 68 R_SUCCEED();
68} 69}
69 70
70Result IApplicationDisplayService::GetManagerDisplayService( 71Result IApplicationDisplayService::GetManagerDisplayService(
71 Out<SharedPointer<IManagerDisplayService>> out_manager_display_service) { 72 Out<SharedPointer<IManagerDisplayService>> out_manager_display_service) {
72 LOG_WARNING(Service_VI, "(STUBBED) called"); 73 LOG_WARNING(Service_VI, "(STUBBED) called");
73 *out_manager_display_service = std::make_shared<IManagerDisplayService>(system, m_nvnflinger); 74 *out_manager_display_service =
75 std::make_shared<IManagerDisplayService>(system, m_surface_flinger);
74 R_SUCCEED(); 76 R_SUCCEED();
75} 77}
76 78
77Result IApplicationDisplayService::GetIndirectDisplayTransactionService( 79Result IApplicationDisplayService::GetIndirectDisplayTransactionService(
78 Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service) { 80 Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_indirect_display_transaction_service) {
79 LOG_WARNING(Service_VI, "(STUBBED) called"); 81 LOG_WARNING(Service_VI, "(STUBBED) called");
80 *out_indirect_display_transaction_service = 82 *out_indirect_display_transaction_service = m_binder_service;
81 std::make_shared<IHOSBinderDriver>(system, m_hos_binder_driver_server);
82 R_SUCCEED(); 83 R_SUCCEED();
83} 84}
84 85
@@ -89,7 +90,7 @@ Result IApplicationDisplayService::OpenDisplay(Out<u64> out_display_id, DisplayN
89 ASSERT_MSG(strcmp(display_name.data(), "Default") == 0, 90 ASSERT_MSG(strcmp(display_name.data(), "Default") == 0,
90 "Non-default displays aren't supported yet"); 91 "Non-default displays aren't supported yet");
91 92
92 const auto display_id = m_nvnflinger.OpenDisplay(display_name.data()); 93 const auto display_id = m_surface_flinger->OpenDisplay(display_name.data());
93 if (!display_id) { 94 if (!display_id) {
94 LOG_ERROR(Service_VI, "Display not found! display_name={}", display_name.data()); 95 LOG_ERROR(Service_VI, "Display not found! display_name={}", display_name.data());
95 R_THROW(VI::ResultNotFound); 96 R_THROW(VI::ResultNotFound);
@@ -106,7 +107,7 @@ Result IApplicationDisplayService::OpenDefaultDisplay(Out<u64> out_display_id) {
106 107
107Result IApplicationDisplayService::CloseDisplay(u64 display_id) { 108Result IApplicationDisplayService::CloseDisplay(u64 display_id) {
108 LOG_DEBUG(Service_VI, "called"); 109 LOG_DEBUG(Service_VI, "called");
109 R_SUCCEED_IF(m_nvnflinger.CloseDisplay(display_id)); 110 R_SUCCEED_IF(m_surface_flinger->CloseDisplay(display_id));
110 R_THROW(ResultUnknown); 111 R_THROW(ResultUnknown);
111} 112}
112 113
@@ -168,19 +169,19 @@ Result IApplicationDisplayService::OpenLayer(Out<u64> out_size,
168 169
169 LOG_DEBUG(Service_VI, "called. layer_id={}, aruid={:#x}", layer_id, aruid.pid); 170 LOG_DEBUG(Service_VI, "called. layer_id={}, aruid={:#x}", layer_id, aruid.pid);
170 171
171 const auto display_id = m_nvnflinger.OpenDisplay(display_name.data()); 172 const auto display_id = m_surface_flinger->OpenDisplay(display_name.data());
172 if (!display_id) { 173 if (!display_id) {
173 LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id); 174 LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id);
174 R_THROW(VI::ResultNotFound); 175 R_THROW(VI::ResultNotFound);
175 } 176 }
176 177
177 const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(*display_id, layer_id); 178 const auto buffer_queue_id = m_surface_flinger->FindBufferQueueId(*display_id, layer_id);
178 if (!buffer_queue_id) { 179 if (!buffer_queue_id) {
179 LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id); 180 LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id);
180 R_THROW(VI::ResultNotFound); 181 R_THROW(VI::ResultNotFound);
181 } 182 }
182 183
183 if (!m_nvnflinger.OpenLayer(layer_id)) { 184 if (!m_surface_flinger->OpenLayer(layer_id)) {
184 LOG_WARNING(Service_VI, "Tried to open layer which was already open"); 185 LOG_WARNING(Service_VI, "Tried to open layer which was already open");
185 R_THROW(VI::ResultOperationFailed); 186 R_THROW(VI::ResultOperationFailed);
186 } 187 }
@@ -199,7 +200,7 @@ Result IApplicationDisplayService::OpenLayer(Out<u64> out_size,
199Result IApplicationDisplayService::CloseLayer(u64 layer_id) { 200Result IApplicationDisplayService::CloseLayer(u64 layer_id) {
200 LOG_DEBUG(Service_VI, "called. layer_id={}", layer_id); 201 LOG_DEBUG(Service_VI, "called. layer_id={}", layer_id);
201 202
202 if (!m_nvnflinger.CloseLayer(layer_id)) { 203 if (!m_surface_flinger->CloseLayer(layer_id)) {
203 LOG_WARNING(Service_VI, "Tried to close layer which was not open"); 204 LOG_WARNING(Service_VI, "Tried to close layer which was not open");
204 R_THROW(VI::ResultOperationFailed); 205 R_THROW(VI::ResultOperationFailed);
205 } 206 }
@@ -212,14 +213,14 @@ Result IApplicationDisplayService::CreateStrayLayer(
212 u32 flags, u64 display_id) { 213 u32 flags, u64 display_id) {
213 LOG_DEBUG(Service_VI, "called. flags={}, display_id={}", flags, display_id); 214 LOG_DEBUG(Service_VI, "called. flags={}, display_id={}", flags, display_id);
214 215
215 const auto layer_id = m_nvnflinger.CreateLayer(display_id); 216 const auto layer_id = m_surface_flinger->CreateLayer(display_id);
216 if (!layer_id) { 217 if (!layer_id) {
217 LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id); 218 LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id);
218 R_THROW(VI::ResultNotFound); 219 R_THROW(VI::ResultNotFound);
219 } 220 }
220 221
221 m_stray_layer_ids.push_back(*layer_id); 222 m_stray_layer_ids.push_back(*layer_id);
222 const auto buffer_queue_id = m_nvnflinger.FindBufferQueueId(display_id, *layer_id); 223 const auto buffer_queue_id = m_surface_flinger->FindBufferQueueId(display_id, *layer_id);
223 if (!buffer_queue_id) { 224 if (!buffer_queue_id) {
224 LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id); 225 LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id);
225 R_THROW(VI::ResultNotFound); 226 R_THROW(VI::ResultNotFound);
@@ -240,7 +241,7 @@ Result IApplicationDisplayService::CreateStrayLayer(
240 241
241Result IApplicationDisplayService::DestroyStrayLayer(u64 layer_id) { 242Result IApplicationDisplayService::DestroyStrayLayer(u64 layer_id) {
242 LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}", layer_id); 243 LOG_WARNING(Service_VI, "(STUBBED) called. layer_id={}", layer_id);
243 m_nvnflinger.DestroyLayer(layer_id); 244 m_surface_flinger->DestroyLayer(layer_id);
244 R_SUCCEED(); 245 R_SUCCEED();
245} 246}
246 247
@@ -248,7 +249,7 @@ Result IApplicationDisplayService::GetDisplayVsyncEvent(
248 OutCopyHandle<Kernel::KReadableEvent> out_vsync_event, u64 display_id) { 249 OutCopyHandle<Kernel::KReadableEvent> out_vsync_event, u64 display_id) {
249 LOG_DEBUG(Service_VI, "called. display_id={}", display_id); 250 LOG_DEBUG(Service_VI, "called. display_id={}", display_id);
250 251
251 const auto result = m_nvnflinger.FindVsyncEvent(out_vsync_event, display_id); 252 const auto result = m_surface_flinger->FindVsyncEvent(out_vsync_event, display_id);
252 if (result != ResultSuccess) { 253 if (result != ResultSuccess) {
253 if (result == ResultNotFound) { 254 if (result == ResultNotFound) {
254 LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id); 255 LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id);
diff --git a/src/core/hle/service/vi/application_display_service.h b/src/core/hle/service/vi/application_display_service.h
index 5dff4bb31..e56490f9f 100644
--- a/src/core/hle/service/vi/application_display_service.h
+++ b/src/core/hle/service/vi/application_display_service.h
@@ -9,26 +9,30 @@ namespace Kernel {
9class KReadableEvent; 9class KReadableEvent;
10} 10}
11 11
12namespace Service::Nvnflinger {
13class Nvnflinger;
14class IHOSBinderDriver;
15} // namespace Service::Nvnflinger
16
12namespace Service::VI { 17namespace Service::VI {
13 18
14class IHOSBinderDriver;
15class IManagerDisplayService; 19class IManagerDisplayService;
16class ISystemDisplayService; 20class ISystemDisplayService;
17 21
18class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> { 22class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
19public: 23public:
20 IApplicationDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 24 IApplicationDisplayService(Core::System& system_,
21 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server); 25 std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
22 ~IApplicationDisplayService() override; 26 ~IApplicationDisplayService() override;
23 27
24private: 28private:
25 Result GetRelayService(Out<SharedPointer<IHOSBinderDriver>> out_relay_service); 29 Result GetRelayService(Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_relay_service);
26 Result GetSystemDisplayService( 30 Result GetSystemDisplayService(
27 Out<SharedPointer<ISystemDisplayService>> out_system_display_service); 31 Out<SharedPointer<ISystemDisplayService>> out_system_display_service);
28 Result GetManagerDisplayService( 32 Result GetManagerDisplayService(
29 Out<SharedPointer<IManagerDisplayService>> out_manager_display_service); 33 Out<SharedPointer<IManagerDisplayService>> out_manager_display_service);
30 Result GetIndirectDisplayTransactionService( 34 Result GetIndirectDisplayTransactionService(
31 Out<SharedPointer<IHOSBinderDriver>> out_indirect_display_transaction_service); 35 Out<SharedPointer<Nvnflinger::IHOSBinderDriver>> out_indirect_display_transaction_service);
32 Result OpenDisplay(Out<u64> out_display_id, DisplayName display_name); 36 Result OpenDisplay(Out<u64> out_display_id, DisplayName display_name);
33 Result OpenDefaultDisplay(Out<u64> out_display_id); 37 Result OpenDefaultDisplay(Out<u64> out_display_id);
34 Result CloseDisplay(u64 display_id); 38 Result CloseDisplay(u64 display_id);
@@ -56,8 +60,8 @@ private:
56 s64 width, s64 height); 60 s64 width, s64 height);
57 61
58private: 62private:
59 Nvnflinger::Nvnflinger& m_nvnflinger; 63 const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
60 Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server; 64 const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger;
61 std::vector<u64> m_stray_layer_ids; 65 std::vector<u64> m_stray_layer_ids;
62 bool m_vsync_event_fetched{false}; 66 bool m_vsync_event_fetched{false};
63}; 67};
diff --git a/src/core/hle/service/vi/application_root_service.cpp b/src/core/hle/service/vi/application_root_service.cpp
index 7af7f062c..501fbdd6a 100644
--- a/src/core/hle/service/vi/application_root_service.cpp
+++ b/src/core/hle/service/vi/application_root_service.cpp
@@ -11,10 +11,8 @@
11namespace Service::VI { 11namespace Service::VI {
12 12
13IApplicationRootService::IApplicationRootService( 13IApplicationRootService::IApplicationRootService(
14 Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 14 Core::System& system_, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
15 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) 15 : ServiceFramework{system_, "vi:u"}, m_binder_service{std::move(binder_service)} {
16 : ServiceFramework{system_, "vi:u"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
17 hos_binder_driver_server} {
18 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
19 {0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"}, 17 {0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"},
20 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 18 {1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -27,8 +25,8 @@ IApplicationRootService::~IApplicationRootService() = default;
27Result IApplicationRootService::GetDisplayService( 25Result IApplicationRootService::GetDisplayService(
28 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) { 26 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
29 LOG_DEBUG(Service_VI, "called"); 27 LOG_DEBUG(Service_VI, "called");
30 R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger, 28 R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_binder_service,
31 m_hos_binder_driver_server, Permission::User, policy)); 29 Permission::User, policy));
32} 30}
33 31
34} // namespace Service::VI 32} // namespace Service::VI
diff --git a/src/core/hle/service/vi/application_root_service.h b/src/core/hle/service/vi/application_root_service.h
index 9dbf28cb4..d1f023e9e 100644
--- a/src/core/hle/service/vi/application_root_service.h
+++ b/src/core/hle/service/vi/application_root_service.h
@@ -11,8 +11,7 @@ class System;
11} 11}
12 12
13namespace Service::Nvnflinger { 13namespace Service::Nvnflinger {
14class HosBinderDriverServer; 14class IHOSBinderDriver;
15class Nvnflinger;
16} // namespace Service::Nvnflinger 15} // namespace Service::Nvnflinger
17 16
18namespace Service::VI { 17namespace Service::VI {
@@ -22,8 +21,8 @@ enum class Policy : u32;
22 21
23class IApplicationRootService final : public ServiceFramework<IApplicationRootService> { 22class IApplicationRootService final : public ServiceFramework<IApplicationRootService> {
24public: 23public:
25 explicit IApplicationRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 24 explicit IApplicationRootService(Core::System& system_,
26 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server); 25 std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
27 ~IApplicationRootService() override; 26 ~IApplicationRootService() override;
28 27
29private: 28private:
@@ -32,8 +31,7 @@ private:
32 Policy policy); 31 Policy policy);
33 32
34private: 33private:
35 Nvnflinger::Nvnflinger& m_nvnflinger; 34 const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
36 Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
37}; 35};
38 36
39} // namespace Service::VI 37} // namespace Service::VI
diff --git a/src/core/hle/service/vi/hos_binder_driver.cpp b/src/core/hle/service/vi/hos_binder_driver.cpp
deleted file mode 100644
index ba0317245..000000000
--- a/src/core/hle/service/vi/hos_binder_driver.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "core/hle/service/cmif_serialization.h"
5#include "core/hle/service/nvnflinger/binder.h"
6#include "core/hle/service/nvnflinger/hos_binder_driver_server.h"
7#include "core/hle/service/vi/hos_binder_driver.h"
8
9namespace Service::VI {
10
11IHOSBinderDriver::IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server)
12 : ServiceFramework{system_, "IHOSBinderDriver"}, m_server(server) {
13 static const FunctionInfo functions[] = {
14 {0, C<&IHOSBinderDriver::TransactParcel>, "TransactParcel"},
15 {1, C<&IHOSBinderDriver::AdjustRefcount>, "AdjustRefcount"},
16 {2, C<&IHOSBinderDriver::GetNativeHandle>, "GetNativeHandle"},
17 {3, C<&IHOSBinderDriver::TransactParcelAuto>, "TransactParcelAuto"},
18 };
19 RegisterHandlers(functions);
20}
21
22IHOSBinderDriver::~IHOSBinderDriver() = default;
23
24Result IHOSBinderDriver::TransactParcel(s32 binder_id, android::TransactionId transaction_id,
25 InBuffer<BufferAttr_HipcMapAlias> parcel_data,
26 OutBuffer<BufferAttr_HipcMapAlias> parcel_reply,
27 u32 flags) {
28 LOG_DEBUG(Service_VI, "called. id={} transaction={}, flags={}", binder_id, transaction_id,
29 flags);
30 m_server.TryGetProducer(binder_id)->Transact(transaction_id, flags, parcel_data, parcel_reply);
31 R_SUCCEED();
32}
33
34Result IHOSBinderDriver::AdjustRefcount(s32 binder_id, s32 addval, s32 type) {
35 LOG_WARNING(Service_VI, "(STUBBED) called id={}, addval={}, type={}", binder_id, addval, type);
36 R_SUCCEED();
37}
38
39Result IHOSBinderDriver::GetNativeHandle(s32 binder_id, u32 type_id,
40 OutCopyHandle<Kernel::KReadableEvent> out_handle) {
41 LOG_WARNING(Service_VI, "(STUBBED) called id={}, type_id={}", binder_id, type_id);
42 *out_handle = &m_server.TryGetProducer(binder_id)->GetNativeHandle();
43 R_SUCCEED();
44}
45
46Result IHOSBinderDriver::TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
47 InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
48 OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply,
49 u32 flags) {
50 R_RETURN(this->TransactParcel(binder_id, transaction_id, parcel_data, parcel_reply, flags));
51}
52
53} // namespace Service::VI
diff --git a/src/core/hle/service/vi/hos_binder_driver.h b/src/core/hle/service/vi/hos_binder_driver.h
deleted file mode 100644
index ed6e8cdbe..000000000
--- a/src/core/hle/service/vi/hos_binder_driver.h
+++ /dev/null
@@ -1,30 +0,0 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "core/hle/service/cmif_types.h"
5#include "core/hle/service/nvnflinger/binder.h"
6#include "core/hle/service/service.h"
7
8namespace Service::VI {
9
10class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
11public:
12 explicit IHOSBinderDriver(Core::System& system_, Nvnflinger::HosBinderDriverServer& server);
13 ~IHOSBinderDriver() override;
14
15private:
16 Result TransactParcel(s32 binder_id, android::TransactionId transaction_id,
17 InBuffer<BufferAttr_HipcMapAlias> parcel_data,
18 OutBuffer<BufferAttr_HipcMapAlias> parcel_reply, u32 flags);
19 Result AdjustRefcount(s32 binder_id, s32 addval, s32 type);
20 Result GetNativeHandle(s32 binder_id, u32 type_id,
21 OutCopyHandle<Kernel::KReadableEvent> out_handle);
22 Result TransactParcelAuto(s32 binder_id, android::TransactionId transaction_id,
23 InBuffer<BufferAttr_HipcAutoSelect> parcel_data,
24 OutBuffer<BufferAttr_HipcAutoSelect> parcel_reply, u32 flags);
25
26private:
27 Nvnflinger::HosBinderDriverServer& m_server;
28};
29
30} // namespace Service::VI
diff --git a/src/core/hle/service/vi/manager_display_service.cpp b/src/core/hle/service/vi/manager_display_service.cpp
index 17f2f3b8f..22454ba61 100644
--- a/src/core/hle/service/vi/manager_display_service.cpp
+++ b/src/core/hle/service/vi/manager_display_service.cpp
@@ -8,9 +8,10 @@
8 8
9namespace Service::VI { 9namespace Service::VI {
10 10
11IManagerDisplayService::IManagerDisplayService(Core::System& system_, 11IManagerDisplayService::IManagerDisplayService(
12 Nvnflinger::Nvnflinger& nvnflinger) 12 Core::System& system_, std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger)
13 : ServiceFramework{system_, "IManagerDisplayService"}, m_nvnflinger{nvnflinger} { 13 : ServiceFramework{system_, "IManagerDisplayService"},
14 m_surface_flinger{std::move(surface_flinger)} {
14 // clang-format off 15 // clang-format off
15 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
16 {200, nullptr, "AllocateProcessHeapBlock"}, 17 {200, nullptr, "AllocateProcessHeapBlock"},
@@ -107,7 +108,7 @@ Result IManagerDisplayService::CreateManagedLayer(Out<u64> out_layer_id, u32 unk
107 LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown, 108 LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown,
108 display_id, aruid.pid); 109 display_id, aruid.pid);
109 110
110 const auto layer_id = m_nvnflinger.CreateLayer(display_id); 111 const auto layer_id = m_surface_flinger->CreateLayer(display_id);
111 if (!layer_id) { 112 if (!layer_id) {
112 LOG_ERROR(Service_VI, "Layer not found! display={}", display_id); 113 LOG_ERROR(Service_VI, "Layer not found! display={}", display_id);
113 R_THROW(VI::ResultNotFound); 114 R_THROW(VI::ResultNotFound);
diff --git a/src/core/hle/service/vi/manager_display_service.h b/src/core/hle/service/vi/manager_display_service.h
index 60e646ee0..4a3d53ff8 100644
--- a/src/core/hle/service/vi/manager_display_service.h
+++ b/src/core/hle/service/vi/manager_display_service.h
@@ -8,7 +8,8 @@ namespace Service::VI {
8 8
9class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { 9class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
10public: 10public:
11 explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger); 11 explicit IManagerDisplayService(Core::System& system_,
12 std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger);
12 ~IManagerDisplayService() override; 13 ~IManagerDisplayService() override;
13 14
14private: 15private:
@@ -18,7 +19,7 @@ private:
18 Result SetLayerVisibility(bool visible, u64 layer_id); 19 Result SetLayerVisibility(bool visible, u64 layer_id);
19 20
20private: 21private:
21 Nvnflinger::Nvnflinger& m_nvnflinger; 22 const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger;
22}; 23};
23 24
24} // namespace Service::VI 25} // namespace Service::VI
diff --git a/src/core/hle/service/vi/manager_root_service.cpp b/src/core/hle/service/vi/manager_root_service.cpp
index a7eee4f04..36b84909a 100644
--- a/src/core/hle/service/vi/manager_root_service.cpp
+++ b/src/core/hle/service/vi/manager_root_service.cpp
@@ -11,10 +11,8 @@
11namespace Service::VI { 11namespace Service::VI {
12 12
13IManagerRootService::IManagerRootService( 13IManagerRootService::IManagerRootService(
14 Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 14 Core::System& system_, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
15 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) 15 : ServiceFramework{system_, "vi:m"}, m_binder_service{std::move(binder_service)} {
16 : ServiceFramework{system_, "vi:m"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
17 hos_binder_driver_server} {
18 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
19 {2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"}, 17 {2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"},
20 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 18 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -31,8 +29,8 @@ IManagerRootService::~IManagerRootService() = default;
31Result IManagerRootService::GetDisplayService( 29Result IManagerRootService::GetDisplayService(
32 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) { 30 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
33 LOG_DEBUG(Service_VI, "called"); 31 LOG_DEBUG(Service_VI, "called");
34 R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger, 32 R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_binder_service,
35 m_hos_binder_driver_server, Permission::Manager, policy)); 33 Permission::Manager, policy));
36} 34}
37 35
38} // namespace Service::VI 36} // namespace Service::VI
diff --git a/src/core/hle/service/vi/manager_root_service.h b/src/core/hle/service/vi/manager_root_service.h
index e6cb77aeb..26aa95a88 100644
--- a/src/core/hle/service/vi/manager_root_service.h
+++ b/src/core/hle/service/vi/manager_root_service.h
@@ -11,8 +11,7 @@ class System;
11} 11}
12 12
13namespace Service::Nvnflinger { 13namespace Service::Nvnflinger {
14class HosBinderDriverServer; 14class IHOSBinderDriver;
15class Nvnflinger;
16} // namespace Service::Nvnflinger 15} // namespace Service::Nvnflinger
17 16
18namespace Service::VI { 17namespace Service::VI {
@@ -22,8 +21,8 @@ enum class Policy : u32;
22 21
23class IManagerRootService final : public ServiceFramework<IManagerRootService> { 22class IManagerRootService final : public ServiceFramework<IManagerRootService> {
24public: 23public:
25 explicit IManagerRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 24 explicit IManagerRootService(Core::System& system_,
26 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server); 25 std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
27 ~IManagerRootService() override; 26 ~IManagerRootService() override;
28 27
29private: 28private:
@@ -31,8 +30,7 @@ private:
31 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, 30 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
32 Policy policy); 31 Policy policy);
33 32
34 Nvnflinger::Nvnflinger& m_nvnflinger; 33 const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
35 Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
36}; 34};
37 35
38} // namespace Service::VI 36} // namespace Service::VI
diff --git a/src/core/hle/service/vi/service_creator.cpp b/src/core/hle/service/vi/service_creator.cpp
index 1de9d61a4..594e57398 100644
--- a/src/core/hle/service/vi/service_creator.cpp
+++ b/src/core/hle/service/vi/service_creator.cpp
@@ -22,9 +22,8 @@ static bool IsValidServiceAccess(Permission permission, Policy policy) {
22 22
23Result GetApplicationDisplayService( 23Result GetApplicationDisplayService(
24 std::shared_ptr<IApplicationDisplayService>* out_application_display_service, 24 std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
25 Core::System& system, Nvnflinger::Nvnflinger& nvnflinger, 25 Core::System& system, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service,
26 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission, 26 Permission permission, Policy policy) {
27 Policy policy) {
28 27
29 if (!IsValidServiceAccess(permission, policy)) { 28 if (!IsValidServiceAccess(permission, policy)) {
30 LOG_ERROR(Service_VI, "Permission denied for policy {}", policy); 29 LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
@@ -32,7 +31,7 @@ Result GetApplicationDisplayService(
32 } 31 }
33 32
34 *out_application_display_service = 33 *out_application_display_service =
35 std::make_shared<IApplicationDisplayService>(system, nvnflinger, hos_binder_driver_server); 34 std::make_shared<IApplicationDisplayService>(system, binder_service);
36 R_SUCCEED(); 35 R_SUCCEED();
37} 36}
38 37
diff --git a/src/core/hle/service/vi/service_creator.h b/src/core/hle/service/vi/service_creator.h
index 8963bcd26..bdfac8a08 100644
--- a/src/core/hle/service/vi/service_creator.h
+++ b/src/core/hle/service/vi/service_creator.h
@@ -12,8 +12,7 @@ class System;
12} 12}
13 13
14namespace Service::Nvnflinger { 14namespace Service::Nvnflinger {
15class HosBinderDriverServer; 15class IHOSBinderDriver;
16class Nvnflinger;
17} // namespace Service::Nvnflinger 16} // namespace Service::Nvnflinger
18 17
19union Result; 18union Result;
@@ -26,8 +25,7 @@ enum class Policy : u32;
26 25
27Result GetApplicationDisplayService( 26Result GetApplicationDisplayService(
28 std::shared_ptr<IApplicationDisplayService>* out_application_display_service, 27 std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
29 Core::System& system, Nvnflinger::Nvnflinger& nvnflinger, 28 Core::System& system, std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service,
30 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission, 29 Permission permission, Policy policy);
31 Policy policy);
32 30
33} // namespace Service::VI 31} // namespace Service::VI
diff --git a/src/core/hle/service/vi/system_display_service.cpp b/src/core/hle/service/vi/system_display_service.cpp
index 1e1cfc817..8d6c3f04c 100644
--- a/src/core/hle/service/vi/system_display_service.cpp
+++ b/src/core/hle/service/vi/system_display_service.cpp
@@ -9,9 +9,10 @@
9 9
10namespace Service::VI { 10namespace Service::VI {
11 11
12ISystemDisplayService::ISystemDisplayService(Core::System& system_, 12ISystemDisplayService::ISystemDisplayService(
13 Nvnflinger::Nvnflinger& nvnflinger) 13 Core::System& system_, std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger)
14 : ServiceFramework{system_, "ISystemDisplayService"}, m_nvnflinger{nvnflinger} { 14 : ServiceFramework{system_, "ISystemDisplayService"},
15 m_surface_flinger{std::move(surface_flinger)} {
15 // clang-format off 16 // clang-format off
16 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
17 {1200, nullptr, "GetZOrderCountMin"}, 18 {1200, nullptr, "GetZOrderCountMin"},
@@ -104,7 +105,7 @@ Result ISystemDisplayService::GetSharedBufferMemoryHandleId(
104 u64 buffer_id, ClientAppletResourceUserId aruid) { 105 u64 buffer_id, ClientAppletResourceUserId aruid) {
105 LOG_INFO(Service_VI, "called. buffer_id={}, aruid={:#x}", buffer_id, aruid.pid); 106 LOG_INFO(Service_VI, "called. buffer_id={}, aruid={:#x}", buffer_id, aruid.pid);
106 107
107 R_RETURN(m_nvnflinger.GetSystemBufferManager().GetSharedBufferMemoryHandleId( 108 R_RETURN(m_surface_flinger->GetSystemBufferManager().GetSharedBufferMemoryHandleId(
108 out_size, out_nvmap_handle, out_pool_layout, buffer_id, aruid.pid)); 109 out_size, out_nvmap_handle, out_pool_layout, buffer_id, aruid.pid));
109} 110}
110 111
@@ -122,7 +123,7 @@ Result ISystemDisplayService::AcquireSharedFrameBuffer(Out<android::Fence> out_f
122 Out<std::array<s32, 4>> out_slots, 123 Out<std::array<s32, 4>> out_slots,
123 Out<s64> out_target_slot, u64 layer_id) { 124 Out<s64> out_target_slot, u64 layer_id) {
124 LOG_DEBUG(Service_VI, "called"); 125 LOG_DEBUG(Service_VI, "called");
125 R_RETURN(m_nvnflinger.GetSystemBufferManager().AcquireSharedFrameBuffer( 126 R_RETURN(m_surface_flinger->GetSystemBufferManager().AcquireSharedFrameBuffer(
126 out_fence, *out_slots, out_target_slot, layer_id)); 127 out_fence, *out_slots, out_target_slot, layer_id));
127} 128}
128 129
@@ -131,15 +132,15 @@ Result ISystemDisplayService::PresentSharedFrameBuffer(android::Fence fence,
131 u32 window_transform, s32 swap_interval, 132 u32 window_transform, s32 swap_interval,
132 u64 layer_id, s64 surface_id) { 133 u64 layer_id, s64 surface_id) {
133 LOG_DEBUG(Service_VI, "called"); 134 LOG_DEBUG(Service_VI, "called");
134 R_RETURN(m_nvnflinger.GetSystemBufferManager().PresentSharedFrameBuffer( 135 R_RETURN(m_surface_flinger->GetSystemBufferManager().PresentSharedFrameBuffer(
135 fence, crop_region, window_transform, swap_interval, layer_id, surface_id)); 136 fence, crop_region, window_transform, swap_interval, layer_id, surface_id));
136} 137}
137 138
138Result ISystemDisplayService::GetSharedFrameBufferAcquirableEvent( 139Result ISystemDisplayService::GetSharedFrameBufferAcquirableEvent(
139 OutCopyHandle<Kernel::KReadableEvent> out_event, u64 layer_id) { 140 OutCopyHandle<Kernel::KReadableEvent> out_event, u64 layer_id) {
140 LOG_DEBUG(Service_VI, "called"); 141 LOG_DEBUG(Service_VI, "called");
141 R_RETURN(m_nvnflinger.GetSystemBufferManager().GetSharedFrameBufferAcquirableEvent(out_event, 142 R_RETURN(m_surface_flinger->GetSystemBufferManager().GetSharedFrameBufferAcquirableEvent(
142 layer_id)); 143 out_event, layer_id));
143} 144}
144 145
145} // namespace Service::VI 146} // namespace Service::VI
diff --git a/src/core/hle/service/vi/system_display_service.h b/src/core/hle/service/vi/system_display_service.h
index cfcb196fd..6c3f57ad7 100644
--- a/src/core/hle/service/vi/system_display_service.h
+++ b/src/core/hle/service/vi/system_display_service.h
@@ -7,14 +7,16 @@
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Service::Nvnflinger { 9namespace Service::Nvnflinger {
10class Nvnflinger;
10struct SharedMemoryPoolLayout; 11struct SharedMemoryPoolLayout;
11} 12} // namespace Service::Nvnflinger
12 13
13namespace Service::VI { 14namespace Service::VI {
14 15
15class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> { 16class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
16public: 17public:
17 explicit ISystemDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger); 18 explicit ISystemDisplayService(Core::System& system_,
19 std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger);
18 ~ISystemDisplayService() override; 20 ~ISystemDisplayService() override;
19 21
20private: 22private:
@@ -39,7 +41,7 @@ private:
39 s64 surface_id); 41 s64 surface_id);
40 42
41private: 43private:
42 Nvnflinger::Nvnflinger& m_nvnflinger; 44 const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger;
43}; 45};
44 46
45} // namespace Service::VI 47} // namespace Service::VI
diff --git a/src/core/hle/service/vi/system_root_service.cpp b/src/core/hle/service/vi/system_root_service.cpp
index 8789b4cfb..1d435ed6b 100644
--- a/src/core/hle/service/vi/system_root_service.cpp
+++ b/src/core/hle/service/vi/system_root_service.cpp
@@ -10,10 +10,9 @@
10 10
11namespace Service::VI { 11namespace Service::VI {
12 12
13ISystemRootService::ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 13ISystemRootService::ISystemRootService(Core::System& system_,
14 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) 14 std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service)
15 : ServiceFramework{system_, "vi:s"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{ 15 : ServiceFramework{system_, "vi:s"}, m_binder_service{std::move(binder_service)} {
16 hos_binder_driver_server} {
17 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
18 {1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"}, 17 {1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"},
19 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 18 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
@@ -26,8 +25,8 @@ ISystemRootService::~ISystemRootService() = default;
26Result ISystemRootService::GetDisplayService( 25Result ISystemRootService::GetDisplayService(
27 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) { 26 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
28 LOG_DEBUG(Service_VI, "called"); 27 LOG_DEBUG(Service_VI, "called");
29 R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger, 28 R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_binder_service,
30 m_hos_binder_driver_server, Permission::System, policy)); 29 Permission::System, policy));
31} 30}
32 31
33} // namespace Service::VI 32} // namespace Service::VI
diff --git a/src/core/hle/service/vi/system_root_service.h b/src/core/hle/service/vi/system_root_service.h
index 2c547faa5..6f07c39fd 100644
--- a/src/core/hle/service/vi/system_root_service.h
+++ b/src/core/hle/service/vi/system_root_service.h
@@ -11,8 +11,7 @@ class System;
11} 11}
12 12
13namespace Service::Nvnflinger { 13namespace Service::Nvnflinger {
14class HosBinderDriverServer; 14class IHOSBinderDriver;
15class Nvnflinger;
16} // namespace Service::Nvnflinger 15} // namespace Service::Nvnflinger
17 16
18namespace Service::VI { 17namespace Service::VI {
@@ -22,8 +21,8 @@ enum class Policy : u32;
22 21
23class ISystemRootService final : public ServiceFramework<ISystemRootService> { 22class ISystemRootService final : public ServiceFramework<ISystemRootService> {
24public: 23public:
25 explicit ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger, 24 explicit ISystemRootService(Core::System& system_,
26 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server); 25 std::shared_ptr<Nvnflinger::IHOSBinderDriver> binder_service);
27 ~ISystemRootService() override; 26 ~ISystemRootService() override;
28 27
29private: 28private:
@@ -31,8 +30,7 @@ private:
31 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, 30 Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
32 Policy policy); 31 Policy policy);
33 32
34 Nvnflinger::Nvnflinger& m_nvnflinger; 33 const std::shared_ptr<Nvnflinger::IHOSBinderDriver> m_binder_service;
35 Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
36}; 34};
37 35
38} // namespace Service::VI 36} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 304e589b7..d20f1fdea 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -1,7 +1,10 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/core.h"
5#include "core/hle/service/nvnflinger/hos_binder_driver.h"
4#include "core/hle/service/server_manager.h" 6#include "core/hle/service/server_manager.h"
7#include "core/hle/service/sm/sm.h"
5#include "core/hle/service/vi/application_display_service.h" 8#include "core/hle/service/vi/application_display_service.h"
6#include "core/hle/service/vi/application_root_service.h" 9#include "core/hle/service/vi/application_root_service.h"
7#include "core/hle/service/vi/manager_root_service.h" 10#include "core/hle/service/vi/manager_root_service.h"
@@ -10,16 +13,17 @@
10 13
11namespace Service::VI { 14namespace Service::VI {
12 15
13void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nvnflinger, 16void LoopProcess(Core::System& system) {
14 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) { 17 const auto binder_service =
18 system.ServiceManager().GetService<Nvnflinger::IHOSBinderDriver>("dispdrv", true);
15 auto server_manager = std::make_unique<ServerManager>(system); 19 auto server_manager = std::make_unique<ServerManager>(system);
16 20
17 server_manager->RegisterNamedService("vi:m", std::make_shared<IManagerRootService>(
18 system, nvnflinger, hos_binder_driver_server));
19 server_manager->RegisterNamedService( 21 server_manager->RegisterNamedService(
20 "vi:s", std::make_shared<ISystemRootService>(system, nvnflinger, hos_binder_driver_server)); 22 "vi:m", std::make_shared<IManagerRootService>(system, binder_service));
21 server_manager->RegisterNamedService("vi:u", std::make_shared<IApplicationRootService>( 23 server_manager->RegisterNamedService(
22 system, nvnflinger, hos_binder_driver_server)); 24 "vi:s", std::make_shared<ISystemRootService>(system, binder_service));
25 server_manager->RegisterNamedService(
26 "vi:u", std::make_shared<IApplicationRootService>(system, binder_service));
23 ServerManager::RunServer(std::move(server_manager)); 27 ServerManager::RunServer(std::move(server_manager));
24} 28}
25 29
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 8e681370d..0c3dc175d 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -7,14 +7,8 @@ namespace Core {
7class System; 7class System;
8} 8}
9 9
10namespace Service::Nvnflinger {
11class HosBinderDriverServer;
12class Nvnflinger;
13} // namespace Service::Nvnflinger
14
15namespace Service::VI { 10namespace Service::VI {
16 11
17void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nvnflinger, 12void LoopProcess(Core::System& system);
18 Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
19 13
20} // namespace Service::VI 14} // namespace Service::VI