Stubbed gpfifo, zcull_ctx

This commit is contained in:
plutooo 2018-02-26 22:44:02 +01:00 committed by fincs
parent 4bd1d3313c
commit 1660f99afe
8 changed files with 67 additions and 3 deletions

View File

@ -76,6 +76,8 @@ extern "C" {
#include "switch/nvidia/address_space.h"
#include "switch/nvidia/channel.h"
#include "switch/nvidia/info.h"
#include "switch/nvidia/gpu/gpfifo.h"
#include "switch/nvidia/gpu/zcull_ctx.h"
#include "switch/nvidia/gpu/gpu.h"
#include "switch/audio/driver.h"

View File

@ -0,0 +1,9 @@
#pragma once
typedef struct {
NvChannel* parent;
nvioctl_fence fifo_fence;
} NvGpfifo;
Result nvfifoCreate(NvGpfifo* f, NvChannel* parent);
void nvfifoClose();

View File

@ -1,8 +1,10 @@
#pragma once
typedef struct {
typedef struct NvGpu {
NvAddressSpace addr_space;
NvChannel gpu_channel;
NvGpfifo gpfifo;
NvZcullContext zcull_ctx;
} NvGpu;
Result nvgpuCreate(NvGpu* g);

View File

@ -0,0 +1,10 @@
#pragma once
typedef struct NvGpu NvGpu;
typedef struct {
NvGpu* parent;
} NvZcullContext;
Result nvzcullCreate(NvZcullContext* z, NvGpu* parent);
void nvzcullClose(NvZcullContext* z);

View File

@ -47,6 +47,14 @@ Result nvasMapBuffer(NvAddressSpace* a, NvBuffer* buffer, NvBufferKind kind, iov
return nvioctlNvhostAsGpu_MapBufferEx(a->fd, 0, kind, buffer->fd, 0, 0, buffer->size, 0, iova_out);
}
Result nvasBindToChannel(NvAddressSpace* a, NvChannel* channel) {
return nvioctlNvhostAsGpu_BindChannel(a->fd, channel->fd);
Result nvasBindToChannel(NvAddressSpace* a, NvChannel* channel)
{
Result rc;
rc = nvioctlNvhostAsGpu_BindChannel(a->fd, channel->fd);
if (R_SUCCEEDED(rc))
rc = nvioctlChannel_SetNvmapFd(channel->fd, a->fd);
return rc;
}

View File

@ -0,0 +1,15 @@
#include <switch.h>
#define DEFAULT_FIFO_ENTRIES 0x800
Result nvfifoCreate(NvGpfifo* f, NvChannel* parent)
{
f->parent = parent;
return nvioctlChannel_AllocGpfifoEx2(
parent->fd, DEFAULT_FIFO_ENTRIES, 1, 0, 0, 0, 0, &f->fifo_fence);
}
void nvfifoClose() {
/**/
}

View File

@ -15,6 +15,12 @@ Result nvgpuCreate(NvGpu* g)
if (R_SUCCEEDED(rc))
rc = nvasBindToChannel(&g->addr_space, &g->gpu_channel);
if (R_SUCCEEDED(rc))
rc = nvfifoCreate(&g->gpfifo, &g->gpu_channel);
if (R_SUCCEEDED(rc))
rc = nvzcullCreate(&g->zcull_ctx, g);
if (R_FAILED(rc))
nvgpuClose(g);
@ -23,6 +29,7 @@ Result nvgpuCreate(NvGpu* g)
void nvgpuClose(NvGpu* g)
{
nvfifoClose(&g->gpfifo);
nvasClose(&g->addr_space);
nvchannelClose(&g->gpu_channel);
}

View File

@ -0,0 +1,11 @@
#include <switch.h>
Result nvzcullCreate(NvZcullContext* z, NvGpu* parent)
{
z->parent = parent;
return 0;
}
void nvzcullClose(NvZcullContext* z) {
/**/
}