|
|
|
@ -12,8 +12,8 @@
|
|
|
|
namespace Service::Nvidia::Devices {
|
|
|
|
namespace Service::Nvidia::Devices {
|
|
|
|
|
|
|
|
|
|
|
|
u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%zx, output_size=0x%zx",
|
|
|
|
NGLOG_DEBUG(Service_NVDRV, "called, command={:#010X}, input_size={:#X}, output_size={:#X}",
|
|
|
|
command.raw, input.size(), output.size());
|
|
|
|
command.raw, input.size(), output.size());
|
|
|
|
|
|
|
|
|
|
|
|
switch (static_cast<IoctlCommand>(command.raw)) {
|
|
|
|
switch (static_cast<IoctlCommand>(command.raw)) {
|
|
|
|
case IoctlCommand::IocSetNVMAPfdCommand:
|
|
|
|
case IoctlCommand::IocSetNVMAPfdCommand:
|
|
|
|
@ -47,14 +47,14 @@ u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u
|
|
|
|
u32 nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
IoctlSetNvmapFD params{};
|
|
|
|
IoctlSetNvmapFD params{};
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
LOG_DEBUG(Service_NVDRV, "called, fd=%x", params.nvmap_fd);
|
|
|
|
NGLOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
|
|
|
nvmap_fd = params.nvmap_fd;
|
|
|
|
nvmap_fd = params.nvmap_fd;
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
LOG_DEBUG(Service_NVDRV, "called");
|
|
|
|
NGLOG_DEBUG(Service_NVDRV, "called");
|
|
|
|
IoctlClientData params{};
|
|
|
|
IoctlClientData params{};
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
user_data = params.data;
|
|
|
|
user_data = params.data;
|
|
|
|
@ -63,7 +63,7 @@ u32 nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
LOG_DEBUG(Service_NVDRV, "called");
|
|
|
|
NGLOG_DEBUG(Service_NVDRV, "called");
|
|
|
|
IoctlClientData params{};
|
|
|
|
IoctlClientData params{};
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
params.data = user_data;
|
|
|
|
params.data = user_data;
|
|
|
|
@ -73,8 +73,8 @@ u32 nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& out
|
|
|
|
|
|
|
|
|
|
|
|
u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
std::memcpy(&zcull_params, input.data(), input.size());
|
|
|
|
std::memcpy(&zcull_params, input.data(), input.size());
|
|
|
|
LOG_DEBUG(Service_NVDRV, "called, gpu_va=%" PRIx64 ", mode=%x", zcull_params.gpu_va,
|
|
|
|
NGLOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va,
|
|
|
|
zcull_params.mode);
|
|
|
|
zcull_params.mode);
|
|
|
|
std::memcpy(output.data(), &zcull_params, output.size());
|
|
|
|
std::memcpy(output.data(), &zcull_params, output.size());
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -82,15 +82,15 @@ u32 nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output)
|
|
|
|
u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
IoctlSetErrorNotifier params{};
|
|
|
|
IoctlSetErrorNotifier params{};
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset=%" PRIx64 ", size=%" PRIx64 ", mem=%x",
|
|
|
|
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}",
|
|
|
|
params.offset, params.size, params.mem);
|
|
|
|
params.offset, params.size, params.mem);
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
std::memcpy(&channel_priority, input.data(), input.size());
|
|
|
|
std::memcpy(&channel_priority, input.data(), input.size());
|
|
|
|
LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority=%x", channel_priority);
|
|
|
|
NGLOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority);
|
|
|
|
std::memcpy(output.data(), &channel_priority, output.size());
|
|
|
|
std::memcpy(output.data(), &channel_priority, output.size());
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -98,10 +98,11 @@ u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>
|
|
|
|
u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
IoctlAllocGpfifoEx2 params{};
|
|
|
|
IoctlAllocGpfifoEx2 params{};
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
LOG_WARNING(Service_NVDRV,
|
|
|
|
NGLOG_WARNING(Service_NVDRV,
|
|
|
|
"(STUBBED) called, num_entries=%x, flags=%x, unk0=%x, unk1=%x, unk2=%x, unk3=%x",
|
|
|
|
"(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, "
|
|
|
|
params.num_entries, params.flags, params.unk0, params.unk1, params.unk2,
|
|
|
|
"unk1={:X}, unk2={:X}, unk3={:X}",
|
|
|
|
params.unk3);
|
|
|
|
params.num_entries, params.flags, params.unk0, params.unk1, params.unk2,
|
|
|
|
|
|
|
|
params.unk3);
|
|
|
|
params.fence_out.id = 0;
|
|
|
|
params.fence_out.id = 0;
|
|
|
|
params.fence_out.value = 0;
|
|
|
|
params.fence_out.value = 0;
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
@ -111,8 +112,8 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& ou
|
|
|
|
u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) {
|
|
|
|
IoctlAllocObjCtx params{};
|
|
|
|
IoctlAllocObjCtx params{};
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
std::memcpy(¶ms, input.data(), input.size());
|
|
|
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num=%x, flags=%x", params.class_num,
|
|
|
|
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num,
|
|
|
|
params.flags);
|
|
|
|
params.flags);
|
|
|
|
params.obj_id = 0x0;
|
|
|
|
params.obj_id = 0x0;
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
std::memcpy(output.data(), ¶ms, output.size());
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
@ -123,8 +124,8 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
|
|
|
|
UNIMPLEMENTED();
|
|
|
|
UNIMPLEMENTED();
|
|
|
|
IoctlSubmitGpfifo params{};
|
|
|
|
IoctlSubmitGpfifo params{};
|
|
|
|
std::memcpy(¶ms, input.data(), sizeof(IoctlSubmitGpfifo));
|
|
|
|
std::memcpy(¶ms, input.data(), sizeof(IoctlSubmitGpfifo));
|
|
|
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo=%" PRIx64 ", num_entries=%x, flags=%x",
|
|
|
|
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}",
|
|
|
|
params.gpfifo, params.num_entries, params.flags);
|
|
|
|
params.gpfifo, params.num_entries, params.flags);
|
|
|
|
|
|
|
|
|
|
|
|
auto entries = std::vector<IoctlGpfifoEntry>();
|
|
|
|
auto entries = std::vector<IoctlGpfifoEntry>();
|
|
|
|
entries.resize(params.num_entries);
|
|
|
|
entries.resize(params.num_entries);
|
|
|
|
|