From 5ff47a9546eb9580a1fbe56706abef2a4fb87aaa Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Sun, 15 Nov 2026 18:25:12 -0500 Subject: vgsp: eng69 - persist and replay the client's vertex-stream location pairs c807: the release DRAW window carries only SET_VERTEX_STREAM_A_FORMAT (0x1c00 <- 0x1014); its [fmt, UPPER, LOWER] location pair lives in the client's setup push, so the replay context's stream address is unbound (DRAW-STATE VS0=0) and the 8x3-vertex DRAW_IAB fetches nothing (wrote=0). - service: sticky svc_gl_vs_base[8] from every decoded 0x1c00..0x1cf0 count>=3 pair (VS-BIND receipt); re-add those pages to every GL draw section's candidate page set so the launch can map them; getter gsp_sema_gl_vs_base(). - booter release_save: when the held window carries the FORMAT but no count>=3 location pair, prepend a normal INC run [fmt, UPPER, LOWER] for streams 0 and 3 to the saved window (MME-VS-BIND synth receipt, MME-CARRY-SAVE vs_pre=N). The normal window patch relocates the pair to a shadow VA using the saved page set, so the release draw can fetch its vertices. --- kernel/gsp_phys_booter.c | 85 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 4 deletions(-) (limited to 'kernel/gsp_phys_booter.c') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index a98a588..8da7478 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19119,6 +19119,40 @@ static bool gsp_phys_gr_mme_window_has_draw_ia(const u32 *win, u32 n) return false; } +/* + * eng69: vertex-stream location persistence. The client's per-frame DRAW + * window carries only SET_VERTEX_STREAM_A_FORMAT (0x1c00/0x1c30, one data + * word = the format); the [fmt, UPPER, LOWER] location pair lives in its + * setup push. Return the window's format word for stream j and set + * *has_pair when the window already carries the count>=3 pair run. + */ +static u32 gsp_phys_gr_mme_window_vs_fmt(const u32 *win, u32 n, u32 j, + bool *has_pair) +{ + u32 r = 0, fmt = 0, want = 0x1c00u + j * 0x10u; + + *has_pair = false; + while (r < n) { + u32 h = win[r]; + u32 op = (h >> 29) & 7u; + u32 cnt = (h >> 16) & 0x1fffu; + u32 span = 1u; + u32 m0 = (h & 0xfffu) << 2; + + if ((op == 1u || op == 3u || op == 5u) && cnt && + r + 1u + cnt <= n) + span = 1u + cnt; + if (m0 == want) { + if (span >= 2u && !fmt) + fmt = win[r + 1u]; + if (span >= 4u) + *has_pair = true; + } + r += span; + } + return fmt; +} + static u32 gsp_phys_gr_mme_release_due_ms(void) { u32 ms = READ_ONCE(gsp_phys_rmcall_gr_mme_pack_release_ms); @@ -19227,6 +19261,8 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, bool draw_ia, keep = false; const char *prefer = NULL; u32 old_h = 0, old_win = 0; + u32 vs_pre[12]; + u32 vs_n = 0; static u32 prefer_log; if (!READ_ONCE(gsp_phys_rmcall_gr_mme_pack_release) || !req) @@ -19279,6 +19315,44 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, prefer = "draw-win"; } if (!keep) { + /* + * eng69: prepend the client's last vertex-stream location + * pairs (streams 0 and 3) when this window carries only the + * FORMAT run. The pair is a normal INC run + * [fmt, UPPER, LOWER] at 0x1c00/0x1c30; the normal window + * patch relocates it to a shadow VA using the launch page + * set (the service re-adds the sticky VB pages to every GL + * candidate). Without it the release draw fetches vertices + * from an unbound stream (c807 DRAW-STATE VS0=0, wrote=0). + */ + u32 vj; + + for (vj = 0; vj < 8u; vj++) { + u64 vva = gsp_sema_gl_vs_base(vj); + bool has = false; + u32 vfmt; + + if (vj != 0u && vj != 3u) + continue; + vfmt = gsp_phys_gr_mme_window_vs_fmt(req->stream, + req->stream_n, vj, + &has); + if (!vva || has || vs_n + 4u > ARRAY_SIZE(vs_pre)) + continue; + if (!vfmt) + vfmt = 0x1014u; + vs_pre[vs_n++] = (1u << 29) | (3u << 16) | + (((0x1c00u + vj * 0x10u) >> 2) & + 0xfffu); + vs_pre[vs_n++] = vfmt; + vs_pre[vs_n++] = (u32)(vva >> 32) & 0xffu; + vs_pre[vs_n++] = (u32)vva & 0xfffffffcULL; + pr_info("vgsp-gr: MME-VS-BIND synth j=%u base=0x%llx fmt=0x%x h=0x%x push=0x%llx\n", + vj, (unsigned long long)vva, vfmt, + req->h_object, req->push_va); + } + if (req->stream_n + vs_n > GSP_PHYS_GR_MME_RELEASE_WIN_MAX) + vs_n = 0; s->valid = false; s->armed = false; s->fired = false; @@ -19313,8 +19387,11 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, s->qmd_hpa = req->qmd_hpa; s->push_len = req->push_len; s->stream_rel = req->stream_rel; - s->stream_n = req->stream_n; - memcpy(s->win, req->stream, (size_t)req->stream_n * 4u); + s->stream_n = req->stream_n + vs_n; + if (vs_n) + memcpy(s->win, vs_pre, (size_t)vs_n * 4u); + memcpy(s->win + vs_n, req->stream, + (size_t)req->stream_n * 4u); s->prog_va = req->prog_va; s->n_prog_binds = req->n_prog_binds; memcpy(s->prog_bind_va, req->prog_bind_va, @@ -19340,9 +19417,9 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, req->h_object, win_n); } pr_info("vgsp-gr: MME-CARRY-SAVE h=0x%x win=%u held=%u draw_ia=%u " - "raw=%u push=0x%llx\n", + "raw=%u vs_pre=%u push=0x%llx\n", req->h_object, win_n, held, draw_ia, req->stream_n, - (unsigned long long)req->push_va); + vs_n / 4u, (unsigned long long)req->push_va); } /* -- cgit v1.2.3