summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_sema_service.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 7eb67ae..b80a397 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -11853,6 +11853,24 @@ module_param_named(sema_gl_chunk_words, svc_gl_chunk_words_param, uint, 0644);
MODULE_PARM_DESC(sema_gl_chunk_words,
"3D stream chunk size in words for the chunked verbatim replay (0 = built-in 384)");
#define SVC_GL_STREAM_CHUNK_WORDS 384u
+/*
+ * Strict in-order replay (default 0 = historical forced-draw-first).
+ *
+ * The client's method stream is order-dependent: a CALL_MME_MACRO run is
+ * followed by the DATA/argument runs it consumes, and the preceding runs
+ * set the state it reads. Forcing the draw-bearing slice to launch first
+ * (the historical behaviour) executes that CALL before its own argument
+ * runs and before the window's state, which is exactly the class of
+ * poison (MME HWW badf1201 pc=513) seen on the real GZDoom draw stream.
+ * With the candidate ring large enough that a chunk is no longer evicted
+ * (eng89m), the ordering workaround is no longer needed: replay the
+ * admitted window in its original order. Kept as a runner-settable knob
+ * so the old ordering remains available for A/B sessions.
+ */
+static unsigned svc_gl_stream_inorder;
+module_param_named(sema_gl_stream_inorder, svc_gl_stream_inorder, uint, 0644);
+MODULE_PARM_DESC(sema_gl_stream_inorder,
+ "Replay a chunked 3D window strictly in window order (1) instead of draw-slice-first (0, default)");
static u32 svc_gl_chunk_boundary(const u8 *buf, u32 len, u32 start,
u32 at_off, u32 max_words)
@@ -12212,8 +12230,13 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
* slice starts at its header and contains its full op span.
* A chunk that would straddle the draw is cut before it; the
* next iteration starts exactly at the run header.
+ *
+ * sema_gl_stream_inorder: skip both the cut and the forced
+ * first launch; the chunk that happens to contain the draw
+ * is only marked for the receipt, and every slice keeps the
+ * FIFO stamp of its position in the window.
*/
- if (have_draw) {
+ if (!READ_ONCE(svc_gl_stream_inorder) && have_draw) {
if (cur < draw_at && draw_at < end) {
end = draw_at;
} else if (cur == draw_at) {
@@ -12227,6 +12250,8 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
end = dend;
is_draw = true;
}
+ } else if (have_draw && draw_at >= cur && draw_at < end) {
+ is_draw = true;
}
rel = (cur - svc_gl.start_off) / 4u;
nw = (end - cur) / 4u;
@@ -12257,10 +12282,13 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
}
if (have) {
/* eng89o: a re-decode must keep the draw slice's
- * forced-first identity, not just its bytes. */
+ * forced-first identity, not just its bytes.
+ * sema_gl_stream_inorder drops that identity so
+ * the replay stays in window order. */
if (is_draw) {
svc_gr_cand_ring[ri].draw_slice = true;
- svc_gr_cand_ring[ri].order = 0;
+ if (!READ_ONCE(svc_gl_stream_inorder))
+ svc_gr_cand_ring[ri].order = 0;
}
n++;
cur = end;
@@ -12300,7 +12328,7 @@ static void svc_gl_stream_chunks(struct svc_channel *ch, const u8 *buf,
* the window; the receipt then shows draw=1 on that launch.
*/
c->draw_slice = is_draw;
- if (is_draw)
+ if (is_draw && !READ_ONCE(svc_gl_stream_inorder))
c->order = 0;
c->valid = true;
c->offered = false;