From 58d90787429e7e29dbcf3520de7b6a24610612c1 Mon Sep 17 00:00:00 2001 From: David <25727384+ogniK5377@users.noreply.github.com> Date: Tue, 22 May 2018 14:41:19 -0700 Subject: [PATCH] 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 --- src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 11 +++++++++++ src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 25e3ccef60..03126aeeea 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& input, std::vector& input, std::vector& outp return 0; } +u32 nvhost_gpu::GetWaitbase(const std::vector& input, std::vector& output) { + IoctlGetWaitbase params{}; + std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase)); + NGLOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown); + params.value = 0; // Seems to be hard coded at 0 + std::memcpy(output.data(), ¶ms, output.size()); + return 0; +} + } // 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 703c36bbb5..beb1c4970f 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: IocChannelSetPriorityCommand = 0x4004480D, IocAllocGPFIFOEx2Command = 0xC020481A, IocAllocObjCtxCommand = 0xC0104809, + IocChannelGetWaitbaseCommand = 0xC0080003, }; enum class CtxObjects : u32_le { @@ -117,7 +118,13 @@ private: IoctlFence fence_out; // returned new fence object for others to wait on }; static_assert(sizeof(IoctlSubmitGpfifo) == 16 + sizeof(IoctlFence), - "submit_gpfifo is incorrect size"); + "IoctlSubmitGpfifo is incorrect size"); + + struct IoctlGetWaitbase { + u32 unknown; // seems to be ignored? Nintendo added this + u32 value; + }; + static_assert(sizeof(IoctlGetWaitbase) == 8, "IoctlGetWaitbase is incorrect size"); u32_le nvmap_fd{}; u64_le user_data{}; @@ -133,6 +140,7 @@ private: u32 AllocGPFIFOEx2(const std::vector& input, std::vector& output); u32 AllocateObjectContext(const std::vector& input, std::vector& output); u32 SubmitGPFIFO(const std::vector& input, std::vector& output); + u32 GetWaitbase(const std::vector& input, std::vector& output); std::shared_ptr nvmap_dev; };