gpu takes reference on singletons

This commit is contained in:
plutoo 2018-03-10 15:36:46 +01:00
parent 7045f37cc9
commit cb6cfca6c7
2 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,8 @@ enum {
LibnxError_TooManyDevOpTabs, LibnxError_TooManyDevOpTabs,
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);