nv_services: Deglobalize NvServices

This commit is contained in:
Fernando Sahmkow 2019-06-10 12:03:30 -04:00 committed by FernandoS27
parent f2e026a1d8
commit 24408cce9b
23 changed files with 65 additions and 51 deletions

View file

@ -9,13 +9,17 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
namespace Core {
class System;
}
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
/// Represents an abstract nvidia device node. It is to be subclassed by concrete device nodes to /// Represents an abstract nvidia device node. It is to be subclassed by concrete device nodes to
/// implement the ioctl interface. /// implement the ioctl interface.
class nvdevice { class nvdevice {
public: public:
nvdevice() = default; nvdevice(Core::System& system) : system{system} {};
virtual ~nvdevice() = default; virtual ~nvdevice() = default;
union Ioctl { union Ioctl {
u32_le raw; u32_le raw;
@ -34,6 +38,9 @@ public:
* @returns The result code of the ioctl. * @returns The result code of the ioctl.
*/ */
virtual u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) = 0; virtual u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) = 0;
protected:
Core::System& system;
}; };
} // namespace Service::Nvidia::Devices } // namespace Service::Nvidia::Devices

View file

@ -13,7 +13,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
nvdisp_disp0::nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)
: nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
nvdisp_disp0 ::~nvdisp_disp0() = default; nvdisp_disp0 ::~nvdisp_disp0() = default;
u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& 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<PixelFormat>(format), addr, offset, width, height, stride, static_cast<PixelFormat>(format),
transform, crop_rect}; transform, crop_rect};
auto& instance = Core::System::GetInstance(); auto& instance = system;
instance.GetPerfStats().EndGameFrame(); instance.GetPerfStats().EndGameFrame();
instance.GPU().SwapBuffers(framebuffer); instance.GPU().SwapBuffers(framebuffer);
} }

View file

@ -17,7 +17,7 @@ class nvmap;
class nvdisp_disp0 final : public nvdevice { class nvdisp_disp0 final : public nvdevice {
public: public:
explicit nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev); explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
~nvdisp_disp0() override; ~nvdisp_disp0() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -22,7 +22,8 @@ enum {
}; };
} }
nvhost_as_gpu::nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)
: nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
nvhost_as_gpu::~nvhost_as_gpu() = default; nvhost_as_gpu::~nvhost_as_gpu() = default;
u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
@ -65,7 +66,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>&
LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages, LOG_DEBUG(Service_NVDRV, "called, pages={:X}, page_size={:X}, flags={:X}", params.pages,
params.page_size, params.flags); params.page_size, params.flags);
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = system.GPU();
const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)}; const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)};
if (params.flags & 1) { if (params.flags & 1) {
params.offset = gpu.MemoryManager().AllocateSpace(params.offset, size, 1); params.offset = gpu.MemoryManager().AllocateSpace(params.offset, size, 1);
@ -85,7 +86,7 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)
std::vector<IoctlRemapEntry> entries(num_entries); std::vector<IoctlRemapEntry> entries(num_entries);
std::memcpy(entries.data(), input.data(), input.size()); std::memcpy(entries.data(), input.data(), input.size());
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = system.GPU();
for (const auto& entry : entries) { for (const auto& entry : entries) {
LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}",
entry.offset, entry.nvmap_handle, entry.pages); entry.offset, entry.nvmap_handle, entry.pages);
@ -136,7 +137,7 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou
// case to prevent unexpected behavior. // case to prevent unexpected behavior.
ASSERT(object->id == params.nvmap_handle); ASSERT(object->id == params.nvmap_handle);
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = system.GPU();
if (params.flags & 1) { if (params.flags & 1) {
params.offset = gpu.MemoryManager().MapBufferEx(object->addr, params.offset, object->size); params.offset = gpu.MemoryManager().MapBufferEx(object->addr, params.offset, object->size);
@ -173,8 +174,7 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou
return 0; return 0;
} }
params.offset = Core::System::GetInstance().GPU().MemoryManager().UnmapBuffer(params.offset, params.offset = system.GPU().MemoryManager().UnmapBuffer(params.offset, itr->second.size);
itr->second.size);
buffer_mappings.erase(itr->second.offset); buffer_mappings.erase(itr->second.offset);
std::memcpy(output.data(), &params, output.size()); std::memcpy(output.data(), &params, output.size());

View file

@ -17,7 +17,7 @@ class nvmap;
class nvhost_as_gpu final : public nvdevice { class nvhost_as_gpu final : public nvdevice {
public: public:
explicit nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev); explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
~nvhost_as_gpu() override; ~nvhost_as_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -15,7 +15,8 @@
namespace Service::Nvidia::Devices { 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; nvhost_ctrl::~nvhost_ctrl() = default;
u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
@ -59,7 +60,7 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
return NvResult::BadParameter; return NvResult::BadParameter;
} }
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = system.GPU();
// This is mostly to take into account unimplemented features. As synced // This is mostly to take into account unimplemented features. As synced
// gpu is always synced. // gpu is always synced.
if (!gpu.IsAsync()) { if (!gpu.IsAsync()) {
@ -158,7 +159,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector<u8>& input, std::vector<u8
return NvResult::BadParameter; return NvResult::BadParameter;
} }
if (events_interface.status[event_id] == EventState::Waiting) { if (events_interface.status[event_id] == EventState::Waiting) {
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = system.GPU();
gpu.CancelEvent(event_id, events_interface.assigned_syncpt[event_id], gpu.CancelEvent(event_id, events_interface.assigned_syncpt[event_id],
events_interface.assigned_value[event_id]); events_interface.assigned_value[event_id]);
events_interface.LiberateEvent(event_id); events_interface.LiberateEvent(event_id);

View file

@ -14,7 +14,7 @@ namespace Service::Nvidia::Devices {
class nvhost_ctrl final : public nvdevice { class nvhost_ctrl final : public nvdevice {
public: public:
nvhost_ctrl(EventsInterface& events_interface); nvhost_ctrl(Core::System& system, EventsInterface& events_interface);
~nvhost_ctrl() override; ~nvhost_ctrl() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -12,7 +12,7 @@
namespace Service::Nvidia::Devices { 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; nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default;
u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
@ -185,7 +185,7 @@ u32 nvhost_ctrl_gpu::GetGpuTime(const std::vector<u8>& input, std::vector<u8>& o
IoctlGetGpuTime params{}; IoctlGetGpuTime params{};
std::memcpy(&params, input.data(), input.size()); std::memcpy(&params, 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<u64_le>(ns.count()); params.gpu_time = static_cast<u64_le>(ns.count());
std::memcpy(output.data(), &params, output.size()); std::memcpy(output.data(), &params, output.size());
return 0; return 0;

View file

@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_ctrl_gpu final : public nvdevice { class nvhost_ctrl_gpu final : public nvdevice {
public: public:
nvhost_ctrl_gpu(); nvhost_ctrl_gpu(Core::System& system);
~nvhost_ctrl_gpu() override; ~nvhost_ctrl_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -13,7 +13,8 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
nvhost_gpu::nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)
: nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
nvhost_gpu::~nvhost_gpu() = default; nvhost_gpu::~nvhost_gpu() = default;
u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
@ -119,7 +120,7 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& ou
params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, params.num_entries, params.flags, params.unk0, params.unk1, params.unk2,
params.unk3); params.unk3);
auto& gpu = Core::System::GetInstance().GPU(); auto& gpu = system.GPU();
params.fence_out.id = channels; params.fence_out.id = channels;
params.fence_out.value = gpu.GetSyncpointValue(channels); params.fence_out.value = gpu.GetSyncpointValue(channels);
channels++; channels++;
@ -158,7 +159,7 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0); UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0);
UNIMPLEMENTED_IF(params.flags.add_increment.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); u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id);
if (params.flags.increment.Value()) { if (params.flags.increment.Value()) {
params.fence_out.value += current_syncpoint_value; params.fence_out.value += current_syncpoint_value;
@ -189,7 +190,7 @@ u32 nvhost_gpu::KickoffPB(const std::vector<u8>& input, std::vector<u8>& output)
UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0); UNIMPLEMENTED_IF(params.flags.add_wait.Value() != 0);
UNIMPLEMENTED_IF(params.flags.add_increment.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); u32 current_syncpoint_value = gpu.GetSyncpointValue(params.fence_out.id);
if (params.flags.increment.Value()) { if (params.flags.increment.Value()) {
params.fence_out.value += current_syncpoint_value; params.fence_out.value += current_syncpoint_value;

View file

@ -20,7 +20,7 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_KICKOFF_PB(0x1b);
class nvhost_gpu final : public nvdevice { class nvhost_gpu final : public nvdevice {
public: public:
explicit nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev); explicit nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
~nvhost_gpu() override; ~nvhost_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -10,7 +10,7 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
nvhost_nvdec::nvhost_nvdec() = default; nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system){};
nvhost_nvdec::~nvhost_nvdec() = default; nvhost_nvdec::~nvhost_nvdec() = default;
u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {

View file

@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_nvdec final : public nvdevice { class nvhost_nvdec final : public nvdevice {
public: public:
nvhost_nvdec(); nvhost_nvdec(Core::System& system);
~nvhost_nvdec() override; ~nvhost_nvdec() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -10,7 +10,7 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
nvhost_nvjpg::nvhost_nvjpg() = default; nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system){};
nvhost_nvjpg::~nvhost_nvjpg() = default; nvhost_nvjpg::~nvhost_nvjpg() = default;
u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {

View file

@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_nvjpg final : public nvdevice { class nvhost_nvjpg final : public nvdevice {
public: public:
nvhost_nvjpg(); nvhost_nvjpg(Core::System& system);
~nvhost_nvjpg() override; ~nvhost_nvjpg() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -10,7 +10,7 @@
namespace Service::Nvidia::Devices { namespace Service::Nvidia::Devices {
nvhost_vic::nvhost_vic() = default; nvhost_vic::nvhost_vic(Core::System& system) : nvdevice(system){};
nvhost_vic::~nvhost_vic() = default; nvhost_vic::~nvhost_vic() = default;
u32 nvhost_vic::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_vic::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {

View file

@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
class nvhost_vic final : public nvdevice { class nvhost_vic final : public nvdevice {
public: public:
nvhost_vic(); nvhost_vic(Core::System& system);
~nvhost_vic() override; ~nvhost_vic() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -18,7 +18,7 @@ enum {
}; };
} }
nvmap::nvmap() = default; nvmap::nvmap(Core::System& system) : nvdevice(system){};
nvmap::~nvmap() = default; nvmap::~nvmap() = default;
VAddr nvmap::GetObjectAddress(u32 handle) const { VAddr nvmap::GetObjectAddress(u32 handle) const {

View file

@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices {
class nvmap final : public nvdevice { class nvmap final : public nvdevice {
public: public:
nvmap(); nvmap(Core::System& system);
~nvmap() override; ~nvmap() override;
/// Returns the allocated address of an nvmap object given its handle. /// Returns the allocated address of an nvmap object given its handle.

View file

@ -138,8 +138,6 @@ NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
{13, &NVDRV::FinishInitialize, "FinishInitialize"}, {13, &NVDRV::FinishInitialize, "FinishInitialize"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
auto& kernel = Core::System::GetInstance().Kernel();
} }
NVDRV::~NVDRV() = default; NVDRV::~NVDRV() = default;

View file

@ -25,8 +25,9 @@
namespace Service::Nvidia { namespace Service::Nvidia {
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger) { void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
auto module_ = std::make_shared<Module>(); Core::System& system) {
auto module_ = std::make_shared<Module>(system);
std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager); std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager);
std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager); std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager);
std::make_shared<NVDRV>(module_, "nvdrv:s")->InstallAsService(service_manager); std::make_shared<NVDRV>(module_, "nvdrv:s")->InstallAsService(service_manager);
@ -35,25 +36,25 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
nvflinger.SetNVDrvInstance(module_); nvflinger.SetNVDrvInstance(module_);
} }
Module::Module() { Module::Module(Core::System& system) {
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = system.Kernel();
for (u32 i = 0; i < MaxNvEvents; i++) { for (u32 i = 0; i < MaxNvEvents; i++) {
std::string event_label = fmt::format("NVDRV::NvEvent_{}", i); std::string event_label = fmt::format("NVDRV::NvEvent_{}", i);
events_interface.events[i] = Kernel::WritableEvent::CreateEventPair( events_interface.events[i] =
kernel, Kernel::ResetType::Manual, event_label); Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, event_label);
events_interface.status[i] = EventState::Free; events_interface.status[i] = EventState::Free;
events_interface.registered[i] = false; events_interface.registered[i] = false;
} }
auto nvmap_dev = std::make_shared<Devices::nvmap>(); auto nvmap_dev = std::make_shared<Devices::nvmap>(system);
devices["/dev/nvhost-as-gpu"] = std::make_shared<Devices::nvhost_as_gpu>(nvmap_dev); devices["/dev/nvhost-as-gpu"] = std::make_shared<Devices::nvhost_as_gpu>(system, nvmap_dev);
devices["/dev/nvhost-gpu"] = std::make_shared<Devices::nvhost_gpu>(nvmap_dev); devices["/dev/nvhost-gpu"] = std::make_shared<Devices::nvhost_gpu>(system, nvmap_dev);
devices["/dev/nvhost-ctrl-gpu"] = std::make_shared<Devices::nvhost_ctrl_gpu>(); devices["/dev/nvhost-ctrl-gpu"] = std::make_shared<Devices::nvhost_ctrl_gpu>(system);
devices["/dev/nvmap"] = nvmap_dev; devices["/dev/nvmap"] = nvmap_dev;
devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev); devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(system, nvmap_dev);
devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(events_interface); devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(system, events_interface);
devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(system);
devices["/dev/nvhost-nvjpg"] = std::make_shared<Devices::nvhost_nvjpg>(); devices["/dev/nvhost-nvjpg"] = std::make_shared<Devices::nvhost_nvjpg>(system);
devices["/dev/nvhost-vic"] = std::make_shared<Devices::nvhost_vic>(); devices["/dev/nvhost-vic"] = std::make_shared<Devices::nvhost_vic>(system);
} }
Module::~Module() = default; Module::~Module() = default;

View file

@ -12,6 +12,10 @@
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::NVFlinger { namespace Service::NVFlinger {
class NVFlinger; class NVFlinger;
} }
@ -66,7 +70,7 @@ struct EventsInterface {
class Module final { class Module final {
public: public:
Module(); Module(Core::System& system);
~Module(); ~Module();
/// Returns a pointer to one of the available devices, identified by its name. /// 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. /// 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 } // namespace Service::Nvidia

View file

@ -237,7 +237,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system,
NIM::InstallInterfaces(*sm); NIM::InstallInterfaces(*sm);
NPNS::InstallInterfaces(*sm); NPNS::InstallInterfaces(*sm);
NS::InstallInterfaces(*sm); NS::InstallInterfaces(*sm);
Nvidia::InstallInterfaces(*sm, *nv_flinger); Nvidia::InstallInterfaces(*sm, *nv_flinger, system);
PCIe::InstallInterfaces(*sm); PCIe::InstallInterfaces(*sm);
PCTL::InstallInterfaces(*sm); PCTL::InstallInterfaces(*sm);
PCV::InstallInterfaces(*sm); PCV::InstallInterfaces(*sm);