libnx/nx/include/switch/nvidia/buffer.h
fincs e7ae7ea846 nv wrappers: Handle cacheability settings properly, more details:
- nvAddressSpaceMapBuffer now accepts a flags parameter instead of
  hardcoding NvMapBufferFlags_IsCacheable.
- NvBufferFlags was incorrect and was thus removed.
- nvBufferCreate/nvBufferCreateRw replaced with nvBufferCreate, with
  an extra 'is_cacheable' bool parameter. There's no such thing as a
  "read-only/read-write" buffer.
- nvBufferMakeCpuUncached/nvBufferMakeCpuCached were removed.
2018-09-14 18:09:58 +02:00

31 lines
762 B
C

#pragma once
#include "types.h"
#include "address_space.h"
typedef struct NvAddressSpace NvAddressSpace;
typedef struct NvBuffer {
u32 fd;
u32 size;
void* cpu_addr;
iova_t gpu_addr;
iova_t gpu_addr_texture;
NvAddressSpace* addr_space;
NvKind kind;
bool has_init;
bool is_cacheable;
} NvBuffer;
Result nvBufferInit(void);
u32 nvBufferGetNvmapFd(void);
void nvBufferExit(void);
Result nvBufferCreate(NvBuffer* m, size_t size, u32 align, bool is_cacheable, NvKind kind, NvAddressSpace* as);
void nvBufferFree(NvBuffer* m);
void* nvBufferGetCpuAddr(NvBuffer* m);
iova_t nvBufferGetGpuAddr(NvBuffer* m);
Result nvBufferMapAsTexture(NvBuffer* m, NvKind kind);
iova_t nvBufferGetGpuAddrTexture(NvBuffer* m);