summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-02-11 21:30:23 -0500
committerGravatar Subv2018-02-11 21:30:23 -0500
commitba2426aa3f9b433b54e43e5dae3c596e6f3ae45d (patch)
treed8a35877596beef256e3991653d28c454f8ad0a8 /src
parentMerge pull request #175 from bunnei/libnx-fixes-2 (diff)
downloadyuzu-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.h5
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.h10
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp7
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
21class nvhost_as_gpu final : public nvdevice { 21class nvhost_as_gpu final : public nvdevice {
22public: 22public:
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
12namespace Service { 14namespace Service {
13namespace Nvidia { 15namespace Nvidia {
14namespace Devices { 16namespace Devices {
17
18class nvmap;
15constexpr u32 NVGPU_IOCTL_MAGIC('H'); 19constexpr u32 NVGPU_IOCTL_MAGIC('H');
16constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8); 20constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8);
17 21
18class nvhost_gpu final : public nvdevice { 22class nvhost_gpu final : public nvdevice {
19public: 23public:
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
32Module::Module() { 33Module::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
42u32 Module::Open(std::string device_name) { 45u32 Module::Open(std::string device_name) {