From 5479b9b50d85818cf73a87d643cad6557e7ed8f9 Mon Sep 17 00:00:00 2001 From: Nguyen Dac Nam Date: Wed, 19 Feb 2020 01:03:22 +0700 Subject: [PATCH] nvhost_nvdec: add IocChannelGetSyncPoint and ChannelSubmit --- .../hle/service/nvdrv/devices/nvhost_nvdec.h | 66 ++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 1ad1c700cd..f84c9d5d1c 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h @@ -23,6 +23,7 @@ public: private: enum class IoctlCommand : u32_le { IocSetNVMAPfdCommand = 0x40044801, + IocChannelGetSyncPoint = 0xC0080002, IocChannelGetWaitBase = 0xC0080003, }; @@ -30,7 +31,56 @@ private: u32_le nvmap_fd; }; static_assert(sizeof(IoctlSetNvmapFD) == 4, "IoctlSetNvmapFD is incorrect size"); - + + struct IoctlCmdBuf { + u32_le mem; + u32_le offset; + u32_le words; + }; + static_assert(sizeof(IoctlCmdBuf) == 12, "IoctlCmdBuf is incorrect size"); + + struct IoctlReloc { + u32_le cmdbuf_mem; + u32_le cmdbuf_offset; + u32_le target; + u32_le target_offset; + }; + static_assert(sizeof(IoctlReloc) == 16, "IoctlReloc is incorrect size"); + + struct IoctlRelocShift { + u32_le shift; + }; + static_assert(sizeof(IoctlRelocShift) == 4, "IoctlRelocShift is incorrect size"); + + struct IoctlSyncPtIncr { + u32_le syncpt_id; + u32_le syncpt_incrs; + }; + static_assert(sizeof(IoctlSyncPtIncr) == 8, "IoctlSyncPtIncr is incorrect size"); + + struct IoctlFence { + u32_le id; + u32_le thresh; + }; + static_assert(sizeof(IoctlFence) == 8, "IoctlFence is incorrect size"); + + struct IoctlSubmit { + // [in] + u32_le num_cmdbufs; + // [in] + u32_le num_relocs; + // [in] + u32_le num_syncpt_incrs; + // [in] + u32_le num_fences; + // __in struct cmdbuf cmdbufs[]; + // __in struct reloc relocs[]; + // __in struct reloc_shift reloc_shifts[]; + // __in struct syncpt_incr syncpt_incrs[]; + // __out struct fence fences[]; + }; + static_assert(sizeof(IoctlSubmit) == 16, "IoctlSubmit is incorrect size"); + struct IoctlHandleMapBuffer { u32_le handle_id_in; // nvmap handle to map u32_le phys_addr_out; // returned device physical address mapped to the handle @@ -48,7 +98,7 @@ private: INSERT_PADDING_BYTES(0x3); }; static_assert(sizeof(IoctlMapCmdBuffer) == 12, "IoctlMapCmdBuffer is incorrect size"); - + struct IoctChannelWaitBase { // [in] u32_le module_id; @@ -57,9 +107,21 @@ private: }; static_assert(sizeof(IoctChannelWaitBase) == 8, "IoctChannelWaitBase is incorrect size"); + struct IoctChannelSyncPoint { + // [in] + u32_le syncpt_id; + // [out] Returns the current syncpoint value for a given module. Identical to Linux driver. + u32_le syncpt_value; + }; + static_assert(sizeof(IoctChannelSyncPoint) == 8, "IoctChannelSyncPoint is incorrect size"); + u32_le nvmap_fd{}; + std::unordered_map syncPtValues; + u32 SetNVMAPfd(const std::vector& input, std::vector& output); + u32 ChannelSubmit(const std::vector& input, std::vector& output); + u32 ChannelGetSyncPoint(const std::vector& input, std::vector& output); u32 ChannelGetWaitBase(const std::vector& input, std::vector& output); u32 ChannelMapCmdBuffer(const std::vector& input, std::vector& output); };