Skip to content

Commit

Permalink
Switch NvHostCtrlGpu to use QueryEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
bylaws authored and PixelyIon committed Aug 15, 2020
1 parent cf60869 commit fcae5d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
};
}

0 comments on commit fcae5d5

Please sign in to comment.