From 7d257ce7bdea11168c7ccf72f69217482e502e85 Mon Sep 17 00:00:00 2001 From: Chloe Marcec Date: Mon, 3 May 2021 14:39:03 +1000 Subject: [PATCH 1/2] nvdrv: /dev/nvhost-prof-gpu for production While we're at it, we can fix the is_initialized error code. This fixes the crashes on Shante --- src/core/hle/service/nvdrv/interface.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 2e1150867..6d1fef382 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -22,19 +22,30 @@ void NVDRV::SignalGPUInterruptSyncpt(const u32 syncpoint_id, const u32 value) { void NVDRV::Open(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NVDRV, "called"); + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); if (!is_initialized) { - ServiceError(ctx, NvResult::NotInitialized); + rb.Push(0); + rb.PushEnum(NvResult::NotInitialized); + LOG_ERROR(Service_NVDRV, "NvServices is not initalized!"); return; } const auto& buffer = ctx.ReadBuffer(); const std::string device_name(buffer.begin(), buffer.end()); + + if (device_name == "/dev/nvhost-prof-gpu") { + rb.Push(0); + rb.PushEnum(NvResult::NotSupported); + + LOG_WARNING(Service_NVDRV, "/dev/nvhost-prof-gpu cannot be openned on production"); + return; + } + DeviceFD fd = nvdrv->Open(device_name); - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); rb.Push(fd); rb.PushEnum(fd != INVALID_NVDRV_FD ? NvResult::Success : NvResult::FileOperationFailed); } From 0b7a03bd657fa001e1f1ee8887900886b46db013 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 5 May 2021 16:16:02 -0700 Subject: [PATCH 2/2] Update src/core/hle/service/nvdrv/interface.cpp Co-authored-by: Ameer J <52414509+ameerj@users.noreply.github.com> --- src/core/hle/service/nvdrv/interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 6d1fef382..eff9c3cc9 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -40,7 +40,7 @@ void NVDRV::Open(Kernel::HLERequestContext& ctx) { rb.Push(0); rb.PushEnum(NvResult::NotSupported); - LOG_WARNING(Service_NVDRV, "/dev/nvhost-prof-gpu cannot be openned on production"); + LOG_WARNING(Service_NVDRV, "/dev/nvhost-prof-gpu cannot be opened in production"); return; }