From fcae5d54da0ca653094e4fe1428490ffc300a0fe Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 9 Aug 2020 14:58:34 +0100 Subject: [PATCH] Switch NvHostCtrlGpu to use QueryEvent --- .../services/nvdrv/devices/nvhost_ctrl_gpu.cpp | 16 ++++++++++++++-- .../services/nvdrv/devices/nvhost_ctrl_gpu.h | 6 ++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.cpp b/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.cpp index 0bf7b90b..d658b569 100644 --- a/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.cpp @@ -5,12 +5,12 @@ #include "nvhost_ctrl_gpu.h" namespace skyline::service::nvdrv::device { - NvHostCtrlGpu::NvHostCtrlGpu(const DeviceState &state) : NvDevice(state, NvDeviceType::nvhost_ctrl_gpu, { + NvHostCtrlGpu::NvHostCtrlGpu(const DeviceState &state) : errorNotifierEvent(std::make_shared(state)), unknownEvent(std::make_shared(state)), NvDevice(state, NvDeviceType::nvhost_ctrl_gpu, { {0x4701, NFUNC(NvHostCtrlGpu::ZCullGetCtxSize)}, {0x4702, NFUNC(NvHostCtrlGpu::ZCullGetInfo)}, {0x4706, NFUNC(NvHostCtrlGpu::GetTpcMasks)}, {0x4705, NFUNC(NvHostCtrlGpu::GetCharacteristics)}, - {0x4714, NFUNC(NvHostCtrlGpu::GetActiveSlotMask)} + {0x4714, NFUNC(NvHostCtrlGpu::GetActiveSlotMask)}, }) {} void NvHostCtrlGpu::ZCullGetCtxSize(IoctlData &buffer) { @@ -146,4 +146,16 @@ namespace skyline::service::nvdrv::device { state.process->WriteMemory(data, buffer.output[0].address); } + + std::shared_ptr NvHostCtrlGpu::QueryEvent(u32 eventId) { + switch (eventId) { + case 1: + return errorNotifierEvent; + case 2: + return unknownEvent; + default: + return nullptr; + } + } + } diff --git a/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.h b/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.h index 3565a256..cbccfb72 100644 --- a/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost_ctrl_gpu.h @@ -10,6 +10,10 @@ namespace skyline::service::nvdrv::device { * @brief NvHostCtrlGpu (/dev/nvhost-ctrl-gpu) is used for context independent operations on the underlying GPU (https://switchbrew.org/wiki/NV_services#.2Fdev.2Fnvhost-ctrl-gpu) */ class NvHostCtrlGpu : public NvDevice { + private: + std::shared_ptr errorNotifierEvent; + std::shared_ptr unknownEvent; + public: NvHostCtrlGpu(const DeviceState &state); @@ -37,5 +41,7 @@ namespace skyline::service::nvdrv::device { * @brief This returns the mask value for a ZBC slot (https://switchbrew.org/wiki/NV_services#NVGPU_GPU_IOCTL_ZBC_GET_ACTIVE_SLOT_MASK) */ void GetActiveSlotMask(IoctlData &buffer); + + std::shared_ptr QueryEvent(u32 eventId); }; }