Add nvGpuChannelGetErrorInfo, see details:

- Rename NvError(Type) to NvNotification(Type)
- Introduce NvError struct (output of GetErrorInfo)
- Add nvioctlChannel_GetErrorInfo
This commit is contained in:
fincs 2020-04-19 22:18:45 +02:00
parent f5e4615a40
commit a1af4494bf
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
4 changed files with 33 additions and 17 deletions

View File

@ -24,7 +24,8 @@ void nvGpuChannelClose(NvGpuChannel* c);
Result nvGpuChannelZcullBind(NvGpuChannel* c, iova_t iova);
Result nvGpuChannelAppendEntry(NvGpuChannel* c, iova_t start, size_t num_cmds, u32 flags, u32 flush_threshold);
Result nvGpuChannelKickoff(NvGpuChannel* c);
Result nvGpuChannelGetErrorNotification(NvGpuChannel* c, NvError* error);
Result nvGpuChannelGetErrorNotification(NvGpuChannel* c, NvNotification* notif);
Result nvGpuChannelGetErrorInfo(NvGpuChannel* c, NvError* error);
static inline u32 nvGpuChannelGetSyncpointId(NvGpuChannel* c)
{

View File

@ -181,21 +181,26 @@ typedef enum {
} NvMapBufferFlags;
typedef enum {
NvErrorType_FifoErrorIdleTimeout=8,
NvErrorType_GrErrorSwNotify=13,
NvErrorType_GrSemaphoreTimeout=24,
NvErrorType_GrIllegalNotify=25,
NvErrorType_FifoErrorMmuErrFlt=31,
NvErrorType_PbdmaError=32,
NvErrorType_ResetChannelVerifError=43,
NvErrorType_PbdmaPushbufferCrcMismatch=80
} NvErrorType;
NvNotificationType_FifoErrorIdleTimeout=8,
NvNotificationType_GrErrorSwNotify=13,
NvNotificationType_GrSemaphoreTimeout=24,
NvNotificationType_GrIllegalNotify=25,
NvNotificationType_FifoErrorMmuErrFlt=31,
NvNotificationType_PbdmaError=32,
NvNotificationType_ResetChannelVerifError=43,
NvNotificationType_PbdmaPushbufferCrcMismatch=80
} NvNotificationType;
typedef struct {
u64 tickstamp;
u32 error_type;
u16 unk16;
u64 timestamp;
u32 info32; // see NvNotificationType
u16 info16;
u16 status; // always -1
} NvNotification;
typedef struct {
u32 type;
u32 info[31];
} NvError;
Result nvioctlNvhostCtrl_SyncptRead(u32 fd, u32 id, u32* out);
@ -236,7 +241,8 @@ Result nvioctlChannel_KickoffPb(u32 fd, nvioctl_gpfifo_entry *entries, u32 num_e
Result nvioctlChannel_AllocObjCtx(u32 fd, u32 class_num, u32 flags, u64* id_out);
Result nvioctlChannel_ZCullBind(u32 fd, u64 gpu_va, u32 mode);
Result nvioctlChannel_SetErrorNotifier(u32 fd, u32 enable);
Result nvioctlChannel_GetErrorNotification(u32 fd, NvError* out);
Result nvioctlChannel_GetErrorInfo(u32 fd, NvError* out);
Result nvioctlChannel_GetErrorNotification(u32 fd, NvNotification* out);
Result nvioctlChannel_SetPriority(u32 fd, u32 priority);
Result nvioctlChannel_SetTimeout(u32 fd, u32 timeout);
Result nvioctlChannel_AllocGpfifoEx2(u32 fd, u32 num_entries, u32 flags, u32 unk0, u32 unk1, u32 unk2, u32 unk3, nvioctl_fence *fence_out);

View File

@ -120,10 +120,15 @@ Result nvGpuChannelKickoff(NvGpuChannel* c)
return res;
}
Result nvGpuChannelGetErrorNotification(NvGpuChannel* c, NvError* error)
Result nvGpuChannelGetErrorNotification(NvGpuChannel* c, NvNotification* notif)
{
Result res = eventWait(&c->error_event, 0);
if (R_SUCCEEDED(res))
res = nvioctlChannel_GetErrorNotification(c->base.fd, error);
res = nvioctlChannel_GetErrorNotification(c->base.fd, notif);
return res;
}
Result nvGpuChannelGetErrorInfo(NvGpuChannel* c, NvError* error)
{
return nvioctlChannel_GetErrorInfo(c->base.fd, error);
}

View File

@ -125,7 +125,11 @@ Result nvioctlChannel_SetErrorNotifier(u32 fd, u32 enable) {
return nvIoctl(fd, _NV_IOWR(0x48, 0x0C, data), &data);
}
Result nvioctlChannel_GetErrorNotification(u32 fd, NvError* out) {
Result nvioctlChannel_GetErrorInfo(u32 fd, NvError* out) {
return nvIoctl(fd, _NV_IOR(0x48, 0x16, *out), out);
}
Result nvioctlChannel_GetErrorNotification(u32 fd, NvNotification* out) {
return nvIoctl(fd, _NV_IOWR(0x48, 0x17, *out), out);
}