From 10e03cd7571e905c17092e234a74eed217f1c83d Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Mon, 16 Nov 2026 23:45:08 -0500 Subject: vgsp: eng89s - admit the real CALL(0) 0x3800 draw; GZ_EGL harness The real 570.144 direct-GL draw window (12068 B @ push 0x402f9d8) carries no 0x3910/0x3914 write. Its draw is an op=4 IMMD to method 0x3800 (imm=0xd48=3400) plus CALL slots 44/57/58 (0x3960/0x39c8/0x39d0), and the window has no colour-target bind of its own, so RT-gated admission sent it down the compute-QMD lane. Recognize and admit the real marker: the walker, chunk check and window marker accept 0x3800/0x3960/0x39c8/0x39d0 (0x3910/ 0x3914 kept); the call-0 admission predicate scans the admitted window (a pre-window run header can swallow the window head); the draw chunk is forced first (draw_slice=1, order 0) and the window replayed verbatim. The booter's DRAW_IAB window predicate accepts the op=4 CALL(0) and the secondaries, the census names slot 0 (MME-CALL-ARGS slot=0 data=), and the final emitted window gets MME-EXEC-CALL slot=0 (the physical GR front-end executes the CALL; the kernel has no CALL interpreter, the 0x114 prelude uploads precede the window in the same launch). Guest harness: add tools/guest-diag/gz_es.c and an on-demand build in push_gl_tools.sh; GZ_EGL=1 switches gzdoom_pbuf_run.sh/mission-gz.sh to SDL offscreen + real NVIDIA EGL/GLES (default unchanged); push_gl_tools.sh creates the NVIDIA EGL vendor ICD only when missing. Receipts: c1025 GL-FLUSH admitted=1, DRAW-WRITE m=0x3800 op=4 data=0xd48, 3D mark admitted (CALL(0) 0x3800 draw marker), 3D stream chunked, 3D chunk launch draw=1, MME-CALL-ARGS slot=0 data=0xd48, MME-EXEC-CALL slot=0 op=4 imm=0xd48. Exact 0x402f9d8 post-fix replay still unverified (run wedged on an earlier draw window); stores/px remain open. --- kernel/gsp_phys_booter.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-) (limited to 'kernel/gsp_phys_booter.c') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 2be4a60..5f1b99f 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19164,7 +19164,19 @@ MODULE_PARM_DESC(sema_gl_mme_release_chain, * carry 1+cnt words; only op 1/3 walk past the header method), so a * CALL_MME_DATA(34) port write (0x3914) or another slot's call never * selects the record. + * + * eng89s: the real 570.144 direct-GL draw is CALL_MME_MACRO(0) - an IMMD + * (op 4) write to 0x3800 whose immediate is the macro program length + * (c1022: hdr 0x8d480e00 imm=0xd48=3400) - with 0x3960/0x39c8/0x39d0 + * (slots 44/57/58) as secondaries. Accept it as a DRAW_IAB-bearing + * window so the saved-window release prefers the real draw chunk. */ +static bool gsp_phys_gr_mme_draw_method(u32 m) +{ + return m == 0x3800u || m == 0x3910u || m == 0x3914u || + m == 0x3960u || m == 0x39c8u || m == 0x39d0u; +} + static bool gsp_phys_gr_mme_window_has_draw_ia(const u32 *win, u32 n) { u32 r = 0; @@ -19185,14 +19197,19 @@ static bool gsp_phys_gr_mme_window_has_draw_ia(const u32 *win, u32 n) * k=(0x3910-0x804)/4 with the macro data/address in the * following word. Only count it when that data word exists * (k + 1 < span), so a bare method mention is not a CALL. + * eng89s: an op=4 CALL(0) carries its argument as the header + * immediate, so it needs no following data word. */ for (k = 0; k < span; k++) { u32 m = ((h & 0xfffu) << 2) + 4u * k; if (k && op != 1u && op != 3u) break; - if (m == 0x3800u + 34u * 8u && - k + 1u < span && r + k + 1u < n) + if (!gsp_phys_gr_mme_draw_method(m)) + continue; + if (m == 0x3800u && op == 4u && cnt) + return true; + if (k + 1u < span && r + k + 1u < n) return true; } r += span; @@ -19503,6 +19520,28 @@ static void gsp_phys_gr_mme_call_census(const struct gsp_phys_gr_submit *req, (have_gold ? gent : 0u), win_n, held); } + /* + * eng89s: the real draw's CALL_MME_MACRO(0) target. + * An IMMD carries its argument in the header immediate; + * an interior INC/ONEINC run carries it in the following + * data word. + */ + if (j == 0u) { + u32 data = 0; + + if (op == 4u) + data = (h >> 16) & 0x1fffu; + else if (k + 1u < span) + data = req->stream[r + k + 1u]; + pr_info("vgsp-gr: MME-CALL-ARGS slot=0 data=0x%x at=%u\n", + data, r + k); + pr_info("vgsp-gr: MME-CALL-TARGET slot=0 method=0x%x client=0x%x golden=0x%x used=0x%x win=%u held=%u\n", + m, have_cli ? sa_ent[0] : 0u, + have_gold ? gent : 0u, + have_cli ? sa_ent[0] : + (have_gold ? gent : 0u), + win_n, held); + } } r += span; } @@ -26013,6 +26052,47 @@ if (gsp_phys_gr_slot_kept(j, sa_mask, wn, w); } } + /* + * eng89s: op=4 CALL_MME_MACRO(0) execution receipt. There is + * no kernel-side CALL interpreter: the FINAL emitted window is + * walked by the physical GR front-end, and CALL(0) resolves to + * the START-ADDRESS RAM entry the prelude pack uploaded. A + * call that survived the hold/elision passes above is in the + * emitted bytes, so name its resolved target; a held call has + * no receipt (MME-CALL-HOLD names the hold instead). + */ + if ((u32)(p - pb) > win_emit_off) { + static u32 mme_exec_log; + u32 ew = win_emit_off, en = (u32)(p - pb); + + while (ew < en && mme_exec_log < 32u) { + u32 h = pb[ew]; + u32 op = (h >> 29) & 7u; + u32 cnt = (h >> 16) & 0x1fffu; + u32 span = 1u; + u32 m0 = (h & 0xfffu) << 2; + + if ((op <= 3u || op == 5u) && cnt && + ew + 1u + cnt <= en) + span = 1u + cnt; + if (m0 == 0x3800u && + (op == 4u || op == 0u || op == 1u || + op == 3u || op == 5u)) { + u32 sa_ent[64] = { 0 }; + u64 sa_mask = gsp_sema_mme_sa_get( + sa_ent, 64); + u32 addr = (sa_mask & 1ull) ? + sa_ent[0] : 0u; + + mme_exec_log++; + pr_info("vgsp-gr: MME-EXEC-CALL slot=0 addr=0x%x h=0x%x push=0x%llx rel=%u op=%u imm=0x%x\n", + addr, req->h_object, + req->push_va, req->stream_rel, + op, op == 4u ? cnt : 0u); + } + ew += span; + } + } /* * eng39: neutralize the client's own notify/report-semaphore * targets in the FINAL emitted window (after the CALL/pair -- cgit v1.2.3