diff options
| author | 2024-02-14 11:39:42 -0500 | |
|---|---|---|
| committer | 2024-02-17 18:01:41 -0500 | |
| commit | ee8eccc5fa473f2ce210eb4e242e8eca40594db7 (patch) | |
| tree | 5c38fc738e52be88eddd7733e0fdeb248ef4783f /src/core/hle/service/am | |
| parent | am: unify display layer management (diff) | |
| download | yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.tar.gz yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.tar.xz yuzu-ee8eccc5fa473f2ce210eb4e242e8eca40594db7.zip | |
nvnflinger: convert to process
Diffstat (limited to 'src/core/hle/service/am')
16 files changed, 72 insertions, 89 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 9dc710ba9..8c4e14f08 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -8,13 +8,13 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service::AM { | 9 | namespace Service::AM { |
| 10 | 10 | ||
| 11 | void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) { | 11 | void LoopProcess(Core::System& system) { |
| 12 | auto server_manager = std::make_unique<ServerManager>(system); | 12 | auto server_manager = std::make_unique<ServerManager>(system); |
| 13 | 13 | ||
| 14 | server_manager->RegisterNamedService( | 14 | server_manager->RegisterNamedService("appletAE", |
| 15 | "appletAE", std::make_shared<IAllSystemAppletProxiesService>(system, nvnflinger)); | 15 | std::make_shared<IAllSystemAppletProxiesService>(system)); |
| 16 | server_manager->RegisterNamedService( | 16 | server_manager->RegisterNamedService("appletOE", |
| 17 | "appletOE", std::make_shared<IApplicationProxyService>(system, nvnflinger)); | 17 | std::make_shared<IApplicationProxyService>(system)); |
| 18 | ServerManager::RunServer(std::move(server_manager)); | 18 | ServerManager::RunServer(std::move(server_manager)); |
| 19 | } | 19 | } |
| 20 | 20 | ||
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 4a2d797bd..1afe253ae 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -7,12 +7,8 @@ namespace Core { | |||
| 7 | class System; | 7 | class System; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | namespace Service::Nvnflinger { | ||
| 11 | class Nvnflinger; | ||
| 12 | } | ||
| 13 | |||
| 14 | namespace Service::AM { | 10 | namespace Service::AM { |
| 15 | 11 | ||
| 16 | void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system); | 12 | void LoopProcess(Core::System& system); |
| 17 | 13 | ||
| 18 | } // namespace Service::AM | 14 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/display_layer_manager.cpp b/src/core/hle/service/am/display_layer_manager.cpp index 50674c325..6cf3c369c 100644 --- a/src/core/hle/service/am/display_layer_manager.cpp +++ b/src/core/hle/service/am/display_layer_manager.cpp | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2024 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" | ||
| 4 | #include "core/hle/service/am/display_layer_manager.h" | 5 | #include "core/hle/service/am/display_layer_manager.h" |
| 5 | #include "core/hle/service/nvnflinger/fb_share_buffer_manager.h" | 6 | #include "core/hle/service/nvnflinger/fb_share_buffer_manager.h" |
| 7 | #include "core/hle/service/nvnflinger/hos_binder_driver.h" | ||
| 6 | #include "core/hle/service/nvnflinger/nvnflinger.h" | 8 | #include "core/hle/service/nvnflinger/nvnflinger.h" |
| 9 | #include "core/hle/service/sm/sm.h" | ||
| 7 | #include "core/hle/service/vi/vi_results.h" | 10 | #include "core/hle/service/vi/vi_results.h" |
| 8 | 11 | ||
| 9 | namespace Service::AM { | 12 | namespace Service::AM { |
| @@ -13,10 +16,12 @@ DisplayLayerManager::~DisplayLayerManager() { | |||
| 13 | this->Finalize(); | 16 | this->Finalize(); |
| 14 | } | 17 | } |
| 15 | 18 | ||
| 16 | void DisplayLayerManager::Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel::KProcess* process, | 19 | void DisplayLayerManager::Initialize(Core::System& system, Kernel::KProcess* process, |
| 17 | AppletId applet_id, LibraryAppletMode mode) { | 20 | AppletId applet_id, LibraryAppletMode mode) { |
| 18 | m_process = process; | 21 | m_process = process; |
| 19 | m_nvnflinger = nvnflinger; | 22 | m_surface_flinger = system.ServiceManager() |
| 23 | .GetService<Nvnflinger::IHOSBinderDriver>("dispdrv", true) | ||
| 24 | ->GetSurfaceFlinger(); | ||
| 20 | m_system_shared_buffer_id = 0; | 25 | m_system_shared_buffer_id = 0; |
| 21 | m_system_shared_layer_id = 0; | 26 | m_system_shared_layer_id = 0; |
| 22 | m_applet_id = applet_id; | 27 | m_applet_id = applet_id; |
| @@ -26,36 +31,36 @@ void DisplayLayerManager::Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel: | |||
| 26 | } | 31 | } |
| 27 | 32 | ||
| 28 | void DisplayLayerManager::Finalize() { | 33 | void DisplayLayerManager::Finalize() { |
| 29 | if (!m_nvnflinger) { | 34 | if (!m_surface_flinger) { |
| 30 | return; | 35 | return; |
| 31 | } | 36 | } |
| 32 | 37 | ||
| 33 | // Clean up managed layers. | 38 | // Clean up managed layers. |
| 34 | for (const auto& layer : m_managed_display_layers) { | 39 | for (const auto& layer : m_managed_display_layers) { |
| 35 | m_nvnflinger->DestroyLayer(layer); | 40 | m_surface_flinger->DestroyLayer(layer); |
| 36 | } | 41 | } |
| 37 | 42 | ||
| 38 | for (const auto& layer : m_managed_display_recording_layers) { | 43 | for (const auto& layer : m_managed_display_recording_layers) { |
| 39 | m_nvnflinger->DestroyLayer(layer); | 44 | m_surface_flinger->DestroyLayer(layer); |
| 40 | } | 45 | } |
| 41 | 46 | ||
| 42 | // Clean up shared layers. | 47 | // Clean up shared layers. |
| 43 | if (m_buffer_sharing_enabled) { | 48 | if (m_buffer_sharing_enabled) { |
| 44 | m_nvnflinger->GetSystemBufferManager().Finalize(m_process); | 49 | m_surface_flinger->GetSystemBufferManager().Finalize(m_process); |
| 45 | } | 50 | } |
| 46 | 51 | ||
| 47 | m_nvnflinger = nullptr; | 52 | m_surface_flinger = nullptr; |
| 48 | } | 53 | } |
| 49 | 54 | ||
| 50 | Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer) { | 55 | Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer) { |
| 51 | R_UNLESS(m_nvnflinger != nullptr, VI::ResultOperationFailed); | 56 | R_UNLESS(m_surface_flinger != nullptr, VI::ResultOperationFailed); |
| 52 | 57 | ||
| 53 | // TODO(Subv): Find out how AM determines the display to use, for now just | 58 | // TODO(Subv): Find out how AM determines the display to use, for now just |
| 54 | // create the layer in the Default display. | 59 | // create the layer in the Default display. |
| 55 | const auto display_id = m_nvnflinger->OpenDisplay("Default"); | 60 | const auto display_id = m_surface_flinger->OpenDisplay("Default"); |
| 56 | const auto layer_id = m_nvnflinger->CreateLayer(*display_id); | 61 | const auto layer_id = m_surface_flinger->CreateLayer(*display_id); |
| 57 | 62 | ||
| 58 | m_nvnflinger->SetLayerVisibility(*layer_id, m_visible); | 63 | m_surface_flinger->SetLayerVisibility(*layer_id, m_visible); |
| 59 | m_managed_display_layers.emplace(*layer_id); | 64 | m_managed_display_layers.emplace(*layer_id); |
| 60 | 65 | ||
| 61 | *out_layer = *layer_id; | 66 | *out_layer = *layer_id; |
| @@ -65,7 +70,7 @@ Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer) { | |||
| 65 | 70 | ||
| 66 | Result DisplayLayerManager::CreateManagedDisplaySeparableLayer(u64* out_layer, | 71 | Result DisplayLayerManager::CreateManagedDisplaySeparableLayer(u64* out_layer, |
| 67 | u64* out_recording_layer) { | 72 | u64* out_recording_layer) { |
| 68 | R_UNLESS(m_nvnflinger != nullptr, VI::ResultOperationFailed); | 73 | R_UNLESS(m_surface_flinger != nullptr, VI::ResultOperationFailed); |
| 69 | 74 | ||
| 70 | // TODO(Subv): Find out how AM determines the display to use, for now just | 75 | // TODO(Subv): Find out how AM determines the display to use, for now just |
| 71 | // create the layer in the Default display. | 76 | // create the layer in the Default display. |
| @@ -74,10 +79,10 @@ Result DisplayLayerManager::CreateManagedDisplaySeparableLayer(u64* out_layer, | |||
| 74 | // Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse | 79 | // Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse |
| 75 | // side effects. | 80 | // side effects. |
| 76 | // TODO: Support multiple layers | 81 | // TODO: Support multiple layers |
| 77 | const auto display_id = m_nvnflinger->OpenDisplay("Default"); | 82 | const auto display_id = m_surface_flinger->OpenDisplay("Default"); |
| 78 | const auto layer_id = m_nvnflinger->CreateLayer(*display_id); | 83 | const auto layer_id = m_surface_flinger->CreateLayer(*display_id); |
| 79 | 84 | ||
| 80 | m_nvnflinger->SetLayerVisibility(*layer_id, m_visible); | 85 | m_surface_flinger->SetLayerVisibility(*layer_id, m_visible); |
| 81 | m_managed_display_layers.emplace(*layer_id); | 86 | m_managed_display_layers.emplace(*layer_id); |
| 82 | 87 | ||
| 83 | *out_layer = *layer_id; | 88 | *out_layer = *layer_id; |
| @@ -91,19 +96,19 @@ Result DisplayLayerManager::IsSystemBufferSharingEnabled() { | |||
| 91 | R_SUCCEED_IF(m_buffer_sharing_enabled); | 96 | R_SUCCEED_IF(m_buffer_sharing_enabled); |
| 92 | 97 | ||
| 93 | // Ensure we can access shared layers. | 98 | // Ensure we can access shared layers. |
| 94 | R_UNLESS(m_nvnflinger != nullptr, VI::ResultOperationFailed); | 99 | R_UNLESS(m_surface_flinger != nullptr, VI::ResultOperationFailed); |
| 95 | R_UNLESS(m_applet_id != AppletId::Application, VI::ResultPermissionDenied); | 100 | R_UNLESS(m_applet_id != AppletId::Application, VI::ResultPermissionDenied); |
| 96 | 101 | ||
| 97 | // Create the shared layer. | 102 | // Create the shared layer. |
| 98 | const auto blend = | 103 | const auto blend = |
| 99 | m_blending_enabled ? Nvnflinger::LayerBlending::Coverage : Nvnflinger::LayerBlending::None; | 104 | m_blending_enabled ? Nvnflinger::LayerBlending::Coverage : Nvnflinger::LayerBlending::None; |
| 100 | const auto display_id = m_nvnflinger->OpenDisplay("Default").value(); | 105 | const auto display_id = m_surface_flinger->OpenDisplay("Default").value(); |
| 101 | R_TRY(m_nvnflinger->GetSystemBufferManager().Initialize( | 106 | R_TRY(m_surface_flinger->GetSystemBufferManager().Initialize( |
| 102 | m_process, &m_system_shared_buffer_id, &m_system_shared_layer_id, display_id, blend)); | 107 | m_process, &m_system_shared_buffer_id, &m_system_shared_layer_id, display_id, blend)); |
| 103 | 108 | ||
| 104 | // We succeeded, so set up remaining state. | 109 | // We succeeded, so set up remaining state. |
| 105 | m_buffer_sharing_enabled = true; | 110 | m_buffer_sharing_enabled = true; |
| 106 | m_nvnflinger->SetLayerVisibility(m_system_shared_layer_id, m_visible); | 111 | m_surface_flinger->SetLayerVisibility(m_system_shared_layer_id, m_visible); |
| 107 | R_SUCCEED(); | 112 | R_SUCCEED(); |
| 108 | } | 113 | } |
| 109 | 114 | ||
| @@ -124,13 +129,13 @@ void DisplayLayerManager::SetWindowVisibility(bool visible) { | |||
| 124 | 129 | ||
| 125 | m_visible = visible; | 130 | m_visible = visible; |
| 126 | 131 | ||
| 127 | if (m_nvnflinger) { | 132 | if (m_surface_flinger) { |
| 128 | if (m_system_shared_layer_id) { | 133 | if (m_system_shared_layer_id) { |
| 129 | m_nvnflinger->SetLayerVisibility(m_system_shared_layer_id, m_visible); | 134 | m_surface_flinger->SetLayerVisibility(m_system_shared_layer_id, m_visible); |
| 130 | } | 135 | } |
| 131 | 136 | ||
| 132 | for (const auto layer_id : m_managed_display_layers) { | 137 | for (const auto layer_id : m_managed_display_layers) { |
| 133 | m_nvnflinger->SetLayerVisibility(layer_id, m_visible); | 138 | m_surface_flinger->SetLayerVisibility(layer_id, m_visible); |
| 134 | } | 139 | } |
| 135 | } | 140 | } |
| 136 | } | 141 | } |
| @@ -142,7 +147,7 @@ bool DisplayLayerManager::GetWindowVisibility() const { | |||
| 142 | Result DisplayLayerManager::WriteAppletCaptureBuffer(bool* out_was_written, | 147 | Result DisplayLayerManager::WriteAppletCaptureBuffer(bool* out_was_written, |
| 143 | s32* out_fbshare_layer_index) { | 148 | s32* out_fbshare_layer_index) { |
| 144 | R_UNLESS(m_buffer_sharing_enabled, VI::ResultPermissionDenied); | 149 | R_UNLESS(m_buffer_sharing_enabled, VI::ResultPermissionDenied); |
| 145 | R_RETURN(m_nvnflinger->GetSystemBufferManager().WriteAppletCaptureBuffer( | 150 | R_RETURN(m_surface_flinger->GetSystemBufferManager().WriteAppletCaptureBuffer( |
| 146 | out_was_written, out_fbshare_layer_index)); | 151 | out_was_written, out_fbshare_layer_index)); |
| 147 | } | 152 | } |
| 148 | 153 | ||
diff --git a/src/core/hle/service/am/display_layer_manager.h b/src/core/hle/service/am/display_layer_manager.h index 45023a88c..92ab9399f 100644 --- a/src/core/hle/service/am/display_layer_manager.h +++ b/src/core/hle/service/am/display_layer_manager.h | |||
| @@ -9,6 +9,10 @@ | |||
| 9 | #include "core/hle/result.h" | 9 | #include "core/hle/result.h" |
| 10 | #include "core/hle/service/am/am_types.h" | 10 | #include "core/hle/service/am/am_types.h" |
| 11 | 11 | ||
| 12 | namespace Core { | ||
| 13 | class System; | ||
| 14 | } | ||
| 15 | |||
| 12 | namespace Kernel { | 16 | namespace Kernel { |
| 13 | class KProcess; | 17 | class KProcess; |
| 14 | } | 18 | } |
| @@ -24,8 +28,8 @@ public: | |||
| 24 | explicit DisplayLayerManager(); | 28 | explicit DisplayLayerManager(); |
| 25 | ~DisplayLayerManager(); | 29 | ~DisplayLayerManager(); |
| 26 | 30 | ||
| 27 | void Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel::KProcess* process, | 31 | void Initialize(Core::System& system, Kernel::KProcess* process, AppletId applet_id, |
| 28 | AppletId applet_id, LibraryAppletMode mode); | 32 | LibraryAppletMode mode); |
| 29 | void Finalize(); | 33 | void Finalize(); |
| 30 | 34 | ||
| 31 | Result CreateManagedDisplayLayer(u64* out_layer); | 35 | Result CreateManagedDisplayLayer(u64* out_layer); |
| @@ -42,7 +46,7 @@ public: | |||
| 42 | 46 | ||
| 43 | private: | 47 | private: |
| 44 | Kernel::KProcess* m_process{}; | 48 | Kernel::KProcess* m_process{}; |
| 45 | Nvnflinger::Nvnflinger* m_nvnflinger{}; | 49 | std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger{}; |
| 46 | std::set<u64> m_managed_display_layers{}; | 50 | std::set<u64> m_managed_display_layers{}; |
| 47 | std::set<u64> m_managed_display_recording_layers{}; | 51 | std::set<u64> m_managed_display_recording_layers{}; |
| 48 | u64 m_system_shared_buffer_id{}; | 52 | u64 m_system_shared_buffer_id{}; |
diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp index eebd90ba2..21747783a 100644 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp +++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.cpp | |||
| @@ -10,9 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | namespace Service::AM { | 11 | namespace Service::AM { |
| 12 | 12 | ||
| 13 | IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_, | 13 | IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_) |
| 14 | Nvnflinger::Nvnflinger& nvnflinger) | 14 | : ServiceFramework{system_, "appletAE"} { |
| 15 | : ServiceFramework{system_, "appletAE"}, m_nvnflinger{nvnflinger} { | ||
| 16 | // clang-format off | 15 | // clang-format off |
| 17 | static const FunctionInfo functions[] = { | 16 | static const FunctionInfo functions[] = { |
| 18 | {100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, | 17 | {100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, |
| @@ -37,8 +36,8 @@ Result IAllSystemAppletProxiesService::OpenSystemAppletProxy( | |||
| 37 | LOG_DEBUG(Service_AM, "called"); | 36 | LOG_DEBUG(Service_AM, "called"); |
| 38 | 37 | ||
| 39 | if (const auto applet = this->GetAppletFromProcessId(pid); applet) { | 38 | if (const auto applet = this->GetAppletFromProcessId(pid); applet) { |
| 40 | *out_system_applet_proxy = std::make_shared<ISystemAppletProxy>( | 39 | *out_system_applet_proxy = |
| 41 | system, applet, process_handle.Get(), m_nvnflinger); | 40 | std::make_shared<ISystemAppletProxy>(system, applet, process_handle.Get()); |
| 42 | R_SUCCEED(); | 41 | R_SUCCEED(); |
| 43 | } else { | 42 | } else { |
| 44 | UNIMPLEMENTED(); | 43 | UNIMPLEMENTED(); |
| @@ -53,8 +52,8 @@ Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy( | |||
| 53 | LOG_DEBUG(Service_AM, "called"); | 52 | LOG_DEBUG(Service_AM, "called"); |
| 54 | 53 | ||
| 55 | if (const auto applet = this->GetAppletFromProcessId(pid); applet) { | 54 | if (const auto applet = this->GetAppletFromProcessId(pid); applet) { |
| 56 | *out_library_applet_proxy = std::make_shared<ILibraryAppletProxy>( | 55 | *out_library_applet_proxy = |
| 57 | system, applet, process_handle.Get(), m_nvnflinger); | 56 | std::make_shared<ILibraryAppletProxy>(system, applet, process_handle.Get()); |
| 58 | R_SUCCEED(); | 57 | R_SUCCEED(); |
| 59 | } else { | 58 | } else { |
| 60 | UNIMPLEMENTED(); | 59 | UNIMPLEMENTED(); |
diff --git a/src/core/hle/service/am/service/all_system_applet_proxies_service.h b/src/core/hle/service/am/service/all_system_applet_proxies_service.h index 38b1ca2ea..0e2dcb86d 100644 --- a/src/core/hle/service/am/service/all_system_applet_proxies_service.h +++ b/src/core/hle/service/am/service/all_system_applet_proxies_service.h | |||
| @@ -8,10 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service { | 9 | namespace Service { |
| 10 | 10 | ||
| 11 | namespace Nvnflinger { | ||
| 12 | class Nvnflinger; | ||
| 13 | } | ||
| 14 | |||
| 15 | namespace AM { | 11 | namespace AM { |
| 16 | 12 | ||
| 17 | struct Applet; | 13 | struct Applet; |
| @@ -22,8 +18,7 @@ class ISystemAppletProxy; | |||
| 22 | class IAllSystemAppletProxiesService final | 18 | class IAllSystemAppletProxiesService final |
| 23 | : public ServiceFramework<IAllSystemAppletProxiesService> { | 19 | : public ServiceFramework<IAllSystemAppletProxiesService> { |
| 24 | public: | 20 | public: |
| 25 | explicit IAllSystemAppletProxiesService(Core::System& system_, | 21 | explicit IAllSystemAppletProxiesService(Core::System& system_); |
| 26 | Nvnflinger::Nvnflinger& nvnflinger); | ||
| 27 | ~IAllSystemAppletProxiesService() override; | 22 | ~IAllSystemAppletProxiesService() override; |
| 28 | 23 | ||
| 29 | private: | 24 | private: |
| @@ -40,7 +35,6 @@ private: | |||
| 40 | 35 | ||
| 41 | private: | 36 | private: |
| 42 | std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid); | 37 | std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid); |
| 43 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 44 | }; | 38 | }; |
| 45 | 39 | ||
| 46 | } // namespace AM | 40 | } // namespace AM |
diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp index 776f4552b..19d6a3b89 100644 --- a/src/core/hle/service/am/service/application_proxy.cpp +++ b/src/core/hle/service/am/service/application_proxy.cpp | |||
| @@ -17,9 +17,9 @@ | |||
| 17 | namespace Service::AM { | 17 | namespace Service::AM { |
| 18 | 18 | ||
| 19 | IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, | 19 | IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, |
| 20 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger) | 20 | Kernel::KProcess* process) |
| 21 | : ServiceFramework{system_, "IApplicationProxy"}, | 21 | : ServiceFramework{system_, "IApplicationProxy"}, m_process{process}, m_applet{ |
| 22 | m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} { | 22 | std::move(applet)} { |
| 23 | // clang-format off | 23 | // clang-format off |
| 24 | static const FunctionInfo functions[] = { | 24 | static const FunctionInfo functions[] = { |
| 25 | {0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, | 25 | {0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, |
| @@ -77,8 +77,7 @@ Result IApplicationProxy::GetWindowController( | |||
| 77 | Result IApplicationProxy::GetSelfController( | 77 | Result IApplicationProxy::GetSelfController( |
| 78 | Out<SharedPointer<ISelfController>> out_self_controller) { | 78 | Out<SharedPointer<ISelfController>> out_self_controller) { |
| 79 | LOG_DEBUG(Service_AM, "called"); | 79 | LOG_DEBUG(Service_AM, "called"); |
| 80 | *out_self_controller = | 80 | *out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_process); |
| 81 | std::make_shared<ISelfController>(system, m_applet, m_process, m_nvnflinger); | ||
| 82 | R_SUCCEED(); | 81 | R_SUCCEED(); |
| 83 | } | 82 | } |
| 84 | 83 | ||
diff --git a/src/core/hle/service/am/service/application_proxy.h b/src/core/hle/service/am/service/application_proxy.h index 1ebc593ba..6da350df7 100644 --- a/src/core/hle/service/am/service/application_proxy.h +++ b/src/core/hle/service/am/service/application_proxy.h | |||
| @@ -22,7 +22,7 @@ class IWindowController; | |||
| 22 | class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { | 22 | class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { |
| 23 | public: | 23 | public: |
| 24 | explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, | 24 | explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, |
| 25 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger); | 25 | Kernel::KProcess* process); |
| 26 | ~IApplicationProxy(); | 26 | ~IApplicationProxy(); |
| 27 | 27 | ||
| 28 | private: | 28 | private: |
| @@ -40,7 +40,6 @@ private: | |||
| 40 | Out<SharedPointer<IApplicationFunctions>> out_application_functions); | 40 | Out<SharedPointer<IApplicationFunctions>> out_application_functions); |
| 41 | 41 | ||
| 42 | private: | 42 | private: |
| 43 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 44 | Kernel::KProcess* const m_process; | 43 | Kernel::KProcess* const m_process; |
| 45 | const std::shared_ptr<Applet> m_applet; | 44 | const std::shared_ptr<Applet> m_applet; |
| 46 | }; | 45 | }; |
diff --git a/src/core/hle/service/am/service/application_proxy_service.cpp b/src/core/hle/service/am/service/application_proxy_service.cpp index 36d4478df..fd66e77b9 100644 --- a/src/core/hle/service/am/service/application_proxy_service.cpp +++ b/src/core/hle/service/am/service/application_proxy_service.cpp | |||
| @@ -10,9 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | namespace Service::AM { | 11 | namespace Service::AM { |
| 12 | 12 | ||
| 13 | IApplicationProxyService::IApplicationProxyService(Core::System& system_, | 13 | IApplicationProxyService::IApplicationProxyService(Core::System& system_) |
| 14 | Nvnflinger::Nvnflinger& nvnflinger) | 14 | : ServiceFramework{system_, "appletOE"} { |
| 15 | : ServiceFramework{system_, "appletOE"}, m_nvnflinger{nvnflinger} { | ||
| 16 | static const FunctionInfo functions[] = { | 15 | static const FunctionInfo functions[] = { |
| 17 | {0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"}, | 16 | {0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"}, |
| 18 | }; | 17 | }; |
| @@ -28,7 +27,7 @@ Result IApplicationProxyService::OpenApplicationProxy( | |||
| 28 | 27 | ||
| 29 | if (const auto applet = this->GetAppletFromProcessId(pid)) { | 28 | if (const auto applet = this->GetAppletFromProcessId(pid)) { |
| 30 | *out_application_proxy = | 29 | *out_application_proxy = |
| 31 | std::make_shared<IApplicationProxy>(system, applet, process_handle.Get(), m_nvnflinger); | 30 | std::make_shared<IApplicationProxy>(system, applet, process_handle.Get()); |
| 32 | R_SUCCEED(); | 31 | R_SUCCEED(); |
| 33 | } else { | 32 | } else { |
| 34 | UNIMPLEMENTED(); | 33 | UNIMPLEMENTED(); |
diff --git a/src/core/hle/service/am/service/application_proxy_service.h b/src/core/hle/service/am/service/application_proxy_service.h index 1c1d32d0b..8efafa31a 100644 --- a/src/core/hle/service/am/service/application_proxy_service.h +++ b/src/core/hle/service/am/service/application_proxy_service.h | |||
| @@ -8,10 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service { | 9 | namespace Service { |
| 10 | 10 | ||
| 11 | namespace Nvnflinger { | ||
| 12 | class Nvnflinger; | ||
| 13 | } | ||
| 14 | |||
| 15 | namespace AM { | 11 | namespace AM { |
| 16 | 12 | ||
| 17 | struct Applet; | 13 | struct Applet; |
| @@ -19,7 +15,7 @@ class IApplicationProxy; | |||
| 19 | 15 | ||
| 20 | class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> { | 16 | class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> { |
| 21 | public: | 17 | public: |
| 22 | explicit IApplicationProxyService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger); | 18 | explicit IApplicationProxyService(Core::System& system_); |
| 23 | ~IApplicationProxyService() override; | 19 | ~IApplicationProxyService() override; |
| 24 | 20 | ||
| 25 | private: | 21 | private: |
| @@ -28,7 +24,6 @@ private: | |||
| 28 | 24 | ||
| 29 | private: | 25 | private: |
| 30 | std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid); | 26 | std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid); |
| 31 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 32 | }; | 27 | }; |
| 33 | 28 | ||
| 34 | } // namespace AM | 29 | } // namespace AM |
diff --git a/src/core/hle/service/am/service/library_applet_proxy.cpp b/src/core/hle/service/am/service/library_applet_proxy.cpp index bcb44a71c..58e709347 100644 --- a/src/core/hle/service/am/service/library_applet_proxy.cpp +++ b/src/core/hle/service/am/service/library_applet_proxy.cpp | |||
| @@ -19,10 +19,9 @@ | |||
| 19 | namespace Service::AM { | 19 | namespace Service::AM { |
| 20 | 20 | ||
| 21 | ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, | 21 | ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, |
| 22 | Kernel::KProcess* process, | 22 | Kernel::KProcess* process) |
| 23 | Nvnflinger::Nvnflinger& nvnflinger) | 23 | : ServiceFramework{system_, "ILibraryAppletProxy"}, m_process{process}, m_applet{ |
| 24 | : ServiceFramework{system_, "ILibraryAppletProxy"}, | 24 | std::move(applet)} { |
| 25 | m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} { | ||
| 26 | // clang-format off | 25 | // clang-format off |
| 27 | static const FunctionInfo functions[] = { | 26 | static const FunctionInfo functions[] = { |
| 28 | {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, | 27 | {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, |
| @@ -83,8 +82,7 @@ Result ILibraryAppletProxy::GetWindowController( | |||
| 83 | Result ILibraryAppletProxy::GetSelfController( | 82 | Result ILibraryAppletProxy::GetSelfController( |
| 84 | Out<SharedPointer<ISelfController>> out_self_controller) { | 83 | Out<SharedPointer<ISelfController>> out_self_controller) { |
| 85 | LOG_DEBUG(Service_AM, "called"); | 84 | LOG_DEBUG(Service_AM, "called"); |
| 86 | *out_self_controller = | 85 | *out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_process); |
| 87 | std::make_shared<ISelfController>(system, m_applet, m_process, m_nvnflinger); | ||
| 88 | R_SUCCEED(); | 86 | R_SUCCEED(); |
| 89 | } | 87 | } |
| 90 | 88 | ||
diff --git a/src/core/hle/service/am/service/library_applet_proxy.h b/src/core/hle/service/am/service/library_applet_proxy.h index 23e64e295..7d0714b85 100644 --- a/src/core/hle/service/am/service/library_applet_proxy.h +++ b/src/core/hle/service/am/service/library_applet_proxy.h | |||
| @@ -25,7 +25,7 @@ class IWindowController; | |||
| 25 | class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { | 25 | class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { |
| 26 | public: | 26 | public: |
| 27 | explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, | 27 | explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, |
| 28 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger); | 28 | Kernel::KProcess* process); |
| 29 | ~ILibraryAppletProxy(); | 29 | ~ILibraryAppletProxy(); |
| 30 | 30 | ||
| 31 | private: | 31 | private: |
| @@ -47,7 +47,6 @@ private: | |||
| 47 | Result GetGlobalStateController( | 47 | Result GetGlobalStateController( |
| 48 | Out<SharedPointer<IGlobalStateController>> out_global_state_controller); | 48 | Out<SharedPointer<IGlobalStateController>> out_global_state_controller); |
| 49 | 49 | ||
| 50 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 51 | Kernel::KProcess* const m_process; | 50 | Kernel::KProcess* const m_process; |
| 52 | const std::shared_ptr<Applet> m_applet; | 51 | const std::shared_ptr<Applet> m_applet; |
| 53 | }; | 52 | }; |
diff --git a/src/core/hle/service/am/service/self_controller.cpp b/src/core/hle/service/am/service/self_controller.cpp index 6b77e423a..06314407c 100644 --- a/src/core/hle/service/am/service/self_controller.cpp +++ b/src/core/hle/service/am/service/self_controller.cpp | |||
| @@ -15,9 +15,9 @@ | |||
| 15 | namespace Service::AM { | 15 | namespace Service::AM { |
| 16 | 16 | ||
| 17 | ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet, | 17 | ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> applet, |
| 18 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger) | 18 | Kernel::KProcess* process) |
| 19 | : ServiceFramework{system_, "ISelfController"}, m_nvnflinger{nvnflinger}, m_process{process}, | 19 | : ServiceFramework{system_, "ISelfController"}, m_process{process}, m_applet{ |
| 20 | m_applet{std::move(applet)} { | 20 | std::move(applet)} { |
| 21 | // clang-format off | 21 | // clang-format off |
| 22 | static const FunctionInfo functions[] = { | 22 | static const FunctionInfo functions[] = { |
| 23 | {0, D<&ISelfController::Exit>, "Exit"}, | 23 | {0, D<&ISelfController::Exit>, "Exit"}, |
| @@ -74,7 +74,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> | |||
| 74 | RegisterHandlers(functions); | 74 | RegisterHandlers(functions); |
| 75 | 75 | ||
| 76 | std::scoped_lock lk{m_applet->lock}; | 76 | std::scoped_lock lk{m_applet->lock}; |
| 77 | m_applet->display_layer_manager.Initialize(&m_nvnflinger, m_process, m_applet->applet_id, | 77 | m_applet->display_layer_manager.Initialize(system, m_process, m_applet->applet_id, |
| 78 | m_applet->library_applet_mode); | 78 | m_applet->library_applet_mode); |
| 79 | } | 79 | } |
| 80 | 80 | ||
diff --git a/src/core/hle/service/am/service/self_controller.h b/src/core/hle/service/am/service/self_controller.h index 01fa381a3..eca083cfe 100644 --- a/src/core/hle/service/am/service/self_controller.h +++ b/src/core/hle/service/am/service/self_controller.h | |||
| @@ -23,7 +23,7 @@ struct Applet; | |||
| 23 | class ISelfController final : public ServiceFramework<ISelfController> { | 23 | class ISelfController final : public ServiceFramework<ISelfController> { |
| 24 | public: | 24 | public: |
| 25 | explicit ISelfController(Core::System& system_, std::shared_ptr<Applet> applet, | 25 | explicit ISelfController(Core::System& system_, std::shared_ptr<Applet> applet, |
| 26 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger); | 26 | Kernel::KProcess* process); |
| 27 | ~ISelfController() override; | 27 | ~ISelfController() override; |
| 28 | 28 | ||
| 29 | private: | 29 | private: |
| @@ -64,7 +64,6 @@ private: | |||
| 64 | Result SaveCurrentScreenshot(Capture::AlbumReportOption album_report_option); | 64 | Result SaveCurrentScreenshot(Capture::AlbumReportOption album_report_option); |
| 65 | Result SetRecordVolumeMuted(bool muted); | 65 | Result SetRecordVolumeMuted(bool muted); |
| 66 | 66 | ||
| 67 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 68 | Kernel::KProcess* const m_process; | 67 | Kernel::KProcess* const m_process; |
| 69 | const std::shared_ptr<Applet> m_applet; | 68 | const std::shared_ptr<Applet> m_applet; |
| 70 | }; | 69 | }; |
diff --git a/src/core/hle/service/am/service/system_applet_proxy.cpp b/src/core/hle/service/am/service/system_applet_proxy.cpp index 5ec509d2e..d1871ef9b 100644 --- a/src/core/hle/service/am/service/system_applet_proxy.cpp +++ b/src/core/hle/service/am/service/system_applet_proxy.cpp | |||
| @@ -19,10 +19,9 @@ | |||
| 19 | namespace Service::AM { | 19 | namespace Service::AM { |
| 20 | 20 | ||
| 21 | ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, | 21 | ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, |
| 22 | Kernel::KProcess* process, | 22 | Kernel::KProcess* process) |
| 23 | Nvnflinger::Nvnflinger& nvnflinger) | 23 | : ServiceFramework{system_, "ISystemAppletProxy"}, m_process{process}, m_applet{ |
| 24 | : ServiceFramework{system_, "ISystemAppletProxy"}, | 24 | std::move(applet)} { |
| 25 | m_nvnflinger{nvnflinger}, m_process{process}, m_applet{std::move(applet)} { | ||
| 26 | // clang-format off | 25 | // clang-format off |
| 27 | static const FunctionInfo functions[] = { | 26 | static const FunctionInfo functions[] = { |
| 28 | {0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, | 27 | {0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, |
| @@ -83,8 +82,7 @@ Result ISystemAppletProxy::GetWindowController( | |||
| 83 | Result ISystemAppletProxy::GetSelfController( | 82 | Result ISystemAppletProxy::GetSelfController( |
| 84 | Out<SharedPointer<ISelfController>> out_self_controller) { | 83 | Out<SharedPointer<ISelfController>> out_self_controller) { |
| 85 | LOG_DEBUG(Service_AM, "called"); | 84 | LOG_DEBUG(Service_AM, "called"); |
| 86 | *out_self_controller = | 85 | *out_self_controller = std::make_shared<ISelfController>(system, m_applet, m_process); |
| 87 | std::make_shared<ISelfController>(system, m_applet, m_process, m_nvnflinger); | ||
| 88 | R_SUCCEED(); | 86 | R_SUCCEED(); |
| 89 | } | 87 | } |
| 90 | 88 | ||
diff --git a/src/core/hle/service/am/service/system_applet_proxy.h b/src/core/hle/service/am/service/system_applet_proxy.h index 3d5040315..67cd50e03 100644 --- a/src/core/hle/service/am/service/system_applet_proxy.h +++ b/src/core/hle/service/am/service/system_applet_proxy.h | |||
| @@ -25,7 +25,7 @@ class IWindowController; | |||
| 25 | class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { | 25 | class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { |
| 26 | public: | 26 | public: |
| 27 | explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet, | 27 | explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet, |
| 28 | Kernel::KProcess* process, Nvnflinger::Nvnflinger& nvnflinger); | 28 | Kernel::KProcess* process); |
| 29 | ~ISystemAppletProxy(); | 29 | ~ISystemAppletProxy(); |
| 30 | 30 | ||
| 31 | private: | 31 | private: |
| @@ -46,7 +46,6 @@ private: | |||
| 46 | Result GetGlobalStateController( | 46 | Result GetGlobalStateController( |
| 47 | Out<SharedPointer<IGlobalStateController>> out_global_state_controller); | 47 | Out<SharedPointer<IGlobalStateController>> out_global_state_controller); |
| 48 | 48 | ||
| 49 | Nvnflinger::Nvnflinger& m_nvnflinger; | ||
| 50 | Kernel::KProcess* const m_process; | 49 | Kernel::KProcess* const m_process; |
| 51 | const std::shared_ptr<Applet> m_applet; | 50 | const std::shared_ptr<Applet> m_applet; |
| 52 | }; | 51 | }; |