Browse Source

[nvdrv] Unstub Allocate Object Context (#104)

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>
pull/87/head
SDK-Chan 5 months ago
committed by crueter
parent
commit
46ddbea71c
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 27
      src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
  2. 6
      src/core/hle/service/nvdrv/devices/nvhost_gpu.h

27
src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp

@ -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,
params.flags);
params.obj_id = 0x0;
LOG_DEBUG(Service_NVDRV, "called, class_num={:X}, flags={:X}, obj_id={:X}", params.class_num,
params.flags, params.obj_id);
if (!channel_state->initialized) {
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; 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(

6
src/core/hle/service/nvdrv/devices/nvhost_gpu.h

@ -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{};

Loading…
Cancel
Save