libnx  v4.8.0
gpu_channel.h
1 #pragma once
2 #include "../kernel/event.h"
3 #include "channel.h"
4 #include "fence.h"
5 
6 #define GPFIFO_QUEUE_SIZE 0x800
7 #define GPFIFO_ENTRY_NOT_MAIN BIT(9)
8 #define GPFIFO_ENTRY_NO_PREFETCH BIT(31)
9 
10 typedef struct NvGpuChannel
11 {
12  NvChannel base;
13  Event error_event;
14  u64 object_id;
15  NvFence fence;
16  u32 fence_incr;
17  nvioctl_gpfifo_entry entries[GPFIFO_QUEUE_SIZE];
18  u32 num_entries;
19 } NvGpuChannel;
20 
21 Result nvGpuChannelCreate(NvGpuChannel* c, struct NvAddressSpace* as, NvChannelPriority prio);
22 void nvGpuChannelClose(NvGpuChannel* c);
23 
24 Result nvGpuChannelZcullBind(NvGpuChannel* c, iova_t iova);
25 Result nvGpuChannelAppendEntry(NvGpuChannel* c, iova_t start, size_t num_cmds, u32 flags, u32 flush_threshold);
26 Result nvGpuChannelKickoff(NvGpuChannel* c);
27 Result nvGpuChannelGetErrorNotification(NvGpuChannel* c, NvNotification* notif);
28 Result nvGpuChannelGetErrorInfo(NvGpuChannel* c, NvError* error);
29 
30 static inline u32 nvGpuChannelGetSyncpointId(NvGpuChannel* c)
31 {
32  return c->fence.id;
33 }
34 
35 static inline void nvGpuChannelGetFence(NvGpuChannel* c, NvFence* fence_out)
36 {
37  fence_out->id = c->fence.id;
38  fence_out->value = c->fence.value + c->fence_incr;
39 }
40 
41 static inline void nvGpuChannelIncrFence(NvGpuChannel* c)
42 {
43  ++c->fence_incr;
44 }
Kernel-mode event structure.
Definition: event.h:13
Definition: address_space.h:5
Definition: channel.h:5
Definition: ioctl.h:238
Definition: gpu_channel.h:11
Definition: ioctl.h:231
Definition: ioctl.h:125
Definition: ioctl.h:130
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
u32 Result
Function error code result type.
Definition: types.h:44
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21