diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/vi/manager_display_service.cpp | 76 | ||||
| -rw-r--r-- | src/core/hle/service/vi/manager_display_service.h | 13 |
2 files changed, 28 insertions, 61 deletions
diff --git a/src/core/hle/service/vi/manager_display_service.cpp b/src/core/hle/service/vi/manager_display_service.cpp index 650b420cc..17f2f3b8f 100644 --- a/src/core/hle/service/vi/manager_display_service.cpp +++ b/src/core/hle/service/vi/manager_display_service.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 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/hle/service/ipc_helpers.h" | 4 | #include "core/hle/service/cmif_serialization.h" |
| 5 | #include "core/hle/service/nvnflinger/nvnflinger.h" | 5 | #include "core/hle/service/nvnflinger/nvnflinger.h" |
| 6 | #include "core/hle/service/vi/manager_display_service.h" | 6 | #include "core/hle/service/vi/manager_display_service.h" |
| 7 | #include "core/hle/service/vi/vi_results.h" | 7 | #include "core/hle/service/vi/vi_results.h" |
| @@ -9,15 +9,14 @@ | |||
| 9 | namespace Service::VI { | 9 | namespace Service::VI { |
| 10 | 10 | ||
| 11 | IManagerDisplayService::IManagerDisplayService(Core::System& system_, | 11 | IManagerDisplayService::IManagerDisplayService(Core::System& system_, |
| 12 | Nvnflinger::Nvnflinger& nvnflinger_) | 12 | Nvnflinger::Nvnflinger& nvnflinger) |
| 13 | : ServiceFramework{system_, "IManagerDisplayService"}, nvnflinger{nvnflinger_} { | 13 | : ServiceFramework{system_, "IManagerDisplayService"}, m_nvnflinger{nvnflinger} { |
| 14 | // clang-format off | 14 | // clang-format off |
| 15 | static const FunctionInfo functions[] = { | 15 | static const FunctionInfo functions[] = { |
| 16 | {200, nullptr, "AllocateProcessHeapBlock"}, | 16 | {200, nullptr, "AllocateProcessHeapBlock"}, |
| 17 | {201, nullptr, "FreeProcessHeapBlock"}, | 17 | {201, nullptr, "FreeProcessHeapBlock"}, |
| 18 | {1020, &IManagerDisplayService::CloseDisplay, "CloseDisplay"}, | ||
| 19 | {1102, nullptr, "GetDisplayResolution"}, | 18 | {1102, nullptr, "GetDisplayResolution"}, |
| 20 | {2010, &IManagerDisplayService::CreateManagedLayer, "CreateManagedLayer"}, | 19 | {2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"}, |
| 21 | {2011, nullptr, "DestroyManagedLayer"}, | 20 | {2011, nullptr, "DestroyManagedLayer"}, |
| 22 | {2012, nullptr, "CreateStrayLayer"}, | 21 | {2012, nullptr, "CreateStrayLayer"}, |
| 23 | {2050, nullptr, "CreateIndirectLayer"}, | 22 | {2050, nullptr, "CreateIndirectLayer"}, |
| @@ -45,9 +44,9 @@ IManagerDisplayService::IManagerDisplayService(Core::System& system_, | |||
| 45 | {4208, nullptr, "SetDisplayFatalErrorEnabled"}, | 44 | {4208, nullptr, "SetDisplayFatalErrorEnabled"}, |
| 46 | {4209, nullptr, "IsDisplayPanelOn"}, | 45 | {4209, nullptr, "IsDisplayPanelOn"}, |
| 47 | {4300, nullptr, "GetInternalPanelId"}, | 46 | {4300, nullptr, "GetInternalPanelId"}, |
| 48 | {6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"}, | 47 | {6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"}, |
| 49 | {6001, nullptr, "RemoveFromLayerStack"}, | 48 | {6001, nullptr, "RemoveFromLayerStack"}, |
| 50 | {6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"}, | 49 | {6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"}, |
| 51 | {6003, nullptr, "SetLayerConfig"}, | 50 | {6003, nullptr, "SetLayerConfig"}, |
| 52 | {6004, nullptr, "AttachLayerPresentationTracer"}, | 51 | {6004, nullptr, "AttachLayerPresentationTracer"}, |
| 53 | {6005, nullptr, "DetachLayerPresentationTracer"}, | 52 | {6005, nullptr, "DetachLayerPresentationTracer"}, |
| @@ -103,62 +102,29 @@ IManagerDisplayService::IManagerDisplayService(Core::System& system_, | |||
| 103 | 102 | ||
| 104 | IManagerDisplayService::~IManagerDisplayService() = default; | 103 | IManagerDisplayService::~IManagerDisplayService() = default; |
| 105 | 104 | ||
| 106 | void IManagerDisplayService::CloseDisplay(HLERequestContext& ctx) { | 105 | Result IManagerDisplayService::CreateManagedLayer(Out<u64> out_layer_id, u32 unknown, |
| 107 | IPC::RequestParser rp{ctx}; | 106 | u64 display_id, AppletResourceUserId aruid) { |
| 108 | const u64 display = rp.Pop<u64>(); | 107 | LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown, |
| 108 | display_id, aruid.pid); | ||
| 109 | 109 | ||
| 110 | const Result rc = nvnflinger.CloseDisplay(display) ? ResultSuccess : ResultUnknown; | 110 | const auto layer_id = m_nvnflinger.CreateLayer(display_id); |
| 111 | |||
| 112 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 113 | rb.Push(rc); | ||
| 114 | } | ||
| 115 | |||
| 116 | void IManagerDisplayService::CreateManagedLayer(HLERequestContext& ctx) { | ||
| 117 | IPC::RequestParser rp{ctx}; | ||
| 118 | const u32 unknown = rp.Pop<u32>(); | ||
| 119 | rp.Skip(1, false); | ||
| 120 | const u64 display = rp.Pop<u64>(); | ||
| 121 | const u64 aruid = rp.Pop<u64>(); | ||
| 122 | |||
| 123 | LOG_WARNING(Service_VI, | ||
| 124 | "(STUBBED) called. unknown=0x{:08X}, display=0x{:016X}, aruid=0x{:016X}", unknown, | ||
| 125 | display, aruid); | ||
| 126 | |||
| 127 | const auto layer_id = nvnflinger.CreateLayer(display); | ||
| 128 | if (!layer_id) { | 111 | if (!layer_id) { |
| 129 | LOG_ERROR(Service_VI, "Layer not found! display=0x{:016X}", display); | 112 | LOG_ERROR(Service_VI, "Layer not found! display={}", display_id); |
| 130 | IPC::ResponseBuilder rb{ctx, 2}; | 113 | R_THROW(VI::ResultNotFound); |
| 131 | rb.Push(ResultNotFound); | ||
| 132 | return; | ||
| 133 | } | 114 | } |
| 134 | 115 | ||
| 135 | IPC::ResponseBuilder rb{ctx, 4}; | 116 | *out_layer_id = *layer_id; |
| 136 | rb.Push(ResultSuccess); | 117 | R_SUCCEED(); |
| 137 | rb.Push(*layer_id); | ||
| 138 | } | 118 | } |
| 139 | 119 | ||
| 140 | void IManagerDisplayService::AddToLayerStack(HLERequestContext& ctx) { | 120 | Result IManagerDisplayService::AddToLayerStack(u32 stack_id, u64 layer_id) { |
| 141 | IPC::RequestParser rp{ctx}; | 121 | LOG_WARNING(Service_VI, "(STUBBED) called. stack_id={}, layer_id={}", stack_id, layer_id); |
| 142 | const u32 stack = rp.Pop<u32>(); | 122 | R_SUCCEED(); |
| 143 | const u64 layer_id = rp.Pop<u64>(); | ||
| 144 | |||
| 145 | LOG_WARNING(Service_VI, "(STUBBED) called. stack=0x{:08X}, layer_id=0x{:016X}", stack, | ||
| 146 | layer_id); | ||
| 147 | |||
| 148 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 149 | rb.Push(ResultSuccess); | ||
| 150 | } | 123 | } |
| 151 | 124 | ||
| 152 | void IManagerDisplayService::SetLayerVisibility(HLERequestContext& ctx) { | 125 | Result IManagerDisplayService::SetLayerVisibility(bool visible, u64 layer_id) { |
| 153 | IPC::RequestParser rp{ctx}; | 126 | LOG_WARNING(Service_VI, "(STUBBED) called, layer_id={}, visible={}", layer_id, visible); |
| 154 | const u64 layer_id = rp.Pop<u64>(); | 127 | R_SUCCEED(); |
| 155 | const bool visibility = rp.Pop<bool>(); | ||
| 156 | |||
| 157 | LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:X}, visibility={}", layer_id, | ||
| 158 | visibility); | ||
| 159 | |||
| 160 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 161 | rb.Push(ResultSuccess); | ||
| 162 | } | 128 | } |
| 163 | 129 | ||
| 164 | } // namespace Service::VI | 130 | } // namespace Service::VI |
diff --git a/src/core/hle/service/vi/manager_display_service.h b/src/core/hle/service/vi/manager_display_service.h index 6a5554eff..60e646ee0 100644 --- a/src/core/hle/service/vi/manager_display_service.h +++ b/src/core/hle/service/vi/manager_display_service.h | |||
| @@ -1,23 +1,24 @@ | |||
| 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/hle/service/cmif_types.h" | ||
| 4 | #include "core/hle/service/service.h" | 5 | #include "core/hle/service/service.h" |
| 5 | 6 | ||
| 6 | namespace Service::VI { | 7 | namespace Service::VI { |
| 7 | 8 | ||
| 8 | class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { | 9 | class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { |
| 9 | public: | 10 | public: |
| 10 | explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger_); | 11 | explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger); |
| 11 | ~IManagerDisplayService() override; | 12 | ~IManagerDisplayService() override; |
| 12 | 13 | ||
| 13 | private: | 14 | private: |
| 14 | void CloseDisplay(HLERequestContext& ctx); | 15 | Result CreateManagedLayer(Out<u64> out_layer_id, u32 unknown, u64 display_id, |
| 15 | void CreateManagedLayer(HLERequestContext& ctx); | 16 | AppletResourceUserId aruid); |
| 16 | void AddToLayerStack(HLERequestContext& ctx); | 17 | Result AddToLayerStack(u32 stack_id, u64 layer_id); |
| 17 | void SetLayerVisibility(HLERequestContext& ctx); | 18 | Result SetLayerVisibility(bool visible, u64 layer_id); |
| 18 | 19 | ||
| 19 | private: | 20 | private: |
| 20 | Nvnflinger::Nvnflinger& nvnflinger; | 21 | Nvnflinger::Nvnflinger& m_nvnflinger; |
| 21 | }; | 22 | }; |
| 22 | 23 | ||
| 23 | } // namespace Service::VI | 24 | } // namespace Service::VI |