summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar David2018-05-22 14:41:19 -0700
committerGravatar bunnei2018-05-22 17:41:19 -0400
commit58d90787429e7e29dbcf3520de7b6a24610612c1 (patch)
tree194b08989ab2870e33cfb8a4d764a13f39a2933b /src/core
parentMerge pull request #456 from Subv/unmap_buffer (diff)
downloadyuzu-58d90787429e7e29dbcf3520de7b6a24610612c1.tar.gz
yuzu-58d90787429e7e29dbcf3520de7b6a24610612c1.tar.xz
yuzu-58d90787429e7e29dbcf3520de7b6a24610612c1.zip
Implemented NVHOST_IOCTL_CHANNEL_GET_WAITBASE (#440)
* Implemented NVHOST_IOCTL_CHANNEL_GET_WAITBASE struct + 4 seems to be hard coded at 0 and struct + 0 seems to be ignored? * IocGetWaitbase -> IocChannelGetWaitbaseCommand * Added super late fixes
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp11
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.h10
2 files changed, 20 insertions, 1 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
index 25e3ccef6..03126aeee 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
@@ -32,6 +32,8 @@ u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u
32 return AllocGPFIFOEx2(input, output); 32 return AllocGPFIFOEx2(input, output);
33 case IoctlCommand::IocAllocObjCtxCommand: 33 case IoctlCommand::IocAllocObjCtxCommand:
34 return AllocateObjectContext(input, output); 34 return AllocateObjectContext(input, output);
35 case IoctlCommand::IocChannelGetWaitbaseCommand:
36 return GetWaitbase(input, output);
35 } 37 }
36 38
37 if (command.group == NVGPU_IOCTL_MAGIC) { 39 if (command.group == NVGPU_IOCTL_MAGIC) {
@@ -138,4 +140,13 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
138 return 0; 140 return 0;
139} 141}
140 142
143u32 nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) {
144 IoctlGetWaitbase params{};
145 std::memcpy(&params, input.data(), sizeof(IoctlGetWaitbase));
146 NGLOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown);
147 params.value = 0; // Seems to be hard coded at 0
148 std::memcpy(output.data(), &params, output.size());
149 return 0;
150}
151
141} // namespace Service::Nvidia::Devices 152} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
index 703c36bbb..beb1c4970 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
@@ -33,6 +33,7 @@ private:
33 IocChannelSetPriorityCommand = 0x4004480D, 33 IocChannelSetPriorityCommand = 0x4004480D,
34 IocAllocGPFIFOEx2Command = 0xC020481A, 34 IocAllocGPFIFOEx2Command = 0xC020481A,
35 IocAllocObjCtxCommand = 0xC0104809, 35 IocAllocObjCtxCommand = 0xC0104809,
36 IocChannelGetWaitbaseCommand = 0xC0080003,
36 }; 37 };
37 38
38 enum class CtxObjects : u32_le { 39 enum class CtxObjects : u32_le {
@@ -117,7 +118,13 @@ private:
117 IoctlFence fence_out; // returned new fence object for others to wait on 118 IoctlFence fence_out; // returned new fence object for others to wait on
118 }; 119 };
119 static_assert(sizeof(IoctlSubmitGpfifo) == 16 + sizeof(IoctlFence), 120 static_assert(sizeof(IoctlSubmitGpfifo) == 16 + sizeof(IoctlFence),
120 "submit_gpfifo is incorrect size"); 121 "IoctlSubmitGpfifo is incorrect size");
122
123 struct IoctlGetWaitbase {
124 u32 unknown; // seems to be ignored? Nintendo added this
125 u32 value;
126 };
127 static_assert(sizeof(IoctlGetWaitbase) == 8, "IoctlGetWaitbase is incorrect size");
121 128
122 u32_le nvmap_fd{}; 129 u32_le nvmap_fd{};
123 u64_le user_data{}; 130 u64_le user_data{};
@@ -133,6 +140,7 @@ private:
133 u32 AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output); 140 u32 AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output);
134 u32 AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output); 141 u32 AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output);
135 u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output); 142 u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output);
143 u32 GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output);
136 144
137 std::shared_ptr<nvmap> nvmap_dev; 145 std::shared_ptr<nvmap> nvmap_dev;
138}; 146};