gpu takes reference on singletons

This commit is contained in:
plutooo 2018-03-10 15:36:46 +01:00 committed by fincs
parent f62f6e8b54
commit 87d29bdeb3
2 changed files with 11 additions and 0 deletions

View File

@ -76,6 +76,8 @@ enum {
LibnxError_DomainMessageTooManyObjectIds, LibnxError_DomainMessageTooManyObjectIds,
LibnxError_AppletFailedToInitialize, LibnxError_AppletFailedToInitialize,
LibnxError_ApmFailedToInitialize, LibnxError_ApmFailedToInitialize,
LibnxError_NvinfoFailedToInitialize,
LibnxError_NvbufFailedToInitialize,
}; };
/// libnx nvidia error codes /// libnx nvidia error codes

View File

@ -4,6 +4,12 @@ Result nvgpuCreate(NvGpu* g)
{ {
Result rc; Result rc;
if (R_FAILED(nvinfoInit()))
return MAKERESULT(Module_Libnx, LibnxError_NvinfoFailedToInitialize);
if (R_FAILED(nvbufInit()))
return MAKERESULT(Module_Libnx, LibnxError_NvbufFailedToInitialize);
rc = nvchannelCreate(&g->gpu_channel, "/dev/nvhost-gpu"); rc = nvchannelCreate(&g->gpu_channel, "/dev/nvhost-gpu");
if (R_SUCCEEDED(rc)) if (R_SUCCEEDED(rc))
@ -29,6 +35,9 @@ Result nvgpuCreate(NvGpu* g)
void nvgpuClose(NvGpu* g) void nvgpuClose(NvGpu* g)
{ {
nvbufExit();
nvinfoExit();
nvfifoClose(&g->gpfifo); nvfifoClose(&g->gpfifo);
nvasClose(&g->addr_space); nvasClose(&g->addr_space);
nvchannelClose(&g->gpu_channel); nvchannelClose(&g->gpu_channel);