[nvdrv] Unstub Allocate Object Context (#104)
Some checks are pending
eden-build / source (push) Waiting to run
eden-build / windows (msvc) (push) Waiting to run
eden-build / linux (push) Waiting to run
eden-build / android (push) Waiting to run

Adds proper checking to allocate object context, and saves each context separately, based on old stubs from Yuzu's, implemented now to resolve services and better handling of future issues.

Co-authored-by: Shinmegumi <shinmegumi@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/104
Co-authored-by: SDK-Chan <sdkchan@eden-emu.dev>
Co-committed-by: SDK-Chan <sdkchan@eden-emu.dev>
This commit is contained in:
SDK-Chan 2025-07-24 16:34:18 +02:00 committed by crueter
parent 67dfa81dc7
commit 46ddbea71c
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
2 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@ -192,11 +195,27 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params, DeviceFD fd) {
} }
NvResult nvhost_gpu::AllocateObjectContext(IoctlAllocObjCtx& params) { NvResult nvhost_gpu::AllocateObjectContext(IoctlAllocObjCtx& params) {
LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num, LOG_DEBUG(Service_NVDRV, "called, class_num={:X}, flags={:X}, obj_id={:X}", params.class_num,
params.flags); params.flags, params.obj_id);
params.obj_id = 0x0; if (!channel_state->initialized) {
return NvResult::Success; LOG_CRITICAL(Service_NVDRV, "No address space bound to allocate a object context!");
return NvResult::NotInitialized;
}
switch (static_cast<CtxClasses>(params.class_num)) {
case CtxClasses::Ctx2D:
case CtxClasses::Ctx3D:
case CtxClasses::CtxCompute:
case CtxClasses::CtxKepler:
case CtxClasses::CtxDMA:
case CtxClasses::CtxChannelGPFIFO:
ctxObj_params.push_back(params);
return NvResult::Success;
default:
LOG_ERROR(Service_NVDRV, "Invalid class number for object context: {:X}", params.class_num);
return NvResult::BadParameter;
}
} }
static boost::container::small_vector<Tegra::CommandHeader, 512> BuildWaitCommandList( static boost::container::small_vector<Tegra::CommandHeader, 512> BuildWaitCommandList(

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@ -54,7 +57,7 @@ public:
private: private:
friend class nvhost_as_gpu; friend class nvhost_as_gpu;
enum class CtxObjects : u32_le { enum class CtxClasses : u32_le {
Ctx2D = 0x902D, Ctx2D = 0x902D,
Ctx3D = 0xB197, Ctx3D = 0xB197,
CtxCompute = 0xB1C0, CtxCompute = 0xB1C0,
@ -183,6 +186,7 @@ private:
s32_le nvmap_fd{}; s32_le nvmap_fd{};
u64_le user_data{}; u64_le user_data{};
IoctlZCullBind zcull_params{}; IoctlZCullBind zcull_params{};
std::vector<IoctlAllocObjCtx> ctxObj_params{};
u32_le channel_priority{}; u32_le channel_priority{};
u32_le channel_timeslice{}; u32_le channel_timeslice{};