Allocate GPFIFO Ex2, Allocate Obj Ctx, Submit GPFIFO
This commit is contained in:
@@ -28,7 +28,24 @@ u32 nvhost_gpu::ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>
|
|||||||
return SetErrorNotifier(input, output);
|
return SetErrorNotifier(input, output);
|
||||||
case IocChannelSetPriorityCommand:
|
case IocChannelSetPriorityCommand:
|
||||||
return SetChannelPriority(input, output);
|
return SetChannelPriority(input, output);
|
||||||
|
case IocAllocGPFIFOEx2Command:
|
||||||
|
return AllocGPFIFOEx2(input, output);
|
||||||
|
case IocAllocObjCtxCommand:
|
||||||
|
return AllocateObjectContext(input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Variable size ioctls
|
||||||
|
u8 group = (command >> 8) & 0xff;
|
||||||
|
u8 index = command & 0xff;
|
||||||
|
|
||||||
|
if (group == 'H') {
|
||||||
|
if (index == 0x8) {
|
||||||
|
return SubmitGPFIFO(input, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIMPLEMENTED();
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
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) {
|
||||||
@@ -81,6 +98,53 @@ u32 nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
|
alloc_gpfifo_ex2 params;
|
||||||
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
LOG_WARNING(Service_NVDRV,
|
||||||
|
"(STUBBED) called, num_entries=%x, flags=%x, unk0=%x, unk1=%x, unk2=%x, unk3=%x",
|
||||||
|
params.__num_entries, params.__flags, params.__unk0, params.__unk1, params.__unk2,
|
||||||
|
params.__unk3);
|
||||||
|
params.__fence_out.id = 0;
|
||||||
|
params.__fence_out.value = 0;
|
||||||
|
std::memcpy(output.data(), ¶ms, output.size());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
|
alloc_obj_ctx params;
|
||||||
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num=%x, flags=%x", params.class_num,
|
||||||
|
params.flags);
|
||||||
|
params.obj_id = 0x0;
|
||||||
|
std::memcpy(output.data(), ¶ms, output.size());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
|
submit_gpfifo params;
|
||||||
|
if (input.size() < 24)
|
||||||
|
UNIMPLEMENTED();
|
||||||
|
std::memcpy(¶ms, input.data(), 24);
|
||||||
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo=%lx, num_entries=%x, flags=%x",
|
||||||
|
params.gpfifo, params.num_entries, params.flags);
|
||||||
|
|
||||||
|
gpfifo_entry* entries = new gpfifo_entry[params.num_entries];
|
||||||
|
std::memcpy(entries, &input.data()[24], params.num_entries * 8);
|
||||||
|
for (int i = 0; i < params.num_entries; i++) {
|
||||||
|
u32 unk1 = (entries[i].entry1 >> 8) & 0x3;
|
||||||
|
u32 sz = (entries[i].entry1 >> 10) & 0x1fffff;
|
||||||
|
u32 unk2 = entries[i].entry1 >> 31;
|
||||||
|
u64 va_addr = entries[i].entry0 | ((entries[i].entry1 & 0xff) << 32);
|
||||||
|
// TODO(ogniK): Process these
|
||||||
|
}
|
||||||
|
params.fence_out.id = 0;
|
||||||
|
params.fence_out.value = 0;
|
||||||
|
std::memcpy(output.data(), ¶ms, output.size());
|
||||||
|
delete[] entries;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Devices
|
} // namespace Devices
|
||||||
} // namespace Nvidia
|
} // namespace Nvidia
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
|||||||
@@ -28,6 +28,17 @@ private:
|
|||||||
IocZCullBind = 0xc010480b,
|
IocZCullBind = 0xc010480b,
|
||||||
IocSetErrorNotifierCommand = 0xC018480C,
|
IocSetErrorNotifierCommand = 0xC018480C,
|
||||||
IocChannelSetPriorityCommand = 0x4004480D,
|
IocChannelSetPriorityCommand = 0x4004480D,
|
||||||
|
IocAllocGPFIFOEx2Command = 0xC020481A,
|
||||||
|
IocAllocObjCtxCommand = 0xC0104809,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CtxObjects {
|
||||||
|
_2D = 0x902D,
|
||||||
|
_3D = 0xB197,
|
||||||
|
_Compute = 0xB1C0,
|
||||||
|
_Kepler = 0xA140,
|
||||||
|
_DMA = 0xB0B5,
|
||||||
|
_Channel_GPFIFO = 0xB06F,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct set_nvmap_fd {
|
struct set_nvmap_fd {
|
||||||
@@ -51,6 +62,41 @@ private:
|
|||||||
u32_le padding;
|
u32_le padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct fence {
|
||||||
|
u32_le id;
|
||||||
|
u32_le value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct alloc_gpfifo_ex2 {
|
||||||
|
u32_le __num_entries; // in
|
||||||
|
u32_le __flags; // in
|
||||||
|
u32_le __unk0; // in (1 works)
|
||||||
|
struct fence __fence_out; // out
|
||||||
|
u32_le __unk1; // in
|
||||||
|
u32_le __unk2; // in
|
||||||
|
u32_le __unk3; // in
|
||||||
|
};
|
||||||
|
|
||||||
|
struct alloc_obj_ctx {
|
||||||
|
u32_le class_num; // 0x902D=2d, 0xB197=3d, 0xB1C0=compute, 0xA140=kepler, 0xB0B5=DMA,
|
||||||
|
// 0xB06F=channel_gpfifo
|
||||||
|
u32_le flags;
|
||||||
|
u64_le obj_id; // (ignored) used for FREE_OBJ_CTX ioctl, which is not supported
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gpfifo_entry {
|
||||||
|
u32_le entry0; // gpu_va_lo
|
||||||
|
u32_le entry1; // gpu_va_hi | (unk_0x02 << 0x08) | (size << 0x0A) | (unk_0x01 << 0x1F)
|
||||||
|
};
|
||||||
|
|
||||||
|
struct submit_gpfifo {
|
||||||
|
u64_le gpfifo; // (ignored) pointer to gpfifo fence structs
|
||||||
|
u32_le num_entries; // number of fence objects being submitted
|
||||||
|
u32_le flags;
|
||||||
|
struct fence fence_out; // returned new fence object for others to wait on
|
||||||
|
struct gpfifo_entry entries[]; // depends on num_entries
|
||||||
|
};
|
||||||
|
|
||||||
u32_le nvmap_fd{};
|
u32_le nvmap_fd{};
|
||||||
u64_le user_data{};
|
u64_le user_data{};
|
||||||
zcull_bind zcull_params{};
|
zcull_bind zcull_params{};
|
||||||
@@ -62,6 +108,9 @@ private:
|
|||||||
u32 ZCullBind(const std::vector<u8>& input, std::vector<u8>& output);
|
u32 ZCullBind(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
u32 SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output);
|
u32 SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
u32 SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output);
|
u32 SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
u32 AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
u32 AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Devices
|
} // namespace Devices
|
||||||
|
|||||||
Reference in New Issue
Block a user