Started sketching on cmd lists

This commit is contained in:
plutooo 2018-03-11 21:49:22 +01:00 committed by fincs
parent 50718ddccb
commit 9c234d4d40
7 changed files with 51 additions and 4 deletions

View File

@ -77,6 +77,8 @@ extern "C" {
#include "switch/nvidia/address_space.h"
#include "switch/nvidia/channel.h"
#include "switch/nvidia/info.h"
#include "switch/nvidia/fence.h"
#include "switch/nvidia/gpu/cmd_list.h"
#include "switch/nvidia/gpu/gpfifo.h"
#include "switch/nvidia/gpu/zcull_ctx.h"
#include "switch/nvidia/gpu/3d_ctx.h"

View File

@ -0,0 +1,9 @@
#pragma once
typedef struct {
nvioctl_fence fence;
} NvFence;
static inline void nvfenceCreate(NvFence* f, nvioctl_fence* fence) {
f->fence = *fence;
}

View File

@ -0,0 +1,14 @@
#pragma once
typedef struct {
NvBuffer buffer;
} NvCmdList;
static inline iova_t nvcmdsGetGpuAddr() {
return 0; // TODO
}
static inline u64 nvcmdsGetListSize() {
return 0; // TODO
}

View File

@ -6,4 +6,9 @@ typedef struct {
} NvGpfifo;
Result nvfifoCreate(NvGpfifo* f, NvChannel* parent);
void nvfifoClose();
void nvfifoClose(NvGpfifo* f);
#define NV_MAKE_GPFIFO_ENTRY(iova, size) \
((iova) | (((u64)(size)) << 42))
Result nvfifoSubmit(NvGpfifo* f, NvCmdList* cmd_list, NvFence* fence_out);

View File

@ -100,8 +100,7 @@ typedef struct {
} nvioctl_fence;
typedef struct {
u32 entry0;
u32 entry1;
u64 desc;
} nvioctl_gpfifo_entry;
// Used with nvioctlChannel_AllocObjCtx().

0
nx/source/nvidia/fence.c Normal file
View File

View File

@ -10,6 +10,24 @@ Result nvfifoCreate(NvGpfifo* f, NvChannel* parent)
parent->fd, DEFAULT_FIFO_ENTRIES, 1, 0, 0, 0, 0, &f->fifo_fence);
}
void nvfifoClose() {
void nvfifoClose(NvGpfifo* f) {
/**/
}
Result nvfifoSubmit(NvGpfifo* f, NvCmdList* cmd_list, NvFence* fence_out)
{
Result rc;
nvioctl_gpfifo_entry ent;
nvioctl_fence fence;
ent.desc = nvcmdsGetGpuAddr(cmd_list) | (nvcmdsGetListSize(cmd_list) << 42);
rc = nvioctlChannel_SubmitGpfifo(
f->parent->fd, &ent, 1, 0/*flags*/, &fence);
if (R_SUCCEEDED(rc)) {
nvfenceCreate(fence_out, &fence);
}
return rc;
}