Switch NvHostCtrlGpu to use QueryEvent

This commit is contained in:
Billy Laws 2020-08-09 14:58:34 +01:00 committed by ◱ PixelyIon
parent cf60869fac
commit fcae5d54da
2 changed files with 20 additions and 2 deletions

View File

@ -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<type::KEvent>(state)), unknownEvent(std::make_shared<type::KEvent>(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<type::KEvent> NvHostCtrlGpu::QueryEvent(u32 eventId) {
switch (eventId) {
case 1:
return errorNotifierEvent;
case 2:
return unknownEvent;
default:
return nullptr;
}
}
}

View File

@ -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<type::KEvent> errorNotifierEvent;
std::shared_ptr<type::KEvent> 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<type::KEvent> QueryEvent(u32 eventId);
};
}