yuzu-emu
/
yuzu
Archived
1
0
Fork 0

vi: rewrite IManagerDisplayService

This commit is contained in:
Liam 2024-02-14 00:17:48 -05:00
parent 59011a04a1
commit b1c71f976c
2 changed files with 28 additions and 61 deletions

View File

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/nvnflinger/nvnflinger.h" #include "core/hle/service/nvnflinger/nvnflinger.h"
#include "core/hle/service/vi/manager_display_service.h" #include "core/hle/service/vi/manager_display_service.h"
#include "core/hle/service/vi/vi_results.h" #include "core/hle/service/vi/vi_results.h"
@ -9,15 +9,14 @@
namespace Service::VI { namespace Service::VI {
IManagerDisplayService::IManagerDisplayService(Core::System& system_, IManagerDisplayService::IManagerDisplayService(Core::System& system_,
Nvnflinger::Nvnflinger& nvnflinger_) Nvnflinger::Nvnflinger& nvnflinger)
: ServiceFramework{system_, "IManagerDisplayService"}, nvnflinger{nvnflinger_} { : ServiceFramework{system_, "IManagerDisplayService"}, m_nvnflinger{nvnflinger} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{200, nullptr, "AllocateProcessHeapBlock"}, {200, nullptr, "AllocateProcessHeapBlock"},
{201, nullptr, "FreeProcessHeapBlock"}, {201, nullptr, "FreeProcessHeapBlock"},
{1020, &IManagerDisplayService::CloseDisplay, "CloseDisplay"},
{1102, nullptr, "GetDisplayResolution"}, {1102, nullptr, "GetDisplayResolution"},
{2010, &IManagerDisplayService::CreateManagedLayer, "CreateManagedLayer"}, {2010, C<&IManagerDisplayService::CreateManagedLayer>, "CreateManagedLayer"},
{2011, nullptr, "DestroyManagedLayer"}, {2011, nullptr, "DestroyManagedLayer"},
{2012, nullptr, "CreateStrayLayer"}, {2012, nullptr, "CreateStrayLayer"},
{2050, nullptr, "CreateIndirectLayer"}, {2050, nullptr, "CreateIndirectLayer"},
@ -45,9 +44,9 @@ IManagerDisplayService::IManagerDisplayService(Core::System& system_,
{4208, nullptr, "SetDisplayFatalErrorEnabled"}, {4208, nullptr, "SetDisplayFatalErrorEnabled"},
{4209, nullptr, "IsDisplayPanelOn"}, {4209, nullptr, "IsDisplayPanelOn"},
{4300, nullptr, "GetInternalPanelId"}, {4300, nullptr, "GetInternalPanelId"},
{6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"}, {6000, C<&IManagerDisplayService::AddToLayerStack>, "AddToLayerStack"},
{6001, nullptr, "RemoveFromLayerStack"}, {6001, nullptr, "RemoveFromLayerStack"},
{6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"}, {6002, C<&IManagerDisplayService::SetLayerVisibility>, "SetLayerVisibility"},
{6003, nullptr, "SetLayerConfig"}, {6003, nullptr, "SetLayerConfig"},
{6004, nullptr, "AttachLayerPresentationTracer"}, {6004, nullptr, "AttachLayerPresentationTracer"},
{6005, nullptr, "DetachLayerPresentationTracer"}, {6005, nullptr, "DetachLayerPresentationTracer"},
@ -103,62 +102,29 @@ IManagerDisplayService::IManagerDisplayService(Core::System& system_,
IManagerDisplayService::~IManagerDisplayService() = default; IManagerDisplayService::~IManagerDisplayService() = default;
void IManagerDisplayService::CloseDisplay(HLERequestContext& ctx) { Result IManagerDisplayService::CreateManagedLayer(Out<u64> out_layer_id, u32 unknown,
IPC::RequestParser rp{ctx}; u64 display_id, AppletResourceUserId aruid) {
const u64 display = rp.Pop<u64>(); LOG_WARNING(Service_VI, "(STUBBED) called. unknown={}, display={}, aruid={}", unknown,
display_id, aruid.pid);
const Result rc = nvnflinger.CloseDisplay(display) ? ResultSuccess : ResultUnknown; const auto layer_id = m_nvnflinger.CreateLayer(display_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(rc);
}
void IManagerDisplayService::CreateManagedLayer(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u32 unknown = rp.Pop<u32>();
rp.Skip(1, false);
const u64 display = rp.Pop<u64>();
const u64 aruid = rp.Pop<u64>();
LOG_WARNING(Service_VI,
"(STUBBED) called. unknown=0x{:08X}, display=0x{:016X}, aruid=0x{:016X}", unknown,
display, aruid);
const auto layer_id = nvnflinger.CreateLayer(display);
if (!layer_id) { if (!layer_id) {
LOG_ERROR(Service_VI, "Layer not found! display=0x{:016X}", display); LOG_ERROR(Service_VI, "Layer not found! display={}", display_id);
IPC::ResponseBuilder rb{ctx, 2}; R_THROW(VI::ResultNotFound);
rb.Push(ResultNotFound);
return;
} }
IPC::ResponseBuilder rb{ctx, 4}; *out_layer_id = *layer_id;
rb.Push(ResultSuccess); R_SUCCEED();
rb.Push(*layer_id);
} }
void IManagerDisplayService::AddToLayerStack(HLERequestContext& ctx) { Result IManagerDisplayService::AddToLayerStack(u32 stack_id, u64 layer_id) {
IPC::RequestParser rp{ctx}; LOG_WARNING(Service_VI, "(STUBBED) called. stack_id={}, layer_id={}", stack_id, layer_id);
const u32 stack = rp.Pop<u32>(); R_SUCCEED();
const u64 layer_id = rp.Pop<u64>();
LOG_WARNING(Service_VI, "(STUBBED) called. stack=0x{:08X}, layer_id=0x{:016X}", stack,
layer_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
} }
void IManagerDisplayService::SetLayerVisibility(HLERequestContext& ctx) { Result IManagerDisplayService::SetLayerVisibility(bool visible, u64 layer_id) {
IPC::RequestParser rp{ctx}; LOG_WARNING(Service_VI, "(STUBBED) called, layer_id={}, visible={}", layer_id, visible);
const u64 layer_id = rp.Pop<u64>(); R_SUCCEED();
const bool visibility = rp.Pop<bool>();
LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:X}, visibility={}", layer_id,
visibility);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
} }
} // namespace Service::VI } // namespace Service::VI

View File

@ -1,23 +1,24 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Service::VI { namespace Service::VI {
class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> { class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {
public: public:
explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger_); explicit IManagerDisplayService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger);
~IManagerDisplayService() override; ~IManagerDisplayService() override;
private: private:
void CloseDisplay(HLERequestContext& ctx); Result CreateManagedLayer(Out<u64> out_layer_id, u32 unknown, u64 display_id,
void CreateManagedLayer(HLERequestContext& ctx); AppletResourceUserId aruid);
void AddToLayerStack(HLERequestContext& ctx); Result AddToLayerStack(u32 stack_id, u64 layer_id);
void SetLayerVisibility(HLERequestContext& ctx); Result SetLayerVisibility(bool visible, u64 layer_id);
private: private:
Nvnflinger::Nvnflinger& nvnflinger; Nvnflinger::Nvnflinger& m_nvnflinger;
}; };
} // namespace Service::VI } // namespace Service::VI