summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/service/vi/application_root_service.cpp21
-rw-r--r--src/core/hle/service/vi/application_root_service.h17
-rw-r--r--src/core/hle/service/vi/manager_root_service.cpp21
-rw-r--r--src/core/hle/service/vi/manager_root_service.h16
-rw-r--r--src/core/hle/service/vi/service_creator.cpp39
-rw-r--r--src/core/hle/service/vi/service_creator.h33
-rw-r--r--src/core/hle/service/vi/system_root_service.cpp21
-rw-r--r--src/core/hle/service/vi/system_root_service.h16
-rw-r--r--src/core/hle/service/vi/vi.cpp34
-rw-r--r--src/core/hle/service/vi/vi.h13
-rw-r--r--src/core/hle/service/vi/vi_types.h2
12 files changed, 145 insertions, 90 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index fa4a25156..7770dbeae 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -969,6 +969,8 @@ add_library(core STATIC
hle/service/vi/manager_display_service.h
hle/service/vi/manager_root_service.cpp
hle/service/vi/manager_root_service.h
+ hle/service/vi/service_creator.cpp
+ hle/service/vi/service_creator.h
hle/service/vi/system_display_service.cpp
hle/service/vi/system_display_service.h
hle/service/vi/system_root_service.cpp
diff --git a/src/core/hle/service/vi/application_root_service.cpp b/src/core/hle/service/vi/application_root_service.cpp
index caba3d1d9..7af7f062c 100644
--- a/src/core/hle/service/vi/application_root_service.cpp
+++ b/src/core/hle/service/vi/application_root_service.cpp
@@ -1,19 +1,22 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "core/hle/service/cmif_serialization.h"
+#include "core/hle/service/vi/application_display_service.h"
#include "core/hle/service/vi/application_root_service.h"
+#include "core/hle/service/vi/service_creator.h"
#include "core/hle/service/vi/vi.h"
#include "core/hle/service/vi/vi_types.h"
namespace Service::VI {
IApplicationRootService::IApplicationRootService(
- Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
- : ServiceFramework{system_, "vi:u"}, nv_flinger{nv_flinger_},
- hos_binder_driver_server{hos_binder_driver_server_} {
+ Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
+ : ServiceFramework{system_, "vi:u"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
+ hos_binder_driver_server} {
static const FunctionInfo functions[] = {
- {0, &IApplicationRootService::GetDisplayService, "GetDisplayService"},
+ {0, C<&IApplicationRootService::GetDisplayService>, "GetDisplayService"},
{1, nullptr, "GetDisplayServiceWithProxyNameExchange"},
};
RegisterHandlers(functions);
@@ -21,11 +24,11 @@ IApplicationRootService::IApplicationRootService(
IApplicationRootService::~IApplicationRootService() = default;
-void IApplicationRootService::GetDisplayService(HLERequestContext& ctx) {
+Result IApplicationRootService::GetDisplayService(
+ Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
LOG_DEBUG(Service_VI, "called");
-
- detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
- Permission::User);
+ R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
+ m_hos_binder_driver_server, Permission::User, policy));
}
} // 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 231d26891..9dbf28cb4 100644
--- a/src/core/hle/service/vi/application_root_service.h
+++ b/src/core/hle/service/vi/application_root_service.h
@@ -3,6 +3,7 @@
#pragma once
+#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Core {
@@ -16,17 +17,23 @@ class Nvnflinger;
namespace Service::VI {
+class IApplicationDisplayService;
+enum class Policy : u32;
+
class IApplicationRootService final : public ServiceFramework<IApplicationRootService> {
public:
- explicit IApplicationRootService(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
+ explicit IApplicationRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
~IApplicationRootService() override;
private:
- void GetDisplayService(HLERequestContext& ctx);
+ Result GetDisplayService(
+ Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
+ Policy policy);
- Nvnflinger::Nvnflinger& nv_flinger;
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
+private:
+ Nvnflinger::Nvnflinger& m_nvnflinger;
+ Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
};
} // 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 3ab88111d..a7eee4f04 100644
--- a/src/core/hle/service/vi/manager_root_service.cpp
+++ b/src/core/hle/service/vi/manager_root_service.cpp
@@ -1,19 +1,22 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "core/hle/service/cmif_serialization.h"
+#include "core/hle/service/vi/application_display_service.h"
#include "core/hle/service/vi/manager_root_service.h"
+#include "core/hle/service/vi/service_creator.h"
#include "core/hle/service/vi/vi.h"
#include "core/hle/service/vi/vi_types.h"
namespace Service::VI {
IManagerRootService::IManagerRootService(
- Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
- : ServiceFramework{system_, "vi:m"}, nv_flinger{nv_flinger_},
- hos_binder_driver_server{hos_binder_driver_server_} {
+ Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
+ : ServiceFramework{system_, "vi:m"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
+ hos_binder_driver_server} {
static const FunctionInfo functions[] = {
- {2, &IManagerRootService::GetDisplayService, "GetDisplayService"},
+ {2, C<&IManagerRootService::GetDisplayService>, "GetDisplayService"},
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
{100, nullptr, "PrepareFatal"},
{101, nullptr, "ShowFatal"},
@@ -25,11 +28,11 @@ IManagerRootService::IManagerRootService(
IManagerRootService::~IManagerRootService() = default;
-void IManagerRootService::GetDisplayService(HLERequestContext& ctx) {
+Result IManagerRootService::GetDisplayService(
+ Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
LOG_DEBUG(Service_VI, "called");
-
- detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
- Permission::Manager);
+ R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
+ m_hos_binder_driver_server, Permission::Manager, policy));
}
} // 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 3776619ad..e6cb77aeb 100644
--- a/src/core/hle/service/vi/manager_root_service.h
+++ b/src/core/hle/service/vi/manager_root_service.h
@@ -3,6 +3,7 @@
#pragma once
+#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Core {
@@ -16,17 +17,22 @@ class Nvnflinger;
namespace Service::VI {
+class IApplicationDisplayService;
+enum class Policy : u32;
+
class IManagerRootService final : public ServiceFramework<IManagerRootService> {
public:
- explicit IManagerRootService(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
+ explicit IManagerRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
~IManagerRootService() override;
private:
- void GetDisplayService(HLERequestContext& ctx);
+ Result GetDisplayService(
+ Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
+ Policy policy);
- Nvnflinger::Nvnflinger& nv_flinger;
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
+ Nvnflinger::Nvnflinger& m_nvnflinger;
+ Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
};
} // namespace Service::VI
diff --git a/src/core/hle/service/vi/service_creator.cpp b/src/core/hle/service/vi/service_creator.cpp
new file mode 100644
index 000000000..1de9d61a4
--- /dev/null
+++ b/src/core/hle/service/vi/service_creator.cpp
@@ -0,0 +1,39 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "core/hle/service/vi/application_display_service.h"
+#include "core/hle/service/vi/service_creator.h"
+#include "core/hle/service/vi/vi_results.h"
+#include "core/hle/service/vi/vi_types.h"
+
+namespace Service::VI {
+
+static bool IsValidServiceAccess(Permission permission, Policy policy) {
+ if (permission == Permission::User) {
+ return policy == Policy::User;
+ }
+
+ if (permission == Permission::System || permission == Permission::Manager) {
+ return policy == Policy::User || policy == Policy::Compositor;
+ }
+
+ return false;
+}
+
+Result GetApplicationDisplayService(
+ std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
+ Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission,
+ Policy policy) {
+
+ if (!IsValidServiceAccess(permission, policy)) {
+ LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
+ R_THROW(ResultPermissionDenied);
+ }
+
+ *out_application_display_service =
+ std::make_shared<IApplicationDisplayService>(system, nvnflinger, hos_binder_driver_server);
+ R_SUCCEED();
+}
+
+} // namespace Service::VI
diff --git a/src/core/hle/service/vi/service_creator.h b/src/core/hle/service/vi/service_creator.h
new file mode 100644
index 000000000..8963bcd26
--- /dev/null
+++ b/src/core/hle/service/vi/service_creator.h
@@ -0,0 +1,33 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <memory>
+
+#include "common/common_types.h"
+
+namespace Core {
+class System;
+}
+
+namespace Service::Nvnflinger {
+class HosBinderDriverServer;
+class Nvnflinger;
+} // namespace Service::Nvnflinger
+
+union Result;
+
+namespace Service::VI {
+
+class IApplicationDisplayService;
+enum class Permission;
+enum class Policy : u32;
+
+Result GetApplicationDisplayService(
+ std::shared_ptr<IApplicationDisplayService>* out_application_display_service,
+ Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server, Permission permission,
+ Policy policy);
+
+} // 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 c3228d73b..8789b4cfb 100644
--- a/src/core/hle/service/vi/system_root_service.cpp
+++ b/src/core/hle/service/vi/system_root_service.cpp
@@ -1,18 +1,21 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "core/hle/service/cmif_serialization.h"
+#include "core/hle/service/vi/application_display_service.h"
+#include "core/hle/service/vi/service_creator.h"
#include "core/hle/service/vi/system_root_service.h"
#include "core/hle/service/vi/vi.h"
#include "core/hle/service/vi/vi_types.h"
namespace Service::VI {
-ISystemRootService::ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_)
- : ServiceFramework{system_, "vi:s"}, nv_flinger{nv_flinger_},
- hos_binder_driver_server{hos_binder_driver_server_} {
+ISystemRootService::ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server)
+ : ServiceFramework{system_, "vi:s"}, m_nvnflinger{nvnflinger}, m_hos_binder_driver_server{
+ hos_binder_driver_server} {
static const FunctionInfo functions[] = {
- {1, &ISystemRootService::GetDisplayService, "GetDisplayService"},
+ {1, C<&ISystemRootService::GetDisplayService>, "GetDisplayService"},
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"},
};
RegisterHandlers(functions);
@@ -20,11 +23,11 @@ ISystemRootService::ISystemRootService(Core::System& system_, Nvnflinger::Nvnfli
ISystemRootService::~ISystemRootService() = default;
-void ISystemRootService::GetDisplayService(HLERequestContext& ctx) {
+Result ISystemRootService::GetDisplayService(
+ Out<SharedPointer<IApplicationDisplayService>> out_application_display_service, Policy policy) {
LOG_DEBUG(Service_VI, "called");
-
- detail::GetDisplayServiceImpl(ctx, system, nv_flinger, hos_binder_driver_server,
- Permission::System);
+ R_RETURN(GetApplicationDisplayService(out_application_display_service, system, m_nvnflinger,
+ m_hos_binder_driver_server, Permission::System, policy));
}
} // 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 5a8ecfd1a..2c547faa5 100644
--- a/src/core/hle/service/vi/system_root_service.h
+++ b/src/core/hle/service/vi/system_root_service.h
@@ -3,6 +3,7 @@
#pragma once
+#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Core {
@@ -16,17 +17,22 @@ class Nvnflinger;
namespace Service::VI {
+class IApplicationDisplayService;
+enum class Policy : u32;
+
class ISystemRootService final : public ServiceFramework<ISystemRootService> {
public:
- explicit ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nv_flinger_,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server_);
+ explicit ISystemRootService(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger,
+ Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
~ISystemRootService() override;
private:
- void GetDisplayService(HLERequestContext& ctx);
+ Result GetDisplayService(
+ Out<SharedPointer<IApplicationDisplayService>> out_application_display_service,
+ Policy policy);
- Nvnflinger::Nvnflinger& nv_flinger;
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server;
+ Nvnflinger::Nvnflinger& m_nvnflinger;
+ Nvnflinger::HosBinderDriverServer& m_hos_binder_driver_server;
};
} // namespace Service::VI
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index bb84d27b3..304e589b7 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -1,49 +1,15 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/vi/application_display_service.h"
#include "core/hle/service/vi/application_root_service.h"
#include "core/hle/service/vi/manager_root_service.h"
#include "core/hle/service/vi/system_root_service.h"
#include "core/hle/service/vi/vi.h"
-#include "core/hle/service/vi/vi_results.h"
-#include "core/hle/service/vi/vi_types.h"
namespace Service::VI {
-static bool IsValidServiceAccess(Permission permission, Policy policy) {
- if (permission == Permission::User) {
- return policy == Policy::User;
- }
-
- if (permission == Permission::System || permission == Permission::Manager) {
- return policy == Policy::User || policy == Policy::Compositor;
- }
-
- return false;
-}
-
-void detail::GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
- Nvnflinger::Nvnflinger& nvnflinger,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server,
- Permission permission) {
- IPC::RequestParser rp{ctx};
- const auto policy = rp.PopEnum<Policy>();
-
- if (!IsValidServiceAccess(permission, policy)) {
- LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultPermissionDenied);
- return;
- }
-
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(ResultSuccess);
- rb.PushIpcInterface<IApplicationDisplayService>(system, nvnflinger, hos_binder_driver_server);
-}
-
void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server) {
auto server_manager = std::make_unique<ServerManager>(system);
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 799def36d..8e681370d 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -7,10 +7,6 @@ namespace Core {
class System;
}
-namespace Service {
-class HLERequestContext;
-}
-
namespace Service::Nvnflinger {
class HosBinderDriverServer;
class Nvnflinger;
@@ -18,15 +14,6 @@ class Nvnflinger;
namespace Service::VI {
-enum class Permission;
-
-namespace detail {
-void GetDisplayServiceImpl(HLERequestContext& ctx, Core::System& system,
- Nvnflinger::Nvnflinger& nv_flinger,
- Nvnflinger::HosBinderDriverServer& hos_binder_driver_server,
- Permission permission);
-} // namespace detail
-
void LoopProcess(Core::System& system, Nvnflinger::Nvnflinger& nvnflinger,
Nvnflinger::HosBinderDriverServer& hos_binder_driver_server);
diff --git a/src/core/hle/service/vi/vi_types.h b/src/core/hle/service/vi/vi_types.h
index 0297676af..47fe2d11c 100644
--- a/src/core/hle/service/vi/vi_types.h
+++ b/src/core/hle/service/vi/vi_types.h
@@ -23,7 +23,7 @@ enum class Permission {
/// A policy type that may be requested via GetDisplayService and
/// GetDisplayServiceWithProxyNameExchange
-enum class Policy {
+enum class Policy : u32 {
User,
Compositor,
};