summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-01-22 17:52:47 -0500
committerGravatar GitHub2018-01-22 17:52:47 -0500
commitd8bd70d396597d652e8eb891175192ffaf728593 (patch)
tree01062c3da533e1b1469fed9781c38aecb91ce3ba /src
parentMerge pull request #134 from gdkchan/audout_hid_fix (diff)
parentAppletOE: Stubbed CreateManagedDisplayLayer to create a new layer in the Defa... (diff)
downloadyuzu-d8bd70d396597d652e8eb891175192ffaf728593.tar.gz
yuzu-d8bd70d396597d652e8eb891175192ffaf728593.tar.xz
yuzu-d8bd70d396597d652e8eb891175192ffaf728593.zip
Merge pull request #133 from Subv/nvflinger2
AppletOE: Stubbed CreateManagedDisplayLayer to create a new layer in the default display.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/am/am.cpp5
-rw-r--r--src/core/hle/service/am/am.h8
-rw-r--r--src/core/hle/service/am/applet_oe.cpp32
-rw-r--r--src/core/hle/service/am/applet_oe.h9
-rw-r--r--src/core/hle/service/service.cpp8
-rw-r--r--src/core/hle/service/vi/vi.cpp5
-rw-r--r--src/core/hle/service/vi/vi.h3
-rw-r--r--src/core/hle/service/vi/vi_m.cpp4
-rw-r--r--src/core/hle/service/vi/vi_m.h2
9 files changed, 59 insertions, 17 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index a761bea65..b6896852e 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -8,8 +8,9 @@
8namespace Service { 8namespace Service {
9namespace AM { 9namespace AM {
10 10
11void InstallInterfaces(SM::ServiceManager& service_manager) { 11void InstallInterfaces(SM::ServiceManager& service_manager,
12 std::make_shared<AppletOE>()->InstallAsService(service_manager); 12 std::shared_ptr<NVFlinger::NVFlinger> nvflinger) {
13 std::make_shared<AppletOE>(nvflinger)->InstallAsService(service_manager);
13} 14}
14 15
15} // namespace AM 16} // namespace AM
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 63d86cd41..3b8a06c1d 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -4,13 +4,19 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
7#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
8 9
9namespace Service { 10namespace Service {
11namespace NVFlinger {
12class NVFlinger;
13}
14
10namespace AM { 15namespace AM {
11 16
12/// Registers all AM services with the specified service manager. 17/// Registers all AM services with the specified service manager.
13void InstallInterfaces(SM::ServiceManager& service_manager); 18void InstallInterfaces(SM::ServiceManager& service_manager,
19 std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
14 20
15} // namespace AM 21} // namespace AM
16} // namespace Service 22} // namespace Service
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
index b4a6ad232..7d16b45f3 100644
--- a/src/core/hle/service/am/applet_oe.cpp
+++ b/src/core/hle/service/am/applet_oe.cpp
@@ -7,6 +7,7 @@
7#include "core/hle/kernel/event.h" 7#include "core/hle/kernel/event.h"
8#include "core/hle/service/am/applet_oe.h" 8#include "core/hle/service/am/applet_oe.h"
9#include "core/hle/service/apm/apm.h" 9#include "core/hle/service/apm/apm.h"
10#include "core/hle/service/nvflinger/nvflinger.h"
10 11
11namespace Service { 12namespace Service {
12namespace AM { 13namespace AM {
@@ -53,7 +54,8 @@ public:
53 54
54class ISelfController final : public ServiceFramework<ISelfController> { 55class ISelfController final : public ServiceFramework<ISelfController> {
55public: 56public:
56 ISelfController() : ServiceFramework("ISelfController") { 57 ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
58 : ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger)) {
57 static const FunctionInfo functions[] = { 59 static const FunctionInfo functions[] = {
58 {1, &ISelfController::LockExit, "LockExit"}, 60 {1, &ISelfController::LockExit, "LockExit"},
59 {2, &ISelfController::UnlockExit, "UnlockExit"}, 61 {2, &ISelfController::UnlockExit, "UnlockExit"},
@@ -65,6 +67,7 @@ public:
65 {14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"}, 67 {14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"},
66 {16, &ISelfController::SetOutOfFocusSuspendingEnabled, 68 {16, &ISelfController::SetOutOfFocusSuspendingEnabled,
67 "SetOutOfFocusSuspendingEnabled"}, 69 "SetOutOfFocusSuspendingEnabled"},
70 {40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"},
68 }; 71 };
69 RegisterHandlers(functions); 72 RegisterHandlers(functions);
70 } 73 }
@@ -144,6 +147,21 @@ private:
144 147
145 LOG_WARNING(Service, "(STUBBED) called"); 148 LOG_WARNING(Service, "(STUBBED) called");
146 } 149 }
150
151 void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) {
152 // TODO(Subv): Find out how AM determines the display to use, for now just create the layer
153 // in the Default display.
154 u64 display_id = nvflinger->OpenDisplay("Default");
155 u64 layer_id = nvflinger->CreateLayer(display_id);
156
157 IPC::RequestBuilder rb{ctx, 4};
158 rb.Push(RESULT_SUCCESS);
159 rb.Push(layer_id);
160
161 LOG_WARNING(Service, "(STUBBED) called");
162 }
163
164 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
147}; 165};
148 166
149class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { 167class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
@@ -367,7 +385,8 @@ public:
367 385
368class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { 386class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
369public: 387public:
370 IApplicationProxy() : ServiceFramework("IApplicationProxy") { 388 IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
389 : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)) {
371 static const FunctionInfo functions[] = { 390 static const FunctionInfo functions[] = {
372 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 391 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
373 {1, &IApplicationProxy::GetSelfController, "GetSelfController"}, 392 {1, &IApplicationProxy::GetSelfController, "GetSelfController"},
@@ -413,7 +432,7 @@ private:
413 void GetSelfController(Kernel::HLERequestContext& ctx) { 432 void GetSelfController(Kernel::HLERequestContext& ctx) {
414 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; 433 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
415 rb.Push(RESULT_SUCCESS); 434 rb.Push(RESULT_SUCCESS);
416 rb.PushIpcInterface<ISelfController>(); 435 rb.PushIpcInterface<ISelfController>(nvflinger);
417 LOG_DEBUG(Service, "called"); 436 LOG_DEBUG(Service, "called");
418 } 437 }
419 438
@@ -437,16 +456,19 @@ private:
437 rb.PushIpcInterface<IApplicationFunctions>(); 456 rb.PushIpcInterface<IApplicationFunctions>();
438 LOG_DEBUG(Service, "called"); 457 LOG_DEBUG(Service, "called");
439 } 458 }
459
460 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
440}; 461};
441 462
442void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { 463void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
443 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; 464 IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
444 rb.Push(RESULT_SUCCESS); 465 rb.Push(RESULT_SUCCESS);
445 rb.PushIpcInterface<IApplicationProxy>(); 466 rb.PushIpcInterface<IApplicationProxy>(nvflinger);
446 LOG_DEBUG(Service, "called"); 467 LOG_DEBUG(Service, "called");
447} 468}
448 469
449AppletOE::AppletOE() : ServiceFramework("appletOE") { 470AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
471 : ServiceFramework("appletOE"), nvflinger(std::move(nvflinger)) {
450 static const FunctionInfo functions[] = { 472 static const FunctionInfo functions[] = {
451 {0x00000000, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, 473 {0x00000000, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"},
452 }; 474 };
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h
index 6ee5b0e9f..8083135c3 100644
--- a/src/core/hle/service/am/applet_oe.h
+++ b/src/core/hle/service/am/applet_oe.h
@@ -4,10 +4,15 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
7#include "core/hle/kernel/hle_ipc.h" 8#include "core/hle/kernel/hle_ipc.h"
8#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
9 10
10namespace Service { 11namespace Service {
12namespace NVFlinger {
13class NVFlinger;
14}
15
11namespace AM { 16namespace AM {
12 17
13// TODO: Add more languages 18// TODO: Add more languages
@@ -18,11 +23,13 @@ enum SystemLanguage {
18 23
19class AppletOE final : public ServiceFramework<AppletOE> { 24class AppletOE final : public ServiceFramework<AppletOE> {
20public: 25public:
21 AppletOE(); 26 AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
22 ~AppletOE() = default; 27 ~AppletOE() = default;
23 28
24private: 29private:
25 void OpenApplicationProxy(Kernel::HLERequestContext& ctx); 30 void OpenApplicationProxy(Kernel::HLERequestContext& ctx);
31
32 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
26}; 33};
27 34
28} // namespace AM 35} // namespace AM
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 3f5ce56c6..1b8565351 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -165,11 +165,15 @@ void AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
165 165
166/// Initialize ServiceManager 166/// Initialize ServiceManager
167void Init() { 167void Init() {
168 // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it
169 // here and pass it into the respective InstallInterfaces functions.
170 auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
171
168 SM::g_service_manager = std::make_shared<SM::ServiceManager>(); 172 SM::g_service_manager = std::make_shared<SM::ServiceManager>();
169 SM::ServiceManager::InstallInterfaces(SM::g_service_manager); 173 SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
170 174
171 Account::InstallInterfaces(*SM::g_service_manager); 175 Account::InstallInterfaces(*SM::g_service_manager);
172 AM::InstallInterfaces(*SM::g_service_manager); 176 AM::InstallInterfaces(*SM::g_service_manager, nv_flinger);
173 AOC::InstallInterfaces(*SM::g_service_manager); 177 AOC::InstallInterfaces(*SM::g_service_manager);
174 APM::InstallInterfaces(*SM::g_service_manager); 178 APM::InstallInterfaces(*SM::g_service_manager);
175 Audio::InstallInterfaces(*SM::g_service_manager); 179 Audio::InstallInterfaces(*SM::g_service_manager);
@@ -180,7 +184,7 @@ void Init() {
180 PCTL::InstallInterfaces(*SM::g_service_manager); 184 PCTL::InstallInterfaces(*SM::g_service_manager);
181 Sockets::InstallInterfaces(*SM::g_service_manager); 185 Sockets::InstallInterfaces(*SM::g_service_manager);
182 Time::InstallInterfaces(*SM::g_service_manager); 186 Time::InstallInterfaces(*SM::g_service_manager);
183 VI::InstallInterfaces(*SM::g_service_manager); 187 VI::InstallInterfaces(*SM::g_service_manager, nv_flinger);
184 Set::InstallInterfaces(*SM::g_service_manager); 188 Set::InstallInterfaces(*SM::g_service_manager);
185 189
186 LOG_DEBUG(Service, "initialized OK"); 190 LOG_DEBUG(Service, "initialized OK");
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index e0bfad290..6576f81db 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -753,8 +753,9 @@ IApplicationDisplayService::IApplicationDisplayService(
753 RegisterHandlers(functions); 753 RegisterHandlers(functions);
754} 754}
755 755
756void InstallInterfaces(SM::ServiceManager& service_manager) { 756void InstallInterfaces(SM::ServiceManager& service_manager,
757 std::make_shared<VI_M>()->InstallAsService(service_manager); 757 std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) {
758 std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager);
758} 759}
759 760
760} // namespace VI 761} // namespace VI
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 5e9b7e6cf..a6e084f87 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -39,7 +39,8 @@ private:
39}; 39};
40 40
41/// Registers all VI services with the specified service manager. 41/// Registers all VI services with the specified service manager.
42void InstallInterfaces(SM::ServiceManager& service_manager); 42void InstallInterfaces(SM::ServiceManager& service_manager,
43 std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
43 44
44} // namespace VI 45} // namespace VI
45} // namespace Service 46} // namespace Service
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp
index 6deedf842..20b24658e 100644
--- a/src/core/hle/service/vi/vi_m.cpp
+++ b/src/core/hle/service/vi/vi_m.cpp
@@ -17,13 +17,13 @@ void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
17 rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); 17 rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
18} 18}
19 19
20VI_M::VI_M() : ServiceFramework("vi:m") { 20VI_M::VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger)
21 : ServiceFramework("vi:m"), nv_flinger(std::move(nv_flinger)) {
21 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
22 {2, &VI_M::GetDisplayService, "GetDisplayService"}, 23 {2, &VI_M::GetDisplayService, "GetDisplayService"},
23 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, 24 {3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
24 }; 25 };
25 RegisterHandlers(functions); 26 RegisterHandlers(functions);
26 nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
27} 27}
28 28
29} // namespace VI 29} // namespace VI
diff --git a/src/core/hle/service/vi/vi_m.h b/src/core/hle/service/vi/vi_m.h
index ebe79d5c7..e5319b1e7 100644
--- a/src/core/hle/service/vi/vi_m.h
+++ b/src/core/hle/service/vi/vi_m.h
@@ -16,7 +16,7 @@ namespace VI {
16 16
17class VI_M final : public ServiceFramework<VI_M> { 17class VI_M final : public ServiceFramework<VI_M> {
18public: 18public:
19 VI_M(); 19 VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
20 ~VI_M() = default; 20 ~VI_M() = default;
21 21
22private: 22private: