summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv/nvdrv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/nvdrv/nvdrv.cpp')
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 6fc8565c0..9e46ee8dd 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -6,8 +6,8 @@
#include <fmt/format.h>
#include "core/core.h"
-#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/k_event.h"
+#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/nvdrv/core/container.h"
#include "core/hle/service/nvdrv/devices/nvdevice.h"
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
@@ -23,7 +23,8 @@
#include "core/hle/service/nvdrv/nvdrv.h"
#include "core/hle/service/nvdrv/nvdrv_interface.h"
#include "core/hle/service/nvdrv/nvmemp.h"
-#include "core/hle/service/nvflinger/nvflinger.h"
+#include "core/hle/service/nvnflinger/nvnflinger.h"
+#include "core/hle/service/server_manager.h"
#include "video_core/gpu.h"
namespace Service::Nvidia {
@@ -41,15 +42,19 @@ void EventInterface::FreeEvent(Kernel::KEvent* event) {
module.service_context.CloseEvent(event);
}
-void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
- Core::System& system) {
- auto module_ = std::make_shared<Module>(system);
- std::make_shared<NVDRV>(system, module_, "nvdrv")->InstallAsService(service_manager);
- std::make_shared<NVDRV>(system, module_, "nvdrv:a")->InstallAsService(service_manager);
- std::make_shared<NVDRV>(system, module_, "nvdrv:s")->InstallAsService(service_manager);
- std::make_shared<NVDRV>(system, module_, "nvdrv:t")->InstallAsService(service_manager);
- std::make_shared<NVMEMP>(system)->InstallAsService(service_manager);
- nvflinger.SetNVDrvInstance(module_);
+void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
+ auto server_manager = std::make_unique<ServerManager>(system);
+ auto module = std::make_shared<Module>(system);
+ server_manager->RegisterNamedService("nvdrv", std::make_shared<NVDRV>(system, module, "nvdrv"));
+ server_manager->RegisterNamedService("nvdrv:a",
+ std::make_shared<NVDRV>(system, module, "nvdrv:a"));
+ server_manager->RegisterNamedService("nvdrv:s",
+ std::make_shared<NVDRV>(system, module, "nvdrv:s"));
+ server_manager->RegisterNamedService("nvdrv:t",
+ std::make_shared<NVDRV>(system, module, "nvdrv:t"));
+ server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
+ nvnflinger.SetNVDrvInstance(module);
+ ServerManager::RunServer(std::move(server_manager));
}
Module::Module(Core::System& system)
@@ -124,8 +129,8 @@ DeviceFD Module::Open(const std::string& device_name) {
return fd;
}
-NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
- std::vector<u8>& output) {
+NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
+ std::span<u8> output) {
if (fd < 0) {
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
return NvResult::InvalidState;
@@ -141,8 +146,8 @@ NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input
return itr->second->Ioctl1(fd, command, input, output);
}
-NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
- const std::vector<u8>& inline_input, std::vector<u8>& output) {
+NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
+ std::span<const u8> inline_input, std::span<u8> output) {
if (fd < 0) {
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
return NvResult::InvalidState;
@@ -158,8 +163,8 @@ NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input
return itr->second->Ioctl2(fd, command, input, inline_input, output);
}
-NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
- std::vector<u8>& output, std::vector<u8>& inline_output) {
+NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
+ std::span<u8> inline_output) {
if (fd < 0) {
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
return NvResult::InvalidState;