libnx/nx/include/switch/nvidia/gpu_channel.h
fincs 5fe01c065a Major refactor and redesign of nvidia wrapper objects, see details:
- NvBuffer replaced with NvMap, which only manages the creation of
  raw nvmap objects. Users must map these objects manually to
  address spaces.
- nvAddressSpaceBindToChannel removed.
- nvChannelSetNvmapFd is now automatic and has been removed.
- Nv3DContext, NvCmdList, NvErrorNotifier, NvGpfifo, NvGpu and
  NvZcullContext have all been removed.
- Introduced NvGpuChannel, which provides all functionality that was
  part of said removed objects.
- Other miscellaneous changes and fixes.
2018-12-19 19:33:31 +01:00

44 lines
1.1 KiB
C

#pragma once
#include "../kernel/event.h"
#include "channel.h"
#include "fence.h"
#define GPFIFO_QUEUE_SIZE 0x800
#define GPFIFO_ENTRY_NOT_MAIN BIT(9)
#define GPFIFO_ENTRY_NO_PREFETCH BIT(31)
typedef struct NvGpuChannel
{
NvChannel base;
Event error_event;
u64 object_id;
NvFence fence;
u32 fence_incr;
nvioctl_gpfifo_entry entries[GPFIFO_QUEUE_SIZE];
u32 num_entries;
} NvGpuChannel;
Result nvGpuChannelCreate(NvGpuChannel* c, struct NvAddressSpace* as);
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);
static inline u32 nvGpuChannelGetSyncpointId(NvGpuChannel* c)
{
return c->fence.id;
}
static inline void nvGpuChannelGetFence(NvGpuChannel* c, NvFence* fence_out)
{
fence_out->id = c->fence.id;
fence_out->value = c->fence.value + c->fence_incr;
}
static inline void nvGpuChannelIncrFence(NvGpuChannel* c)
{
++c->fence_incr;
}