mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-23 21:32:39 +02:00
Minor fixes, adding custom flag to buffer allocation
This commit is contained in:
parent
1a22b484f8
commit
577a76dc06
@ -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 nvasReserveAtFixedAddr(NvAddressSpace* a, iova_t addr, u32 pages, NvPageSize page_sz);
|
||||||
Result nvasReserveFull(NvAddressSpace* a);
|
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;
|
struct NvChannel;
|
||||||
Result nvasBindToChannel(NvAddressSpace* a, struct NvChannel* channel);
|
Result nvasBindToChannel(NvAddressSpace* a, struct NvChannel* channel);
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NvBufferFlags_Writable=1
|
NvBufferFlags_Writable=1,
|
||||||
|
NvBufferFlags_Nintendo=0x20000,
|
||||||
} NvBufferFlags;
|
} NvBufferFlags;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -43,8 +43,8 @@ Result nvasReserveFull(NvAddressSpace* a) {
|
|||||||
return nvasReserveAlign(a, NvPageSize_64K, 0x10000, NvPageSize_64K, NULL);
|
return nvasReserveAlign(a, NvPageSize_64K, 0x10000, NvPageSize_64K, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, iova_t* iova_out) {
|
Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, NvBufferKind kind, iova_t* iova_out) {
|
||||||
return nvioctlNvhostAsGpu_MapBufferEx(a->fd, 0, buffer->kind, buffer->fd, 0, 0, buffer->size, 0, iova_out);
|
return nvioctlNvhostAsGpu_MapBufferEx(a->fd, 0, kind, buffer->fd, 0, 0, buffer->size, 0, iova_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result nvasBindToChannel(NvAddressSpace* a, NvChannel* channel)
|
Result nvasBindToChannel(NvAddressSpace* a, NvChannel* channel)
|
||||||
|
@ -54,7 +54,7 @@ static Result _nvbufCreate(NvBuffer* m, size_t size, u32 flags, u32 align, NvBuf
|
|||||||
m->fd = -1;
|
m->fd = -1;
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc))
|
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))
|
if (R_FAILED(rc))
|
||||||
nvbufFree(m);
|
nvbufFree(m);
|
||||||
|
@ -10,7 +10,7 @@ Result nvzcullCreate(NvZcullContext* z, NvGpu* parent)
|
|||||||
iova_t iova_out;
|
iova_t iova_out;
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc))
|
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))
|
if (R_SUCCEEDED(rc))
|
||||||
rc = nvioctlChannel_ZCullBind(parent->gpu_channel.fd, iova_out, NvZcullConfig_SeparateBuffer);
|
rc = nvioctlChannel_ZCullBind(parent->gpu_channel.fd, iova_out, NvZcullConfig_SeparateBuffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user