From 24408cce9bd899a6709c03b25e318123f4de7371 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 10 Jun 2019 12:03:30 -0400 Subject: [PATCH] nv_services: Deglobalize NvServices --- src/core/hle/service/nvdrv/devices/nvdevice.h | 9 +++++- .../service/nvdrv/devices/nvdisp_disp0.cpp | 5 +-- .../hle/service/nvdrv/devices/nvdisp_disp0.h | 2 +- .../service/nvdrv/devices/nvhost_as_gpu.cpp | 12 +++---- .../hle/service/nvdrv/devices/nvhost_as_gpu.h | 2 +- .../hle/service/nvdrv/devices/nvhost_ctrl.cpp | 7 +++-- .../hle/service/nvdrv/devices/nvhost_ctrl.h | 2 +- .../service/nvdrv/devices/nvhost_ctrl_gpu.cpp | 4 +-- .../service/nvdrv/devices/nvhost_ctrl_gpu.h | 2 +- .../hle/service/nvdrv/devices/nvhost_gpu.cpp | 9 +++--- .../hle/service/nvdrv/devices/nvhost_gpu.h | 2 +- .../service/nvdrv/devices/nvhost_nvdec.cpp | 2 +- .../hle/service/nvdrv/devices/nvhost_nvdec.h | 2 +- .../service/nvdrv/devices/nvhost_nvjpg.cpp | 2 +- .../hle/service/nvdrv/devices/nvhost_nvjpg.h | 2 +- .../hle/service/nvdrv/devices/nvhost_vic.cpp | 2 +- .../hle/service/nvdrv/devices/nvhost_vic.h | 2 +- src/core/hle/service/nvdrv/devices/nvmap.cpp | 2 +- src/core/hle/service/nvdrv/devices/nvmap.h | 2 +- src/core/hle/service/nvdrv/interface.cpp | 2 -- src/core/hle/service/nvdrv/nvdrv.cpp | 31 ++++++++++--------- src/core/hle/service/nvdrv/nvdrv.h | 9 ++++-- src/core/hle/service/service.cpp | 2 +- 23 files changed, 65 insertions(+), 51 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index 4f6042b00a..ed606cd15d 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h @@ -9,13 +9,17 @@ #include "common/common_types.h" #include "common/swap.h" +namespace Core { +class System; +} + namespace Service::Nvidia::Devices { /// Represents an abstract nvidia device node. It is to be subclassed by concrete device nodes to /// implement the ioctl interface. class nvdevice { public: - nvdevice() = default; + nvdevice(Core::System& system) : system{system} {}; virtual ~nvdevice() = default; union Ioctl { u32_le raw; @@ -34,6 +38,9 @@ public: * @returns The result code of the ioctl. */ virtual u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) = 0; + +protected: + Core::System& system; }; } // namespace Service::Nvidia::Devices diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 20c7c39aaf..3336b2080f 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { -nvdisp_disp0::nvdisp_disp0(std::shared_ptr nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} +nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr nvmap_dev) + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvdisp_disp0 ::~nvdisp_disp0() = default; u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -34,7 +35,7 @@ void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u3 addr, offset, width, height, stride, static_cast(format), transform, crop_rect}; - auto& instance = Core::System::GetInstance(); + auto& instance = system; instance.GetPerfStats().EndGameFrame(); instance.GPU().SwapBuffers(framebuffer); } diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index 12f3ef8254..812967bdf9 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h @@ -17,7 +17,7 @@ class nvmap; class nvdisp_disp0 final : public nvdevice { public: - explicit nvdisp_disp0(std::shared_ptr nvmap_dev); + explicit nvdisp_disp0(Core::System& system, std::shared_ptr nvmap_dev); ~nvdisp_disp0() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index af62d33d21..eccc3f1d95 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -22,7 +22,8 @@ enum { }; } -nvhost_as_gpu::nvhost_as_gpu(std::shared_ptr nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} +nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr nvmap_dev) + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvhost_as_gpu::~nvhost_as_gpu() = default; u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -65,7 +66,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector& input, std::vector& LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages, params.page_size, params.flags); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); const u64 size{static_cast(params.pages) * static_cast(params.page_size)}; if (params.flags & 1) { params.offset = gpu.MemoryManager().AllocateSpace(params.offset, size, 1); @@ -85,7 +86,7 @@ u32 nvhost_as_gpu::Remap(const std::vector& input, std::vector& output) std::vector entries(num_entries); std::memcpy(entries.data(), input.data(), input.size()); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); for (const auto& entry : entries) { LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", entry.offset, entry.nvmap_handle, entry.pages); @@ -136,7 +137,7 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& ou // case to prevent unexpected behavior. ASSERT(object->id == params.nvmap_handle); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); if (params.flags & 1) { params.offset = gpu.MemoryManager().MapBufferEx(object->addr, params.offset, object->size); @@ -173,8 +174,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector& input, std::vector& ou return 0; } - params.offset = Core::System::GetInstance().GPU().MemoryManager().UnmapBuffer(params.offset, - itr->second.size); + params.offset = system.GPU().MemoryManager().UnmapBuffer(params.offset, itr->second.size); buffer_mappings.erase(itr->second.offset); std::memcpy(output.data(), ¶ms, output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h index eb14b1da8e..e45d4f1ff4 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h @@ -17,7 +17,7 @@ class nvmap; class nvhost_as_gpu final : public nvdevice { public: - explicit nvhost_as_gpu(std::shared_ptr nvmap_dev); + explicit nvhost_as_gpu(Core::System& system, std::shared_ptr nvmap_dev); ~nvhost_as_gpu() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 96310ed83f..02b078c2f6 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -15,7 +15,8 @@ namespace Service::Nvidia::Devices { -nvhost_ctrl::nvhost_ctrl(EventsInterface& events_interface) : events_interface{events_interface} {} +nvhost_ctrl::nvhost_ctrl(Core::System& system, EventsInterface& events_interface) + : nvdevice(system), events_interface{events_interface} {} nvhost_ctrl::~nvhost_ctrl() = default; u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -59,7 +60,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector& input, std::vector& return NvResult::BadParameter; } - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); // This is mostly to take into account unimplemented features. As synced // gpu is always synced. if (!gpu.IsAsync()) { @@ -158,7 +159,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector& input, std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index 0e28755bdd..c139f2ceba 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -12,7 +12,7 @@ namespace Service::Nvidia::Devices { -nvhost_ctrl_gpu::nvhost_ctrl_gpu() = default; +nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system){}; nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default; u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -185,7 +185,7 @@ u32 nvhost_ctrl_gpu::GetGpuTime(const std::vector& input, std::vector& o IoctlGetGpuTime params{}; std::memcpy(¶ms, input.data(), input.size()); - const auto ns = Core::Timing::CyclesToNs(Core::System::GetInstance().CoreTiming().GetTicks()); + const auto ns = Core::Timing::CyclesToNs(system.CoreTiming().GetTicks()); params.gpu_time = static_cast(ns.count()); std::memcpy(output.data(), ¶ms, output.size()); return 0; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h index 240435eea5..65eac47d14 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h @@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices { class nvhost_ctrl_gpu final : public nvdevice { public: - nvhost_ctrl_gpu(); + nvhost_ctrl_gpu(Core::System& system); ~nvhost_ctrl_gpu() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 8083f5a87a..13e80bfad5 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -13,7 +13,8 @@ namespace Service::Nvidia::Devices { -nvhost_gpu::nvhost_gpu(std::shared_ptr nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} +nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev) + : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} nvhost_gpu::~nvhost_gpu() = default; u32 nvhost_gpu::ioctl(Ioctl command, const std::vector& input, std::vector& output) { @@ -119,7 +120,7 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector& input, std::vector& ou params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, params.unk3); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); params.fence_out.id = channels; params.fence_out.value = gpu.GetSyncpointValue(channels); channels++; @@ -158,7 +159,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector& input, std::vector& outp UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0); UNIMPLEMENTED_IF(params.flags.add_increment.Value() != 0); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id); if (params.flags.increment.Value()) { params.fence_out.value += current_syncpoint_value; @@ -189,7 +190,7 @@ u32 nvhost_gpu::KickoffPB(const std::vector& input, std::vector& output) UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0); UNIMPLEMENTED_IF(params.flags.add_increment.Value() != 0); - auto& gpu = Core::System::GetInstance().GPU(); + auto& gpu = system.GPU(); u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id); if (params.flags.increment.Value()) { params.fence_out.value += current_syncpoint_value; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 54378cb5d2..106359f876 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h @@ -20,7 +20,7 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_KICKOFF_PB(0x1b); class nvhost_gpu final : public nvdevice { public: - explicit nvhost_gpu(std::shared_ptr nvmap_dev); + explicit nvhost_gpu(Core::System& system, std::shared_ptr nvmap_dev); ~nvhost_gpu() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index f5e8ea7c3a..3bfcb84230 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp @@ -10,7 +10,7 @@ namespace Service::Nvidia::Devices { -nvhost_nvdec::nvhost_nvdec() = default; +nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system){}; nvhost_nvdec::~nvhost_nvdec() = default; u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector& input, std::vector& output) { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 0e7b284f87..febfd4cc4c 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h @@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices { class nvhost_nvdec final : public nvdevice { public: - nvhost_nvdec(); + nvhost_nvdec(Core::System& system); ~nvhost_nvdec() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp index 3e0951ab04..16c683b476 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp @@ -10,7 +10,7 @@ namespace Service::Nvidia::Devices { -nvhost_nvjpg::nvhost_nvjpg() = default; +nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system){}; nvhost_nvjpg::~nvhost_nvjpg() = default; u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector& input, std::vector& output) { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index 89fd5e95ed..33b149bb73 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h @@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices { class nvhost_nvjpg final : public nvdevice { public: - nvhost_nvjpg(); + nvhost_nvjpg(Core::System& system); ~nvhost_nvjpg() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index d544f0f314..853136dea1 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp @@ -10,7 +10,7 @@ namespace Service::Nvidia::Devices { -nvhost_vic::nvhost_vic() = default; +nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system){}; nvhost_vic::~nvhost_vic() = default; u32 nvhost_vic::ioctl(Ioctl command, const std::vector& input, std::vector& output) { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index fc24c3f9c0..b71816ba17 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h @@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices { class nvhost_vic final : public nvdevice { public: - nvhost_vic(); + nvhost_vic(Core::System& system); ~nvhost_vic() override; u32 ioctl(Ioctl command, const std::vector& input, std::vector& output) override; diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 1ec796fc6d..a75ff334b5 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp @@ -18,7 +18,7 @@ enum { }; } -nvmap::nvmap() = default; +nvmap::nvmap(Core::System& system) : nvdevice(system){}; nvmap::~nvmap() = default; VAddr nvmap::GetObjectAddress(u32 handle) const { diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 396230c191..623c9b232d 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h @@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices { class nvmap final : public nvdevice { public: - nvmap(); + nvmap(Core::System& system); ~nvmap() override; /// Returns the allocated address of an nvmap object given its handle. diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index d95ba18cb2..c548f1223d 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -138,8 +138,6 @@ NVDRV::NVDRV(std::shared_ptr nvdrv, const char* name) {13, &NVDRV::FinishInitialize, "FinishInitialize"}, }; RegisterHandlers(functions); - - auto& kernel = Core::System::GetInstance().Kernel(); } NVDRV::~NVDRV() = default; diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 3a716e7348..c68d291776 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp @@ -25,8 +25,9 @@ namespace Service::Nvidia { -void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger) { - auto module_ = std::make_shared(); +void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, + Core::System& system) { + auto module_ = std::make_shared(system); std::make_shared(module_, "nvdrv")->InstallAsService(service_manager); std::make_shared(module_, "nvdrv:a")->InstallAsService(service_manager); std::make_shared(module_, "nvdrv:s")->InstallAsService(service_manager); @@ -35,25 +36,25 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger nvflinger.SetNVDrvInstance(module_); } -Module::Module() { - auto& kernel = Core::System::GetInstance().Kernel(); +Module::Module(Core::System& system) { + auto& kernel = system.Kernel(); for (u32 i = 0; i < MaxNvEvents; i++) { std::string event_label = fmt::format("NVDRV::NvEvent_{}", i); - events_interface.events[i] = Kernel::WritableEvent::CreateEventPair( - kernel, Kernel::ResetType::Manual, event_label); + events_interface.events[i] = + Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, event_label); events_interface.status[i] = EventState::Free; events_interface.registered[i] = false; } - auto nvmap_dev = std::make_shared(); - devices["/dev/nvhost-as-gpu"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-gpu"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-ctrl-gpu"] = std::make_shared(); + auto nvmap_dev = std::make_shared(system); + devices["/dev/nvhost-as-gpu"] = std::make_shared(system, nvmap_dev); + devices["/dev/nvhost-gpu"] = std::make_shared(system, nvmap_dev); + devices["/dev/nvhost-ctrl-gpu"] = std::make_shared(system); devices["/dev/nvmap"] = nvmap_dev; - devices["/dev/nvdisp_disp0"] = std::make_shared(nvmap_dev); - devices["/dev/nvhost-ctrl"] = std::make_shared(events_interface); - devices["/dev/nvhost-nvdec"] = std::make_shared(); - devices["/dev/nvhost-nvjpg"] = std::make_shared(); - devices["/dev/nvhost-vic"] = std::make_shared(); + devices["/dev/nvdisp_disp0"] = std::make_shared(system, nvmap_dev); + devices["/dev/nvhost-ctrl"] = std::make_shared(system, events_interface); + devices["/dev/nvhost-nvdec"] = std::make_shared(system); + devices["/dev/nvhost-nvjpg"] = std::make_shared(system); + devices["/dev/nvhost-vic"] = std::make_shared(system); } Module::~Module() = default; diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index d299f28772..0e8eed113f 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h @@ -12,6 +12,10 @@ #include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::NVFlinger { class NVFlinger; } @@ -66,7 +70,7 @@ struct EventsInterface { class Module final { public: - Module(); + Module(Core::System& system); ~Module(); /// Returns a pointer to one of the available devices, identified by its name. @@ -103,6 +107,7 @@ private: }; /// Registers all NVDRV services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger); +void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, + Core::System& system); } // namespace Service::Nvidia diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 5fc7d3cab7..07b1f4d436 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -237,7 +237,7 @@ void Init(std::shared_ptr& sm, Core::System& system, NIM::InstallInterfaces(*sm); NPNS::InstallInterfaces(*sm); NS::InstallInterfaces(*sm); - Nvidia::InstallInterfaces(*sm, *nv_flinger); + Nvidia::InstallInterfaces(*sm, *nv_flinger, system); PCIe::InstallInterfaces(*sm); PCTL::InstallInterfaces(*sm); PCV::InstallInterfaces(*sm);