diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-15 17:36:50 -0500 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-11-15 17:36:50 -0500 |
| commit | dab4a02cdda99a37c412322680b17cceb1c518f1 (patch) | |
| tree | d7ef6b13790ccf6143dc0364c300e7daf3847f30 /kernel/gsp_phys_booter.c | |
| parent | ef2e68b9e64cb1ebffe49fc7dec7c821747b9aa6 (diff) | |
| download | open-iov-dab4a02cdda99a37c412322680b17cceb1c518f1.tar.gz open-iov-dab4a02cdda99a37c412322680b17cceb1c518f1.zip | |
vgsp: eng67 - synthesize a full-RT viewport for replayed beef 3D windows
c797 (engine ef2e68b9) DRAW-STATE on the release launch:
RT0/RT1 = alias 0xa000000, 1920x1080, fmt 0xe6; VS0 address
0x1e305dc bound; DRAW_IAB emitted its last vertex-array start
(0xd74=0x15); but the viewport SCALE/OFFSET methods 0xa00..0xa14
read 0 on the replay context (they are client channel state the
per-frame window never carries). Every vertex maps to (0,0), so the
8x3-vertex draws rasterize nothing and the 1025 tracked RT pages
stay 0.
sema_gl_viewport (default 0; params=1) emits a full-color-target
viewport before beef 3D windows: SCALE_X=+W/2, SCALE_Y=-H/2,
SCALE_Z=0.5, OFFSET_X=W/2, OFFSET_Y=H/2, OFFSET_Z=0.5 (IEEE bits
computed without FP; W/H from the RT0 method shadow, fallback
1920x1080). VIEWPORT receipt carries the emitted bit patterns.
Diffstat (limited to 'kernel/gsp_phys_booter.c')
| -rw-r--r-- | kernel/gsp_phys_booter.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index deb4e0a..607e947 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19936,6 +19936,25 @@ module_param_named(sema_gl_raster_prelude, gsp_phys_rmcall_gr_raster_pre, MODULE_PARM_DESC(sema_gl_raster_prelude, "Emit CT_WRITE(0..7)=0x1111 + depth/stencil/scissor disable ahead of replayed 3D windows (default 0; A/B)"); +/* + * eng67 DRAW-STATE finding (c797): the release launch has RT0/RT1 bound + * (alias 0xa000000, 1920x1080, fmt 0xe6), vertex stream 0 bound at + * 0x1e305dc and the DRAW_IAB emitted its 8x3-vertex draws (0xd74=0x15), + * but the viewport SCALE/OFFSET methods 0xa00..0xa14 are all zero on the + * replay context (they are client channel state the per-frame window never + * carries), so every vertex maps to (0,0) and no fragment reaches the RT. + * Emit a full-color-target viewport before the window, sized from the + * tracked RT0 width/height (fallback 1920x1080): + * 0xa00 SCALE_X = +W/2.0 0xa04 SCALE_Y = -H/2.0 + * 0xa08 SCALE_Z = 0.5 0xa0c OFFSET_X = W/2.0 + * 0xa10 OFFSET_Y = H/2.0 0xa14 OFFSET_Z = 0.5 + * Beef-family launches only (the direct-GL replay lane). Default 0 = off. + */ +static u32 gsp_phys_rmcall_gr_viewport; +module_param_named(sema_gl_viewport, gsp_phys_rmcall_gr_viewport, uint, 0644); +MODULE_PARM_DESC(sema_gl_viewport, + "Emit a full-RT viewport (0xa00..0xa14, W/H from the RT0 shadow, fallback 1920x1080) before replayed beef 3D windows; 0=off, 1=on (default 0; A/B)"); + bool gsp_phys_rmcall_gr_raster_pre_value(void) { return READ_ONCE(gsp_phys_rmcall_gr_raster_pre); @@ -32701,6 +32720,67 @@ gr_page_unmapped: in[nfin++] = 0u; } /* + * eng67: full-RT viewport for the replay context (see + * the sema_gl_viewport comment). The RT0 W/H come from + * the C597 method shadow (the client's last color + * target bind); a zero/implausible pair falls back to + * 1920x1080. Method writes are constant IMMD runs. + */ + if (READ_ONCE(gsp_phys_rmcall_gr_viewport) && + (req->h_object & 0xfffff000u) == 0xbeef0000u) { + void __iomem *vbar0 = gsp_phys_gpu_bar0(); + u32 rtw = vbar0 ? gsp_phys_mme_shadow_read( + vbar0, 0xc597u, 0x0808u) : 0u; + u32 rth = vbar0 ? gsp_phys_mme_shadow_read( + vbar0, 0xc597u, 0x080cu) : 0u; + u32 fx, fy, fy_off, fz = 0x3f000000u; /* 0.5f */ + + if (rtw < 16u || rtw > 16384u) + rtw = 1920u; + if (rth < 16u || rth > 16384u) + rth = 1080u; + /* + * IEEE-754 bits without FP: V = W/2 (rounded), + * then e = floor(log2 V), mantissa = V<<(23-e). + */ + { + u32 vx = (rtw + 1u) >> 1; + u32 vy = (rth + 1u) >> 1; + int ex = 31 - __builtin_clz(vx); + int ey = 31 - __builtin_clz(vy); + + fx = (((u32)(ex + 127)) << 23) | + ((vx << (23 - ex)) & 0x7fffffu); + fy = 0x80000000u | + (((u32)(ey + 127)) << 23) | + ((vy << (23 - ey)) & 0x7fffffu); + fy_off = (((u32)(ey + 127)) << 23) | + ((vy << (23 - ey)) & + 0x7fffffu); + } + in[nfin++] = 0x20000000u | (1u << 16) | + (0x0a00u >> 2); + in[nfin++] = fx; + in[nfin++] = 0x20000000u | (1u << 16) | + (0x0a04u >> 2); + in[nfin++] = fy; + in[nfin++] = 0x20000000u | (1u << 16) | + (0x0a08u >> 2); + in[nfin++] = fz; + in[nfin++] = 0x20000000u | (1u << 16) | + (0x0a0cu >> 2); + in[nfin++] = fx; + in[nfin++] = 0x20000000u | (1u << 16) | + (0x0a10u >> 2); + in[nfin++] = fy_off; /* OFFSET_Y = +H/2 */ + in[nfin++] = 0x20000000u | (1u << 16) | + (0x0a14u >> 2); + in[nfin++] = fz; + pr_info_ratelimited("vgsp-gr: VIEWPORT emitted %ux%u scale_bits=%08x,%08x offset_bits=%08x,%08x h=0x%x push=0x%llx\n", + rtw, rth, fx, fy, fx, fy_off, + req->h_object, req->push_va); + } + /* * SESSION 155 CONT 22: neutral blend/alpha/cull/ * point/ZCULL state (see sema_gl_raster_extra). */ |
