Minor fixes, adding custom flag to buffer allocation

This commit is contained in:
plutooo 2018-03-10 16:43:01 +01:00 committed by fincs
parent 1a22b484f8
commit 577a76dc06
5 changed files with 7 additions and 6 deletions

View File

@ -20,7 +20,7 @@ Result nvasReserveAlign(NvAddressSpace* a, NvPageSize align, u32 pages, NvPageSi
Result nvasReserveAtFixedAddr(NvAddressSpace* a, iova_t addr, u32 pages, NvPageSize page_sz);
Result nvasReserveFull(NvAddressSpace* a);
Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, iova_t* iova_out);
Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, NvBufferKind kind, iova_t* iova_out);
struct NvChannel;
Result nvasBindToChannel(NvAddressSpace* a, struct NvChannel* channel);

View File

@ -3,7 +3,8 @@
#include "../types.h"
typedef enum {
NvBufferFlags_Writable=1
NvBufferFlags_Writable=1,
NvBufferFlags_Nintendo=0x20000,
} NvBufferFlags;
typedef enum {

View File

@ -43,8 +43,8 @@ Result nvasReserveFull(NvAddressSpace* a) {
return nvasReserveAlign(a, NvPageSize_64K, 0x10000, NvPageSize_64K, NULL);
}
Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, iova_t* iova_out) {
return nvioctlNvhostAsGpu_MapBufferEx(a->fd, 0, buffer->kind, buffer->fd, 0, 0, buffer->size, 0, iova_out);
Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, NvBufferKind kind, iova_t* iova_out) {
return nvioctlNvhostAsGpu_MapBufferEx(a->fd, 0, kind, buffer->fd, 0, 0, buffer->size, 0, iova_out);
}
Result nvasBindToChannel(NvAddressSpace* a, NvChannel* channel)

View File

@ -54,7 +54,7 @@ static Result _nvbufCreate(NvBuffer* m, size_t size, u32 flags, u32 align, NvBuf
m->fd = -1;
if (R_SUCCEEDED(rc))
rc = nvioctlNvmap_Alloc(g_nvmap_fd, m->fd, 0, flags, align, kind, m->ptr);
rc = nvioctlNvmap_Alloc(g_nvmap_fd, m->fd, 0, flags | NvBufferFlags_Nintendo, align, kind, m->ptr);
if (R_FAILED(rc))
nvbufFree(m);

View File

@ -10,7 +10,7 @@ Result nvzcullCreate(NvZcullContext* z, NvGpu* parent)
iova_t iova_out;
if (R_SUCCEEDED(rc))
rc = nvasMapBuffer(&parent->addr_space, &z->ctx_buf, &iova_out);
rc = nvasMapBuffer(&parent->addr_space, &z->ctx_buf, NvBufferKind_Pitch, &iova_out);
if (R_SUCCEEDED(rc))
rc = nvioctlChannel_ZCullBind(parent->gpu_channel.fd, iova_out, NvZcullConfig_SeparateBuffer);