diff options
| author | 2018-02-11 21:30:23 -0500 | |
|---|---|---|
| committer | 2018-02-11 21:30:23 -0500 | |
| commit | ba2426aa3f9b433b54e43e5dae3c596e6f3ae45d (patch) | |
| tree | d8a35877596beef256e3991653d28c454f8ad0a8 /src | |
| parent | Merge pull request #175 from bunnei/libnx-fixes-2 (diff) | |
| download | yuzu-ba2426aa3f9b433b54e43e5dae3c596e6f3ae45d.tar.gz yuzu-ba2426aa3f9b433b54e43e5dae3c596e6f3ae45d.tar.xz yuzu-ba2426aa3f9b433b54e43e5dae3c596e6f3ae45d.zip | |
nvdrv: Make the GPU memory manager available to nvhost-gpu.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 10 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 7 |
3 files changed, 16 insertions, 6 deletions
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 9d37b971a..44ffddcd9 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | |||
| @@ -20,9 +20,8 @@ class nvmap; | |||
| 20 | 20 | ||
| 21 | class nvhost_as_gpu final : public nvdevice { | 21 | class nvhost_as_gpu final : public nvdevice { |
| 22 | public: | 22 | public: |
| 23 | nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvdevice(), nvmap_dev(std::move(nvmap_dev)) { | 23 | nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev, std::shared_ptr<MemoryManager> memory_manager) |
| 24 | memory_manager = std::make_shared<MemoryManager>(); | 24 | : nvdevice(), nvmap_dev(std::move(nvmap_dev)), memory_manager(std::move(memory_manager)) {} |
| 25 | } | ||
| 26 | ~nvhost_as_gpu() override = default; | 25 | ~nvhost_as_gpu() override = default; |
| 27 | 26 | ||
| 28 | u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 27 | u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 4fe2c9ad5..5b40eaa88 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
| @@ -4,20 +4,25 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "common/swap.h" | 10 | #include "common/swap.h" |
| 10 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | 11 | #include "core/hle/service/nvdrv/devices/nvdevice.h" |
| 12 | #include "core/hle/service/nvdrv/memory_manager.h" | ||
| 11 | 13 | ||
| 12 | namespace Service { | 14 | namespace Service { |
| 13 | namespace Nvidia { | 15 | namespace Nvidia { |
| 14 | namespace Devices { | 16 | namespace Devices { |
| 17 | |||
| 18 | class nvmap; | ||
| 15 | constexpr u32 NVGPU_IOCTL_MAGIC('H'); | 19 | constexpr u32 NVGPU_IOCTL_MAGIC('H'); |
| 16 | constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8); | 20 | constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8); |
| 17 | 21 | ||
| 18 | class nvhost_gpu final : public nvdevice { | 22 | class nvhost_gpu final : public nvdevice { |
| 19 | public: | 23 | public: |
| 20 | nvhost_gpu() = default; | 24 | nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev, std::shared_ptr<MemoryManager> memory_manager) |
| 25 | : nvdevice(), nvmap_dev(std::move(nvmap_dev)), memory_manager(std::move(memory_manager)) {} | ||
| 21 | ~nvhost_gpu() override = default; | 26 | ~nvhost_gpu() override = default; |
| 22 | 27 | ||
| 23 | u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 28 | u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; |
| @@ -132,6 +137,9 @@ private: | |||
| 132 | u32 AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output); | 137 | u32 AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output); |
| 133 | u32 AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output); | 138 | u32 AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output); |
| 134 | u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output); | 139 | u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output); |
| 140 | |||
| 141 | std::shared_ptr<nvmap> nvmap_dev; | ||
| 142 | std::shared_ptr<MemoryManager> memory_manager; | ||
| 135 | }; | 143 | }; |
| 136 | 144 | ||
| 137 | } // namespace Devices | 145 | } // namespace Devices |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index a98634422..469d6d33a 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" | 11 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" |
| 12 | #include "core/hle/service/nvdrv/devices/nvmap.h" | 12 | #include "core/hle/service/nvdrv/devices/nvmap.h" |
| 13 | #include "core/hle/service/nvdrv/interface.h" | 13 | #include "core/hle/service/nvdrv/interface.h" |
| 14 | #include "core/hle/service/nvdrv/memory_manager.h" | ||
| 14 | #include "core/hle/service/nvdrv/nvdrv.h" | 15 | #include "core/hle/service/nvdrv/nvdrv.h" |
| 15 | #include "core/hle/service/nvdrv/nvmemp.h" | 16 | #include "core/hle/service/nvdrv/nvmemp.h" |
| 16 | 17 | ||
| @@ -31,12 +32,14 @@ void InstallInterfaces(SM::ServiceManager& service_manager) { | |||
| 31 | 32 | ||
| 32 | Module::Module() { | 33 | Module::Module() { |
| 33 | auto nvmap_dev = std::make_shared<Devices::nvmap>(); | 34 | auto nvmap_dev = std::make_shared<Devices::nvmap>(); |
| 34 | devices["/dev/nvhost-as-gpu"] = std::make_shared<Devices::nvhost_as_gpu>(nvmap_dev); | 35 | auto memory_manager = std::make_shared<MemoryManager>(); |
| 36 | devices["/dev/nvhost-as-gpu"] = | ||
| 37 | std::make_shared<Devices::nvhost_as_gpu>(nvmap_dev, memory_manager); | ||
| 38 | devices["/dev/nvhost-gpu"] = std::make_shared<Devices::nvhost_gpu>(nvmap_dev, memory_manager); | ||
| 35 | devices["/dev/nvhost-ctrl-gpu"] = std::make_shared<Devices::nvhost_ctrl_gpu>(); | 39 | devices["/dev/nvhost-ctrl-gpu"] = std::make_shared<Devices::nvhost_ctrl_gpu>(); |
| 36 | devices["/dev/nvmap"] = nvmap_dev; | 40 | devices["/dev/nvmap"] = nvmap_dev; |
| 37 | devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev); | 41 | devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev); |
| 38 | devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(); | 42 | devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(); |
| 39 | devices["/dev/nvhost-gpu"] = std::make_shared<Devices::nvhost_gpu>(); | ||
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | u32 Module::Open(std::string device_name) { | 45 | u32 Module::Open(std::string device_name) { |