From 5fad0adb166138b4096494b186e9405902ab9ab6 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Fri, 6 Nov 2026 13:30:31 -0500 Subject: vgsp-gl: add sema_sph_bind_mask for slot-selective synth SPH binds With sema_gl_sph_bind=0 the r1538 window carries only the client's two slot-1 (VERTEX_B) binds; the DS then faults a0040800 (PS stage SPH11|SPH18, stage5=0) because the PS program start is missing. Add sema_sph_bind_mask (bit j = synth slot j) so the PS bind can be re-enabled alone (0x20) while the vertex synth binds stay off; the legacy sph_bind=1 behavior is byte-identical (j2/j5 both emitted). r1541 (mask=0x20): the receipt fires (j5=1 x8) but stage5 stays zero and the launch poisons at LOAD_CONSTANT_BUFFER (0x2390 <- 0xbf800000, EC 0x03), so the j5 synth emission needs the r1456 selector/state fix before this axis can be evaluated. Parameter default 0; evidence in Handoff-vGPU-IO.md. --- kernel/gsp_phys_booter.c | 107 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 33 deletions(-) (limited to 'kernel/gsp_phys_booter.c') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index e417d71..40afca1 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19537,6 +19537,12 @@ module_param_named(sema_gl_sph_bind, gsp_phys_rmcall_gr_sph_bind, bool, 0644); MODULE_PARM_DESC(sema_gl_sph_bind, "Emit the client's missing TESS_CONTROL (j=2) and PIXEL (j=5) pipeline program binds ahead of replayed 3D windows (program-family page of the window's prog VA; default 1)"); +static u32 gsp_phys_rmcall_gr_sph_bind_mask; /* bit j = synth slot j */ +module_param_named(sema_sph_bind_mask, gsp_phys_rmcall_gr_sph_bind_mask, + uint, 0644); +MODULE_PARM_DESC(sema_sph_bind_mask, + "Synth SPH-BIND slot mask (bit j = slot j; 0x20 = PS only) used when sema_gl_sph_bind=0"); + bool gsp_phys_rmcall_gr_sph_bind_value(void) { return READ_ONCE(gsp_phys_rmcall_gr_sph_bind); @@ -29439,7 +29445,12 @@ gr_page_unmapped: * then prepend them ahead of the window. Beef client * channels only: the family layout is that client's. */ - if (READ_ONCE(gsp_phys_rmcall_gr_sph_bind) && + bool sph_bind_all = + READ_ONCE(gsp_phys_rmcall_gr_sph_bind); + u32 sph_bind_mask = + READ_ONCE(gsp_phys_rmcall_gr_sph_bind_mask); + + if ((sph_bind_all || sph_bind_mask) && (req->h_object & 0xfffff000u) == 0xbeef0000u && req->prog_va && win3d_n + 64u <= GSP_PHYS_RMCALL_GR_METHOD_WORDS) { @@ -29451,6 +29462,10 @@ gr_page_unmapped: u32 bi; bool bind_binding = READ_ONCE(gsp_phys_rmcall_gr_sph_bind_binding); + bool emit_j2 = sph_bind_all || + (sph_bind_mask & 0x04u); + bool emit_j5 = sph_bind_all || + (sph_bind_mask & 0x20u); /* * SESSION 153-CONTINUED-89 (2nd half): the client's @@ -29560,7 +29575,8 @@ gr_page_unmapped: * Shader-Program-Header poison (r1277+ 9/11). Re-emit * every bind the window itself carries ahead of it. */ - for (bi = 0; bi < req->n_prog_binds && bi < 8u; bi++) { + for (bi = 0; sph_bind_all && + bi < req->n_prog_binds && bi < 8u; bi++) { u64 va = req->prog_bind_va[bi]; u32 sl = req->prog_bind_slot[bi] & 0x1fu; @@ -29580,15 +29596,21 @@ gr_page_unmapped: * from guest RAM (`20020825 [0,04400200]`, * `20020855 [0,04400000]`). */ - if (nfin + (bind_binding ? 19u : 17u) <= 64u) { - in[nfin++] = 0x20000000u | (2u << 16) | - (0x2094u >> 2); - in[nfin++] = (u32)((fam + 0x200u) >> 32) & 0xffu; - in[nfin++] = (u32)(fam + 0x200u) & 0xfffffffcu; - in[nfin++] = 0x20000000u | (2u << 16) | - (0x2154u >> 2); - in[nfin++] = (u32)(fam >> 32) & 0xffu; - in[nfin++] = (u32)fam & 0xfffffffcu; + if (nfin + 3u + + (emit_j2 ? (bind_binding ? 8u : 7u) : 0u) + + (emit_j5 ? (bind_binding ? 8u : 7u) : 0u) <= 64u) { + if (emit_j2) { + in[nfin++] = 0x20000000u | (2u << 16) | + (0x2094u >> 2); + in[nfin++] = (u32)((fam + 0x200u) >> 32) & 0xffu; + in[nfin++] = (u32)(fam + 0x200u) & 0xfffffffcu; + } + if (emit_j5) { + in[nfin++] = 0x20000000u | (2u << 16) | + (0x2154u >> 2); + in[nfin++] = (u32)(fam >> 32) & 0xffu; + in[nfin++] = (u32)fam & 0xfffffffcu; + } /* * SESSION 153-CONTINUED-88: the per-slot * SET_PIPELINE_SHADER(j) TYPE state. The @@ -29603,12 +29625,16 @@ gr_page_unmapped: * synthesized slots with the known types * (j=2 TESS_CONTROL -> 2, j=5 PIXEL -> 5). */ - in[nfin++] = 0x20000000u | (1u << 16) | - (0x2080u >> 2); - in[nfin++] = 1u | (2u << 4); - in[nfin++] = 0x20000000u | (1u << 16) | - (0x2140u >> 2); - in[nfin++] = 1u | (5u << 4); + if (emit_j2) { + in[nfin++] = 0x20000000u | (1u << 16) | + (0x2080u >> 2); + in[nfin++] = 1u | (2u << 4); + } + if (emit_j5) { + in[nfin++] = 0x20000000u | (1u << 16) | + (0x2140u >> 2); + in[nfin++] = 1u | (5u << 4); + } /* * SESSION 153-CONTINUED-90: the per-stage * REGISTER_COUNT/BINDING records for the @@ -29625,21 +29651,29 @@ gr_page_unmapped: * restores the legacy CONT-90 2-word runs. */ if (bind_binding) { - in[nfin++] = 0x20000000u | (2u << 16) | - (0x208cu >> 2); - in[nfin++] = 0x1au; - in[nfin++] = 0x0u; - in[nfin++] = 0x20000000u | (2u << 16) | - (0x214cu >> 2); - in[nfin++] = 0x1au; - in[nfin++] = 0x0u; + if (emit_j2) { + in[nfin++] = 0x20000000u | (2u << 16) | + (0x208cu >> 2); + in[nfin++] = 0x1au; + in[nfin++] = 0x0u; + } + if (emit_j5) { + in[nfin++] = 0x20000000u | (2u << 16) | + (0x214cu >> 2); + in[nfin++] = 0x1au; + in[nfin++] = 0x0u; + } } else { - in[nfin++] = 0x20000000u | (1u << 16) | - (0x208cu >> 2); - in[nfin++] = 0x1au; - in[nfin++] = 0x20000000u | (1u << 16) | - (0x214cu >> 2); - in[nfin++] = 0x1au; + if (emit_j2) { + in[nfin++] = 0x20000000u | (1u << 16) | + (0x208cu >> 2); + in[nfin++] = 0x1au; + } + if (emit_j5) { + in[nfin++] = 0x20000000u | (1u << 16) | + (0x214cu >> 2); + in[nfin++] = 0x1au; + } } /* * SESSION 153-CONTINUED-89: the client's @@ -29655,13 +29689,16 @@ gr_page_unmapped: in[nfin++] = 0x1au; in[nfin++] = 0x0u; /* - * nrun counts only the two ADDRESS-bearing + * nrun counts only the ADDRESS-bearing * binds above: the guard below matches it * against the relocation pass's * relocated-pair count, and the constant * type runs can never be relocated. */ - nrun += 2; + if (emit_j2) + nrun++; + if (emit_j5) + nrun++; } orel = gsp_phys_rmcall_gr_3d_patch_window( in, nfin, out, &on, &odrop, req, &n_shadow, @@ -29686,6 +29723,10 @@ gr_page_unmapped: orel, nrun, on, nfin, fam, req->h_object, req->push_va); } + pr_info("vgsp-gr: SPH-BIND-MASK mask=0x%x all=%u j2=%u j5=%u h=0x%x push=0x%llx\n", + sph_bind_mask, sph_bind_all ? 1u : 0u, + emit_j2 ? 1u : 0u, emit_j5 ? 1u : 0u, + req->h_object, req->push_va); } /* * SESSION 153-CONTINUED-62: surface (render-target) prelude - -- cgit v1.2.3