From 56dadb41d6644c602b494059288410b1872b0fa6 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Sat, 7 Nov 2026 01:03:58 -0500 Subject: vgsp-gl: raster blend/alpha/cull/point/ZCULL neutral A/B state --- kernel/gsp_phys_booter.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++- kernel/gsp_phys_gpu.h | 6 ++++++ 2 files changed, 55 insertions(+), 1 deletion(-) (limited to 'kernel') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 5f8df5e..43e4e11 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -18736,6 +18736,33 @@ bool gsp_phys_rmcall_gr_stale_write_value(void) return READ_ONCE(gsp_phys_gr_stale_write); } +/* + * SESSION 155 CONT 22: extra raster/store-disable A/B. The client's window + * carries none of the blend/alpha/cull/point/ZCULL channel state; if the + * replay's defaults kill fragments (blend discard, cull, alpha, ZCULL), no + * color reaches the ROP. Emit the neutral disabling form ahead of the + * window (constant runs): + * 0x12e4 SET_BLEND_STATE_PER_TARGET <- 0 + * 0x1e00 SET_BLEND_PER_TARGET_SEPARATE<- 0 + * 0x12ec SET_ALPHA_TEST <- 0 + * 0x1308 D3D_SET_CULL_MODE <- 0 (no cull) + * 0x1520 SET_POINT_SPRITE <- 0 + * 0x02e4 SET_ZCULL_ROP_BYPASS <- 0 + * 0x02e8 SET_ZCULL_SUBREGION <- 0 + * 0x02fc ASSIGN_ZCULL_SUBREGIONS <- 0 + * Default 0 = legacy bytes. + */ +static bool gsp_phys_rmcall_gr_raster_extra; +module_param_named(sema_gl_raster_extra, gsp_phys_rmcall_gr_raster_extra, + bool, 0644); +MODULE_PARM_DESC(sema_gl_raster_extra, + "Emit blend/alpha/cull/point/ZCULL neutral-disabled state ahead of replayed 3D windows (default 0; A/B)"); + +bool gsp_phys_rmcall_gr_raster_extra_value(void) +{ + return READ_ONCE(gsp_phys_rmcall_gr_raster_extra); +} + /* * 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 @@ -29834,6 +29861,8 @@ gr_page_unmapped: READ_ONCE(gsp_phys_rmcall_gr_sph_gs_mode); bool emit_raster = READ_ONCE(gsp_phys_rmcall_gr_raster_pre); + bool emit_raster_extra = + READ_ONCE(gsp_phys_rmcall_gr_raster_extra); u32 gs_addr = READ_ONCE(gsp_phys_rmcall_gr_sph_gs_addr); u32 gs_ctx = READ_ONCE(gsp_phys_rmcall_gr_sph_gs_ctx); @@ -30003,6 +30032,24 @@ gr_page_unmapped: (0x0e00u >> 2); in[nfin++] = 0u; } + /* + * SESSION 155 CONT 22: neutral blend/alpha/cull/ + * point/ZCULL state (see sema_gl_raster_extra). + */ + if (emit_raster_extra) { + static const u32 rxm[] = { + 0x12e4u, 0x1e00u, 0x12ecu, 0x1308u, + 0x1520u, 0x02e4u, 0x02e8u, 0x02fcu, + }; + u32 ri6; + + for (ri6 = 0; ri6 < 8u; ri6++) { + in[nfin++] = 0x20000000u | + (1u << 16) | + (rxm[ri6] >> 2); + in[nfin++] = 0u; + } + } /* * SESSION 153-CONTINUED-89: the client's init-push @@ -30067,7 +30114,8 @@ gr_page_unmapped: (emit_gsimg ? (9u + ((gs_mode & 1u) ? 11u : 0u) + ((gs_ctx & 1u) ? 2u : 0u) + ((gs_ctx & 2u) ? 2u : 0u)) : 0u) + - (emit_raster ? 17u : 0u) + (emit_raster ? 17u : 0u) + + (emit_raster_extra ? 16u : 0u) <= 96u) { /* * SESSION 155 CONT 9: pair_safe emits each diff --git a/kernel/gsp_phys_gpu.h b/kernel/gsp_phys_gpu.h index f74fff1..7de4fd5 100644 --- a/kernel/gsp_phys_gpu.h +++ b/kernel/gsp_phys_gpu.h @@ -380,6 +380,12 @@ bool gsp_phys_rmcall_gr_raster_pre_value(void); */ bool gsp_phys_rmcall_gr_stale_write_value(void); +/* + * SESSION 155 CONT 22: extra neutral raster state (blend/alpha/cull/point/ + * ZCULL) for replayed 3D windows. + */ +bool gsp_phys_rmcall_gr_raster_extra_value(void); + /* * SESSION 155 CONT 15: synthesized GS SPH placement/maps/context A/B. */ -- cgit v1.2.3