From db401573f1a8a2a926901f752b4401e8916d976c Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Fri, 6 Nov 2026 22:09:22 -0500 Subject: vgsp-gl: GS SPH placement/maps/context A/B knobs --- kernel/gsp_phys_booter.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 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 0fc2ee7..96fdc46 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -18713,6 +18713,42 @@ bool gsp_phys_rmcall_gr_raster_pre_value(void) { return READ_ONCE(gsp_phys_rmcall_gr_raster_pre); } + +/* + * SESSION 155 CONT 15: where the synthesized GS SPH lives inside the + * program-family page. 0 = family+0x780 (below the window's own VTG bind + * at family+0x900), 1 = family+0xe80 (above it; the DS's PROGRAM_REGION + * snapshot reads the bind VA, so a region starting there does not cover + * 0x780). Default 0 = legacy. + */ +static u32 gsp_phys_rmcall_gr_sph_gs_addr; +module_param_named(sema_gl_sph_gs_addr, gsp_phys_rmcall_gr_sph_gs_addr, + uint, 0644); +MODULE_PARM_DESC(sema_gl_sph_gs_addr, + "Synth GS SPH offset in the family page: 0=+0x780 (legacy), 1=+0xe80 (above the VTG bind)"); + +u32 gsp_phys_rmcall_gr_sph_gs_addr_value(void) +{ + return READ_ONCE(gsp_phys_rmcall_gr_sph_gs_addr); +} + +/* + * SESSION 155 CONT 15: GS context A/B words emitted with the synth GS bind. + * bit0: SET_MESH_CONTROL (0x114c) <- 0 + * bit1: SET_GS_MODE (0x0208) <- 0 (TYPE_ANY) + * The client's per-frame push carries neither; if the init push left them + * set, the GS macro/mesh path may treat the stage specially. Default 0. + */ +static u32 gsp_phys_rmcall_gr_sph_gs_ctx; +module_param_named(sema_gl_sph_gs_ctx, gsp_phys_rmcall_gr_sph_gs_ctx, + uint, 0644); +MODULE_PARM_DESC(sema_gl_sph_gs_ctx, + "Extra GS context with the synth bind: bit0=SET_MESH_CONTROL(0x114c)<-0, bit1=SET_GS_MODE(0x0208)<-0 (default 0)"); + +u32 gsp_phys_rmcall_gr_sph_gs_ctx_value(void) +{ + return READ_ONCE(gsp_phys_rmcall_gr_sph_gs_ctx); +} static bool gsp_phys_gr_mme_pairs_emitted; /* launch emitted a pair run */ static u32 gsp_phys_gr_mme_pairs_gen; /* gen whose pairs retired OK */ static u32 gsp_phys_gr_mme_launch_gen; /* last built launch's gen */ @@ -29776,6 +29812,8 @@ gr_page_unmapped: READ_ONCE(gsp_phys_rmcall_gr_sph_gs_mode); bool emit_raster = READ_ONCE(gsp_phys_rmcall_gr_raster_pre); + u32 gs_addr = READ_ONCE(gsp_phys_rmcall_gr_sph_gs_addr); + u32 gs_ctx = READ_ONCE(gsp_phys_rmcall_gr_sph_gs_ctx); /* * SESSION 155 CONT 9: the prelude is prepended ahead of @@ -30004,7 +30042,9 @@ gr_page_unmapped: (emit_j2 ? (bind_binding ? 8u : 7u) : 0u) + (emit_j4 ? (bind_binding ? 8u : 7u) : 0u) + (emit_j5 ? (bind_binding ? 8u : 7u) : 0u) + - (emit_gsimg ? (9u + ((gs_mode & 1u) ? 11u : 0u)) : 0u) + + (emit_gsimg ? (9u + ((gs_mode & 1u) ? 11u : 0u) + + ((gs_ctx & 1u) ? 2u : 0u) + + ((gs_ctx & 2u) ? 2u : 0u)) : 0u) + (emit_raster ? 17u : 0u) <= 96u) { /* @@ -30211,7 +30251,8 @@ gr_page_unmapped: * run here (nrun++ below). */ if (emit_gsimg) { - u64 gva = fam + 0x780u; + u64 gva = fam + (gs_addr ? 0xe80u : + 0x780u); in[nfin++] = 0x20000000u | (1u << 16) | (0x2100u >> 2); @@ -30246,6 +30287,18 @@ gr_page_unmapped: in[nfin++] = 0u; in[nfin++] = 0u; } + if (gs_ctx & 1u) { + in[nfin++] = 0x20000000u | + (1u << 16) | + (0x114cu >> 2); + in[nfin++] = 0u; + } + if (gs_ctx & 2u) { + in[nfin++] = 0x20000000u | + (1u << 16) | + (0x0208u >> 2); + in[nfin++] = 0u; + } in[nfin++] = 0x20000000u | (1u << 16) | (0x2100u >> 2); in[nfin++] = (gs_mode & 2u) ? 0x41u : -- cgit v1.2.3