Liveness probe: per-draw polygon-site counts for any capture

probe_live.py boots a capture (with the required r.start()) and counts per-draw
hits at the known polygon sites (quadA/triB/emit-header/VSTRIP). Discriminates
real scene content from the background-only test bench. Findings so far: every
cap* capture + ravtest + dtest + sharksval = the SAME hardware test bench (one
9x5 patch; sharksval draws it 3x); real content lives in the extra-action
captures (sdemo/glblade/munga/trek/fxtest/klng*), which DO replay (fxtest ran
6K+ commands incl. act25/42 with no faults) but have much larger scene builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-16 18:15:42 -05:00
co-authored by Claude Opus 4.8
parent cdc2c724db
commit 60d4c2da84
+44
View File
@@ -0,0 +1,44 @@
"""Liveness probe: boot a capture, run ~30 draws, count per-draw hits at the known
polygon sites. quadA=4/draw = background-only (dead, like ravtest); anything more
(triB, VSTRIP, emitH>>12, quadA>4) = real scene content. Usage: probe_live.py <cap>"""
import sys, time, struct, pickle, collections
sys.path.insert(0, r'C:\VWE\TeslaRel410\emulator\firmware-decomp')
sys.path.insert(0, r'C:\VWE\TeslaRel410\dpl3-revive\patha')
import emu860, dis860, emu_main
from vrboard import A
emu860.Mem.log = lambda self, *a, **k: None
CAP = sys.argv[1]
NDRAW = int(sys.argv[2]) if len(sys.argv) > 2 else 30
r = emu_main.MainRunner(r'C:\VWE\TeslaRel410\dpl3-revive\patha\%s.raw.bin' % CAP,
fw='capfw7', max_cmds=20000)
cpu = r.start()
DRAW = int(A.draw_scene)
draw_idx = [i for i, (a, p) in enumerate(r.queue) if a == DRAW]
stop_at = draw_idx[NDRAW - 1] + 2 if len(draw_idx) >= NDRAW else len(r.queue)
print("%s: %d cmds, %d draws, first at %s; probing through cmd %d" %
(CAP, len(r.queue), len(draw_idx), draw_idx[:3], stop_at), flush=True)
SITES = {0xf0418a30: 'quadA', 0xf0418500: 'triB', 0xf041d148: 'emitH',
0xf041614c: 'VSTRIP'}
percmd = collections.defaultdict(collections.Counter)
t0 = time.time()
while time.time() - t0 < 700:
pc = cpu.pc
s = SITES.get(pc)
if s: percmd[r.qi][s] += 1
if r.qi >= stop_at: break
h = r.hooks.get(pc)
if h:
if h(cpu) == 'done': break
continue
if not cpu.step(): break
print("%s probed to cmd %d in %.0fs" % (CAP, r.qi, time.time() - t0))
tot = collections.Counter()
for qi, c in sorted(percmd.items()):
tot.update(c)
print("%s TOTALS over %d cmds: %s" % (CAP, len(percmd), dict(tot)))
rich = [(qi, dict(c)) for qi, c in sorted(percmd.items())
if c.get('triB', 0) or c.get('VSTRIP', 0) or c.get('quadA', 0) > 4 or c.get('emitH', 0) > 12]
print("%s RICH cmds: %s" % (CAP, rich[:12] if rich else "NONE - background only"))