VERY experimental Nintendo Switch 2 emulator
C++
nvdrv/devices/nvidia_ctrl_gpu : add IoctlCommands with their params (#524)
greggameplayer186abe265202
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cppindex a9538ff435..0abc0de834 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp@@ -26,6 +26,10 @@ u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vecreturn ZCullGetInfo(input, output);case IoctlCommand::IocZbcSetTable:return ZBCSetTable(input, output);+ case IoctlCommand::IocZbcQueryTable:+ return ZBCQueryTable(input, output);+ case IoctlCommand::IocFlushL2:+ return FlushL2(input, output);}UNIMPLEMENTED_MSG("Unimplemented ioctl");return 0;@@ -136,4 +140,22 @@ u32 nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>&return 0;}+u32 nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output) {+ NGLOG_WARNING(Service_NVDRV, "(STUBBED) called");+ IoctlZbcQueryTable params{};+ std::memcpy(¶ms, input.data(), input.size());+ // TODO : To implement properly+ std::memcpy(output.data(), ¶ms, output.size());+ return 0;+}++u32 nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& output) {+ NGLOG_WARNING(Service_NVDRV, "(STUBBED) called");+ IoctlFlushL2 params{};+ std::memcpy(¶ms, input.data(), input.size());+ // TODO : To implement properly+ std::memcpy(output.data(), ¶ms, output.size());+ return 0;+}+} // namespace Service::Nvidia::Devicesdiff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.hindex 1d5ba2e672..f09113e678 100644--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h@@ -26,6 +26,18 @@ private:IocZcullGetCtxSizeCommand = 0x80044701,IocZcullGetInfo = 0x80284702,IocZbcSetTable = 0x402C4703,+ IocZbcQueryTable = 0xC0344704,+ IocFlushL2 = 0x40084707,+ IocInvalICache = 0x4008470D,+ IocSetMmudebugMode = 0x4008470E,+ IocSetSmDebugMode = 0x4010470F,+ IocWaitForPause = 0xC0084710,+ IocGetTcpExceptionEnStatus = 0x80084711,+ IocNumVsms = 0x80084712,+ IocVsmsMapping = 0xC0044713,+ IocGetErrorChannelUserData = 0xC008471B,+ IocGetGpuTime = 0xC010471C,+ IocGetCpuTimeCorrelationInfo = 0xC108471D,};struct IoctlGpuCharacteristics {@@ -127,12 +139,31 @@ private:};static_assert(sizeof(IoctlZbcSetTable) == 44, "IoctlZbcSetTable is incorrect size");+ struct IoctlZbcQueryTable {+ u32_le color_ds[4];+ u32_le color_l2[4];+ u32_le depth;+ u32_le ref_cnt;+ u32_le format;+ u32_le type;+ u32_le index_size;+ };+ static_assert(sizeof(IoctlZbcQueryTable) == 52, "IoctlZbcQueryTable is incorrect size");++ struct IoctlFlushL2 {+ u32_le flush; // l2_flush | l2_invalidate << 1 | fb_flush << 2+ u32_le reserved;+ };+ static_assert(sizeof(IoctlFlushL2) == 8, "IoctlFlushL2 is incorrect size");+u32 GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output);u32 GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output);u32 GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output);u32 ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output);u32 ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output);u32 ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output);+ u32 ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output);+ u32 FlushL2(const std::vector<u8>& input, std::vector<u8>& output);};} // namespace Service::Nvidia::Devices