mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Stubbed gpfifo, zcull_ctx
This commit is contained in:
parent
4bd1d3313c
commit
1660f99afe
@ -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"
|
||||
|
9
nx/include/switch/nvidia/gpu/gpfifo.h
Normal file
9
nx/include/switch/nvidia/gpu/gpfifo.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct {
|
||||
NvChannel* parent;
|
||||
nvioctl_fence fifo_fence;
|
||||
} NvGpfifo;
|
||||
|
||||
Result nvfifoCreate(NvGpfifo* f, NvChannel* parent);
|
||||
void nvfifoClose();
|
@ -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);
|
||||
|
10
nx/include/switch/nvidia/gpu/zcull_ctx.h
Normal file
10
nx/include/switch/nvidia/gpu/zcull_ctx.h
Normal 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);
|
@ -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;
|
||||
}
|
||||
|
15
nx/source/nvidia/gpu/gpfifo.c
Normal file
15
nx/source/nvidia/gpu/gpfifo.c
Normal 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() {
|
||||
/**/
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
11
nx/source/nvidia/gpu/zcull_ctx.c
Normal file
11
nx/source/nvidia/gpu/zcull_ctx.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <switch.h>
|
||||
|
||||
Result nvzcullCreate(NvZcullContext* z, NvGpu* parent)
|
||||
{
|
||||
z->parent = parent;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nvzcullClose(NvZcullContext* z) {
|
||||
/**/
|
||||
}
|
Loading…
Reference in New Issue
Block a user