summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-06 21:36:02 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-06 21:36:02 -0500
commit0aec62b805c493a4200d2e8edf4e46c90890fd55 (patch)
tree6001ab61e121814762f58407b50ba272a00be02c /kernel/gsp_phys_booter.c
parenteca8e29dcaf4d31ba0f97518d0b408c3e79412cb (diff)
downloadopen-iov-0aec62b805c493a4200d2e8edf4e46c90890fd55.tar.gz
open-iov-0aec62b805c493a4200d2e8edf4e46c90890fd55.zip
vgsp-gl: raster-enable prelude (CT_WRITE/depth/stencil/scissor) + DS reset fix
Diffstat (limited to 'kernel/gsp_phys_booter.c')
-rw-r--r--kernel/gsp_phys_booter.c68
1 files changed, 65 insertions, 3 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 213aa22..0fc2ee7 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -5634,7 +5634,14 @@ static bool gsp_phys_mme_fast_sample(void __iomem *bar0, const char *tag,
u32 esr = ioread32(bar0 + 0x00405840u);
if (esr) {
- iowrite32(esr, bar0 + 0x00405840u);
+ /*
+ * SESSION 155 CONT 14: RESET (bit30, RESET_TASK)
+ * must be set with the W1C clears so the HWW
+ * latch is actually reset (reference-RM idiom);
+ * without it the per-draw attribution is unsound.
+ */
+ iowrite32(esr | 0x40000000u,
+ bar0 + 0x00405840u);
if (ds_post_log < 24u) {
ds_post_log++;
pr_info("vgsp-gr: DS-ESR post-clear=%08x h=0x%x tag=%s\n",
@@ -18680,6 +18687,32 @@ u32 gsp_phys_rmcall_gr_sph_gs_mode_value(void)
{
return READ_ONCE(gsp_phys_rmcall_gr_sph_gs_mode);
}
+
+/*
+ * SESSION 155 CONT 14: raster-enable prelude. The client's per-frame 3D
+ * window carries no SET_CT_WRITE / SET_DEPTH_TEST / SET_DEPTH_WRITE /
+ * SET_STENCIL_TEST / SET_SCISSOR_ENABLE - those are channel state on the
+ * client's own channel - so the replay channel keeps the hardware
+ * defaults. If CT_WRITE defaults to 0 every rasterized fragment is
+ * discarded and the surface stays black even though the draw executes.
+ * Emit the safe render-enable state ahead of each replayed 3D window:
+ * SET_CT_WRITE(0..7) 0x1a00+i*4 <- 0x1111 (R|G|B|A write enable)
+ * SET_DEPTH_TEST 0x12cc <- 0
+ * SET_DEPTH_WRITE 0x12e8 <- 0
+ * SET_STENCIL_TEST 0x1380 <- 0
+ * SET_SCISSOR_ENABLE(0) 0x0e00 <- 0
+ * Default 0 = legacy bytes (A/B).
+ */
+static bool gsp_phys_rmcall_gr_raster_pre;
+module_param_named(sema_gl_raster_prelude, gsp_phys_rmcall_gr_raster_pre,
+ bool, 0644);
+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)");
+
+bool gsp_phys_rmcall_gr_raster_pre_value(void)
+{
+ return READ_ONCE(gsp_phys_rmcall_gr_raster_pre);
+}
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 */
@@ -21279,7 +21312,8 @@ if (gsp_phys_gr_slot_kept(j, sa_mask,
u32 esr = ioread32(ds_bar0 + 0x00405840u);
if (esr)
- iowrite32(esr, ds_bar0 + 0x00405840u);
+ iowrite32(esr | 0x40000000u,
+ ds_bar0 + 0x00405840u);
if (ds_mask_log < 24u) {
ds_mask_log++;
pr_info("vgsp-gr: DS-ESR pre-clear=%08x (prev window's latch; this window starts clean) h=0x%x push=0x%llx\n",
@@ -29740,6 +29774,8 @@ gr_page_unmapped:
READ_ONCE(gsp_phys_rmcall_gr_sph_gs_img);
u32 gs_mode =
READ_ONCE(gsp_phys_rmcall_gr_sph_gs_mode);
+ bool emit_raster =
+ READ_ONCE(gsp_phys_rmcall_gr_raster_pre);
/*
* SESSION 155 CONT 9: the prelude is prepended ahead of
@@ -29882,6 +29918,31 @@ gr_page_unmapped:
(0x1128u >> 2);
in[nfin++] = 0xffffffffu;
in[nfin++] = 0xffffffffu;
+ /*
+ * SESSION 155 CONT 14: the render-enable state the
+ * client's channel carried from its init push
+ * (see the sema_gl_raster_prelude comment).
+ */
+ if (emit_raster) {
+ u32 ri5;
+
+ in[nfin++] = 0x20000000u | (8u << 16) |
+ (0x1a00u >> 2);
+ for (ri5 = 0; ri5 < 8u; ri5++)
+ in[nfin++] = 0x1111u;
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x12ccu >> 2);
+ in[nfin++] = 0u;
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x12e8u >> 2);
+ in[nfin++] = 0u;
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x1380u >> 2);
+ in[nfin++] = 0u;
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x0e00u >> 2);
+ in[nfin++] = 0u;
+ }
/*
* SESSION 153-CONTINUED-89: the client's init-push
@@ -29943,7 +30004,8 @@ 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)) : 0u) +
+ (emit_raster ? 17u : 0u)
<= 96u) {
/*
* SESSION 155 CONT 9: pair_safe emits each