mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 17:54:13 +00:00
m1n1.fw.agx: Add missing compute stuff
Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
parent
89e3fcb2ab
commit
8fba6118ce
2 changed files with 92 additions and 48 deletions
|
@ -136,15 +136,28 @@ class WorkCommandCP(ConstructClass):
|
|||
"context_id" / Hex(Int32ul),
|
||||
"event_control_addr" / Hex(Int64ul),
|
||||
"event_control" / ROPointer(this.event_control_addr, EventControl),
|
||||
|
||||
# This struct embeeds some data that the Control List has pointers back to, but doesn't
|
||||
# seem to be actually part of this struct
|
||||
Padding(0x1e8 - 0x14),
|
||||
|
||||
# offset 000001e8
|
||||
"unk_buf" / HexDump(Bytes(0x54)),
|
||||
"compute_info" / ComputeInfo,
|
||||
"unk_b8" / HexDump(Bytes(0x1e8 - 0xcc)),
|
||||
"microsequence_ptr" / Hex(Int64ul),
|
||||
"microsequence_size" / Hex(Int32ul),
|
||||
"microsequence" / ROPointer(this.microsequence_ptr, MicroSequence),
|
||||
"compute_info2" / ComputeInfo2,
|
||||
"encoder_params" / EncoderParams,
|
||||
"job_meta" / JobMeta,
|
||||
"ts1" / TimeStamp,
|
||||
"ts2" / TimeStamp,
|
||||
"ts3" / TimeStamp,
|
||||
"unk_2c0" / Int32ul,
|
||||
"unk_2c4" / Int32ul,
|
||||
"unk_2c8" / Int32ul,
|
||||
"unk_2cc" / Int32ul,
|
||||
"client_sequence" / Int8ul,
|
||||
"unk_2d1" / Int8ul,
|
||||
"unk_2d2" / Int16ul,
|
||||
"unk_2d4" / Int32ul,
|
||||
"unk_2d8" / Int8ul,
|
||||
"pad_2d9" / Default(HexDump(Bytes(0x7)), bytes(0x7)),
|
||||
)
|
||||
|
||||
class WorkCommand0_UnkBuf(ConstructValueClass):
|
||||
|
|
|
@ -614,72 +614,103 @@ class ComputeArgs(ConstructClass):
|
|||
threads_per_threadgroup_addr = Int64ul,
|
||||
)
|
||||
|
||||
class JobMeta(ConstructClass):
|
||||
subcon = Struct(
|
||||
"unk_0" / Int32ul,
|
||||
"stamp_addr" / WrappedPointer, # same contents as below
|
||||
"stamp" / ROPointer(this.stamp_addr.value, StampCounter),
|
||||
"fw_stamp_addr" / WrappedPointer, # same as FinalizeComputeCmd.stamp - some kind of fence/token
|
||||
"stamp" / ROPointer(this.fw_stamp_addr.value, StampCounter),
|
||||
"stamp_value" / Int32ul,
|
||||
"stamp_slot" / Int32ul,
|
||||
"evctl_index" / Int32ul,
|
||||
"unk_20" / Int32ul,
|
||||
"uuid" / Int32ul,
|
||||
"prev_stamp_value" / Int32ul,
|
||||
)
|
||||
|
||||
class EncoderParams(ConstructClass):
|
||||
subcon = Struct(
|
||||
"unk_0" / Int32ul,
|
||||
"unk_4" / Int32ul,
|
||||
"unk_8" / Int32ul,
|
||||
"encoder_id" / Int32ul,
|
||||
"unk_10" / Int32ul,
|
||||
"iogpu_compute_unk44" / Int32ul,
|
||||
"seq_buffer" / Int64ul,
|
||||
"unk_1c" / Int64ul,
|
||||
)
|
||||
|
||||
class ComputeLayout(ConstructClass):
|
||||
subcon = Struct(
|
||||
"unk_0" / Int32ul,
|
||||
"unk_4" / HexDump(Bytes(0x20)),
|
||||
"blocks_per_core" / Int32ul,
|
||||
"unk_28" / HexDump(Bytes(0x1c)),
|
||||
"core_list" / Array(160, Int16ul),
|
||||
"work_lists" / Array(8, Array(272, Array(4, Int32ul))),
|
||||
# Least significant byte encoding
|
||||
# 7654 3210
|
||||
# ==== ====
|
||||
# 0000 0000 - invalid
|
||||
# aaaa aa01 - Block size 0x400 or continuation
|
||||
# aaaa 0011 - Block size 0x1000
|
||||
# aa00 0111 - Block size 0x4000
|
||||
# 0000 1111 - Block size 0x10000
|
||||
# 0001 1111 - Block size 0x40000
|
||||
# 0011 1111 - Block size 0x100000? (not seen)
|
||||
# 0111 1111 - Block size 0x400000
|
||||
)
|
||||
|
||||
class ComputeInfo(ConstructClass):
|
||||
# Only the cmdlist and pipelinebase and cmdlist fields are strictly needed to launch a basic
|
||||
# compute shader.
|
||||
subcon = Struct( # 0x1c bytes
|
||||
"args" / Int64ul, # ComputeArgs
|
||||
"cmdlist" / Int64ul, # CommandList from userspace
|
||||
"unkptr_10" / Int64ul, # size 8, null
|
||||
"unkptr_18" / Int64ul, # size 8, null
|
||||
"unkptr_20" / Int64ul, # size 8, null
|
||||
"unkptr_28" / Int64ul, #
|
||||
"iogpu_deflake_1" / Int64ul, # ComputeArgs
|
||||
"encoder" / Int64ul, # CommandList from userspace
|
||||
"iogpu_deflake_2" / Int64ul, # size 8, null
|
||||
"iogpu_deflake_3" / Int64ul, # size 8, null
|
||||
"iogpu_deflake_4" / Int64ul, # size 8, null
|
||||
"iogpu_deflake_5" / Int64ul, # size 8, null
|
||||
"pipeline_base" / Int64ul, # 0x11_00000000: Used for certain "short" pointers like pipelines (and shaders?)
|
||||
"unk_38" / Int64ul, # always 0x8c60.
|
||||
"unk_40" / Int32ul, # 0x41
|
||||
"unk_38" / Int64ul, # always 0x8c60
|
||||
"unk_40" / Int32ul, # 0x98000; bit 0: explicit thread layout?
|
||||
"unk_44" / Int32ul, # 0
|
||||
"unkptr_48" / Int64ul, # related to threadgroups / thread layout
|
||||
"unk_50" / Int32ul, # 0x40 - Size?
|
||||
"compute_layout_addr" / Int64ul, # work layout
|
||||
"unk_50" / Int32ul, # 0x40 - Size? only if work layout is provided
|
||||
"unk_54" / Int32ul, # 0
|
||||
"unk_58" / Int32ul, # 1
|
||||
"unk_5c" / Int32ul, # 0
|
||||
"unk_60" / Int32ul, # 0x1c
|
||||
"iogpu_unk_40" / Int32ul, # 0x1c
|
||||
)
|
||||
|
||||
# Related to "IOGPU Misc"
|
||||
class ComputeInfo2(ConstructClass):
|
||||
subcon = Struct(
|
||||
unk_0 = HexDump(Bytes(0x24)),
|
||||
unkptr_24 = Int64ul, # equal to args
|
||||
unkptr_2c = Int64ul, # points at end of cmdlist?
|
||||
unk_34 = HexDump(Bytes(0x38)),
|
||||
encoder_id = Int32ul,
|
||||
unk_70 = Int32ul,
|
||||
unk_74 = Int32ul,
|
||||
unknown_buffer = Int64ul,
|
||||
unk_80 = Int32ul,
|
||||
unk_84 = Int32ul,
|
||||
unk_88 = Int32ul,
|
||||
stamp1_addr = Int64ul, # same contents as below
|
||||
stamp1 = ROPointer(this.stamp1_addr, Hex(Int32ul)),
|
||||
stamp2_addr = Int64ul, # same as FinalizeComputeCmd.stamp - some kind of fence/token
|
||||
stamp2 = ROPointer(this.stamp2_addr, Hex(Int32ul)),
|
||||
stamp_value = Int32ul,
|
||||
unk_a0 = Int32ul,
|
||||
unk_a4 = Int32ul,
|
||||
unk_a8 = Int32ul,
|
||||
uuid = Int32ul,
|
||||
unk_b0 = Int32ul,
|
||||
"unk_0" / HexDump(Bytes(0x24)),
|
||||
"iogpu_deflake_1" / Int64ul,
|
||||
"encoder_end" / Int64ul,
|
||||
"unk_34" / HexDump(Bytes(0x2c)),
|
||||
)
|
||||
|
||||
class StartComputeCmd(ConstructClass):
|
||||
subcon = Struct( # 0x154 bytes''''
|
||||
subcon = Struct(
|
||||
"magic" / Const(0x29, Int32ul),
|
||||
"unkptr_4" / Int64ul, # empty: WorkCommandCP + 0x14, size: 0x54
|
||||
"computeinfo_addr" / Int64ul, # List of userspace VAs: WorkCommandCP + 0x68
|
||||
"unk_buf_addr" / Int64ul, # Pointer to WorkCommandCP.unk_buf
|
||||
"computeinfo_addr" / Int64ul,
|
||||
"computeinfo" / ROPointer(this.computeinfo_addr, ComputeInfo),
|
||||
"unkptr_14" / Int64ul, # In gpu-asc's heap? Did this pointer come from the gfx firmware?
|
||||
"cmdqueue_ptr" / Int64ul, # points back to the submitinfo that this command came from
|
||||
"stats_ptr" / Int64ul,
|
||||
"cmdqueue_ptr" / Int64ul,
|
||||
"context_id" / Int32ul, # 4
|
||||
"unk_28" / Int32ul, # 1
|
||||
"unk_2c" / Int32ul, # 0
|
||||
"unk_30" / Int32ul,
|
||||
"counter1" / Int32ul,
|
||||
"counter2" / Int32ul,
|
||||
"unk_34" / Int32ul,
|
||||
"unk_38" / Int32ul,
|
||||
"computeinfo2_addr" / Int64ul, # WorkCommandCP + 0x1f4
|
||||
"computeinfo2_addr" / Int64ul,
|
||||
"computeinfo2" / ROPointer(this.computeinfo2_addr, ComputeInfo2),
|
||||
"unk_44" / Int32ul,
|
||||
"uuid" / Int32ul, # uuid for tracking?
|
||||
"uuid" / Int32ul,
|
||||
"padding" / Bytes(0x154 - 0x4c),
|
||||
)
|
||||
|
||||
|
@ -688,7 +719,7 @@ class FinalizeComputeCmd(ConstructClass):
|
|||
"magic" / Const(0x2a, Int32ul),
|
||||
"unkptr_4" / Int64ul, # same as ComputeStartCmd.unkptr_14
|
||||
"cmdqueue_ptr" / Int64ul, # points back to the submitinfo
|
||||
"unk_14" / Int32ul, # Context ID?
|
||||
"context_id" / Int32ul,
|
||||
"unk_18" / Int32ul,
|
||||
"unkptr_1c" / Int64ul, # same as ComputeStartCmd.unkptr_3c
|
||||
"unk_24" / Int32ul,
|
||||
|
|
Loading…
Reference in a new issue