libnx  v4.2.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 }
Event
Kernel-mode event structure.
Definition: event.h:13
NvChannel
Definition: channel.h:5
nvioctl_fence
Definition: ioctl.h:120
NvError
Definition: ioctl.h:228
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
u64
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
Result
u32 Result
Function error code result type.
Definition: types.h:44
NvAddressSpace
Definition: address_space.h:5
nvioctl_gpfifo_entry
Definition: ioctl.h:125
NvGpuChannel
Definition: gpu_channel.h:10
NvNotification
Definition: ioctl.h:221