Skip to content

Commit 788a5b9

Browse files
committed
m1n1.trace.agx: Changes to unbreak G14X tracing
Signed-off-by: Asahi Lina <[email protected]>
1 parent 40c9dfe commit 788a5b9

1 file changed

Lines changed: 96 additions & 72 deletions

File tree

proxyclient/m1n1/trace/agx.py

Lines changed: 96 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -849,17 +849,31 @@ def read(off, size):
849849
self.log(f" unkptr_18 @ {wi0.buf_thing.unkptr_18:#x}::")
850850
chexdump(read(wi0.buf_thing.unkptr_18, 0x80), print_fn=self.log)
851851

852-
# if getattr(wi0.struct_2, "tvb_cluster_meta1", None):
853-
# size = wi0.struct_2.tvb_cluster_meta2 - (wi0.struct_2.tvb_cluster_meta1 & 0xffffffffff)
854-
# data = read(wi0.struct_2.tvb_cluster_meta1, size)
855-
# rsize = len(data.rstrip(b"\x00\x00\x00\x00"))
856-
# self.log(f" meta1 @ {wi0.struct_2.tvb_cluster_meta1:#x} ({size:#x}/{rsize:#x}):")
857-
# chexdump(data, print_fn=self.log)
858-
# blocks = wi0.struct_2.tvb_cluster_meta1 >> 50
859-
# tc = wi0.tiling_params.tile_count
860-
# xt = (tc & 0xfff) + 1
861-
# yt = ((tc >> 12) & 0xfff) + 1
862-
# self.log(f" TILES {xt} {yt} {blocks} {size:#x}")
852+
if getattr(wi0, "struct2", None):
853+
data = read(wi0.struct_2.tvb_cluster_meta1, 0x100000)
854+
self.log(f" meta1 @ {wi0.struct_2.tvb_cluster_meta1:#x}:")
855+
chexdump(data, print_fn=self.log)
856+
blocks = wi0.struct_2.tvb_cluster_meta1 >> 50
857+
tc = wi0.tiling_params.tile_count
858+
xt = (tc & 0xfff) + 1
859+
yt = ((tc >> 12) & 0xfff) + 1
860+
self.log(f" TILES {xt} {yt} {blocks}")
861+
862+
self.log(f" meta2 @ {wi0.struct_2.tvb_cluster_meta2:#x}:")
863+
data = read(wi0.struct_2.tvb_cluster_meta2, 0x100000)
864+
chexdump(data, print_fn=self.log)
865+
self.log(f" meta3 @ {wi0.struct_2.tvb_cluster_meta3:#x}:")
866+
data = read(wi0.struct_2.tvb_cluster_meta3, 0x100000)
867+
chexdump(data, print_fn=self.log)
868+
self.log(f" meta4 @ {wi0.struct_2.tvb_cluster_meta4:#x}:")
869+
data = read(wi0.struct_2.tvb_cluster_meta4, 0x100000)
870+
chexdump(data, print_fn=self.log)
871+
data = read(wi0.struct_2.tvb_cluster_tilemaps, 0x400000)
872+
self.log(f" cluster_tilemaps @ {wi0.struct_2.tvb_cluster_tilemaps:#x}: ({len(data):#x})")
873+
chexdump(data, print_fn=self.log)
874+
data = read(wi0.struct_2.tvb_tilemap, 0x100000)
875+
self.log(f" tilemaps @ {wi0.struct_2.tvb_tilemap:#x}: ({len(data):#x})")
876+
chexdump(data, print_fn=self.log)
863877
#self.uat.dump(context, self.log)
864878

865879
regs = getattr(wi0, "registers", None)
@@ -931,24 +945,24 @@ def read(off, size):
931945

932946
for i in wi1.microsequence.value:
933947
i = i.cmd
934-
if not isinstance(i, Finalize3DCmd):
948+
if i.__class__.__name__ != "Finalize3DCmd":
935949
continue
936950
self.log(f" Finalize:")
937951
cmdfin = i
938952
#self.log(f" completion:")
939953
#chexdump(kread(cmdfin.completion, 0x4), print_fn=self.log)
940-
self.log(f" unkptr_1c @ {cmdfin.unkptr_1c:#x}:")
941-
chexdump(kread(cmdfin.unkptr_1c, 0x1000), print_fn=self.log)
954+
# self.log(f" unkptr_1c @ {cmdfin.unkptr_1c:#x}:")
955+
# chexdump(kread(cmdfin.unkptr_1c, 0x1000), print_fn=self.log)
942956
#self.log(f" unkptr_24 @ {cmdfin.unkptr_24:#x}:")
943957
#chexdump(kread(cmdfin.unkptr_24, 0x100), print_fn=self.log)
944-
self.log(f" unkptr_34 @ {cmdfin.unkptr_34:#x}:")
945-
chexdump(kread(cmdfin.unkptr_34, 0x1000), print_fn=self.log)
946-
self.log(f" unkptr_3c @ {cmdfin.unkptr_3c:#x}:")
947-
chexdump(kread(cmdfin.unkptr_3c, 0x1c0), print_fn=self.log)
948-
self.log(f" unkptr_44 @ {cmdfin.unkptr_44:#x}:")
949-
chexdump(kread(cmdfin.unkptr_44, 0x40), print_fn=self.log)
950-
self.log(f" unkptr_64 @ {cmdfin.unkptr_64:#x}:")
951-
chexdump(kread(cmdfin.unkptr_64, 0x118), print_fn=self.log)
958+
# self.log(f" unkptr_34 @ {cmdfin.unkptr_34:#x}:")
959+
# chexdump(kread(cmdfin.unkptr_34, 0x1000), print_fn=self.log)
960+
# self.log(f" unkptr_3c @ {cmdfin.unkptr_3c:#x}:")
961+
# chexdump(kread(cmdfin.unkptr_3c, 0x1c0), print_fn=self.log)
962+
# self.log(f" unkptr_44 @ {cmdfin.unkptr_44:#x}:")
963+
# chexdump(kread(cmdfin.unkptr_44, 0x40), print_fn=self.log)
964+
# self.log(f" unkptr_64 @ {cmdfin.unkptr_64:#x}:")
965+
# chexdump(kread(cmdfin.unkptr_64, 0x118), print_fn=self.log)
952966

953967
#self.log(f" buf_thing @ {wi1.buf_thing_addr:#x}: {wi1.buf_thing!s}")
954968
#self.log(f" unkptr_18 @ {wi1.buf_thing.unkptr_18:#x}:")
@@ -963,57 +977,67 @@ def handle_compute(self, wi):
963977
self.log("Got Compute Work Item")
964978
self.last_cp = wi
965979

966-
def kread(off, size):
967-
return self.uat.ioread(0, off, size)
980+
if wi.cmd.magic == 4:
981+
wi4 = wi.cmd
982+
#self.log(f" completion_buf @ {wi4.completion_buf_addr:#x}: {wi4.completion_buf!s} ")
983+
#chexdump(kread(wi4.completion_buf_addr, 0x1000), print_fn=self.log)
984+
elif wi.cmd.magic == 3:
985+
986+
wi3 = wi.cmd
987+
988+
def kread(off, size):
989+
return self.uat.ioread(0, off, size)
990+
991+
context = wi3.context_id
992+
993+
ci2 = wi3.compute_info2
994+
995+
def read(off, size):
996+
return self.uat.ioread(context, off, size)
997+
998+
self.log(f" encoder end = {ci2.encoder_end:#x}")
999+
chexdump(read(ci2.encoder_end, 0x400), print_fn=self.log)
1000+
1001+
self.log(f" context_id = {context:#x}")
9681002

969-
context = wi.cmd.context_id
970-
971-
ci = wi.cmd.compute_info
972-
ci2 = wi.cmd.compute_info2
973-
974-
def read(off, size):
975-
return self.uat.ioread(context, off, size)
976-
977-
self.log(f" encoder = {ci.encoder:#x}")
978-
chexdump(read(ci.encoder, 0x4000), print_fn=self.log)
979-
980-
self.log(f" encoder end = {ci2.encoder_end:#x}")
981-
chexdump(read(ci2.encoder_end, 0x400), print_fn=self.log)
982-
983-
self.log(f" context_id = {context:#x}")
984-
985-
self.log(f" deflake:")
986-
chexdump(read(ci.iogpu_deflake_1, 0x8000), print_fn=self.log)
987-
988-
self.log(" high page:")
989-
chexdump(read(0x6fffff8000, 0x4000), print_fn=self.log)
990-
991-
if False:#ci.compute_layout_addr != 0:
992-
layout = ComputeLayout.parse_stream(self.get_stream(context, ci.compute_layout_addr))
993-
self.log(f" Layout:")
994-
self.log(f" unk_0: {layout.unk_0:#x}")
995-
self.log(f" unk_4: {layout.unk_4}")
996-
self.log(f" blocks_per_core: {layout.blocks_per_core}")
997-
self.log(f" unk_28: {layout.unk_28}")
998-
self.log(f" core list: {list(layout.core_list)}")
999-
1000-
for core in range(8):
1001-
self.log(f" Core {core}")
1002-
for i in range(layout.blocks_per_core):
1003-
row = layout.work_lists[core][i]
1004-
first = row[0]
1005-
if not first & 1:
1006-
self.log(f" [{i:3d}] Missing?")
1007-
else:
1008-
bits = len(bin(first)[::-1].split("0")[0])
1009-
mask = ~((1 << bits) - 1)
1010-
block_size = 0x400 << (2 * (bits - 1))
1011-
s = [((i & mask) << 8) for i in row if i & 1]
1012-
1013-
self.log(f" [{i:3d}] block={block_size:#x} | {' '.join(map(hex, s))}")
1014-
for j, block in enumerate(s):
1015-
self.log(f" Block {j}")
1016-
chexdump(read(block, block_size), print_fn=self.log)
1003+
self.log(" high page:")
1004+
chexdump(read(0x6fffff8000, 0x4000), print_fn=self.log)
1005+
1006+
if getattr(wi3, "compute_info", None):
1007+
ci = wi3.compute_info
1008+
self.log(f" encoder = {ci.encoder:#x}")
1009+
chexdump(read(ci.encoder, 0x4000), print_fn=self.log)
1010+
self.log(f" deflake:")
1011+
chexdump(read(ci.iogpu_deflake_1, 0x8000), print_fn=self.log)
1012+
1013+
1014+
1015+
if False:#ci.compute_layout_addr != 0:
1016+
layout = ComputeLayout.parse_stream(self.get_stream(context, ci.compute_layout_addr))
1017+
self.log(f" Layout:")
1018+
self.log(f" unk_0: {layout.unk_0:#x}")
1019+
self.log(f" unk_4: {layout.unk_4}")
1020+
self.log(f" blocks_per_core: {layout.blocks_per_core}")
1021+
self.log(f" unk_28: {layout.unk_28}")
1022+
self.log(f" core list: {list(layout.core_list)}")
1023+
1024+
for core in range(8):
1025+
self.log(f" Core {core}")
1026+
for i in range(layout.blocks_per_core):
1027+
row = layout.work_lists[core][i]
1028+
first = row[0]
1029+
if not first & 1:
1030+
self.log(f" [{i:3d}] Missing?")
1031+
else:
1032+
bits = len(bin(first)[::-1].split("0")[0])
1033+
mask = ~((1 << bits) - 1)
1034+
block_size = 0x400 << (2 * (bits - 1))
1035+
s = [((i & mask) << 8) for i in row if i & 1]
1036+
1037+
self.log(f" [{i:3d}] block={block_size:#x} | {' '.join(map(hex, s))}")
1038+
for j, block in enumerate(s):
1039+
self.log(f" Block {j}")
1040+
chexdump(read(block, block_size), print_fn=self.log)
10171041

10181042
def ignore(self, addr=None):
10191043
if addr is None:

0 commit comments

Comments
 (0)