nvhost_nvdec: stubbed ChannelMapCmdBuffer

This commit is contained in:
Nguyen Dac Nam
2020-02-19 00:58:20 +07:00
committed by GitHub
parent 633474b561
commit a1342a0042

View File

@@ -10,6 +10,9 @@
namespace Service::Nvidia::Devices {
constexpr u32 NVHOST_IOCTL_MAGIC(0x0);
constexpr u32 NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER(0x9);
nvhost_nvdec::nvhost_nvdec(Core::System& system) : nvdevice(system) {}
nvhost_nvdec::~nvhost_nvdec() = default;
@@ -23,6 +26,12 @@ u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, const std::
case IoctlCommand::IocSetNVMAPfdCommand:
return SetNVMAPfd(input, output);
}
if (command.group == NVHOST_IOCTL_MAGIC) {
if (command.cmd == NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER) {
return ChannelMapCmdBuffer(input, output);
}
}
UNIMPLEMENTED_MSG("Unimplemented ioctl");
return 0;
@@ -37,4 +46,23 @@ u32 nvhost_nvdec::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& outp
return 0;
}
u32 nvhost_nvdec::ChannelMapCmdBuffer(const std::vector<u8>& input, std::vector<u8>& output) {
IoctlMapCmdBuffer params{};
std::memcpy(&params, input.data(), 12);
std::vector<IoctlHandleMapBuffer> handles(params.num_handles);
std::memcpy(handles.data(), input.data() + 12,
sizeof(IoctlHandleMapBuffer) * params.num_handles);
LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_handles: {}, is_compressed: {}", params.num_handles, params.is_compressed);
//TODO(namkazt): Uses nvmap_pin internally to pin a given number of nvmap handles to an appropriate device
// physical address.
std::memcpy(output.data(), &params, 12);
std::memcpy(output.data() + 12, handles.data(),
sizeof(IoctlHandleMapBuffer) * params.num_handles);
return 0;
}
} // namespace Service::Nvidia::Devices