summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_sema_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_sema_service.c')
-rw-r--r--kernel/gsp_sema_service.c110
1 files changed, 104 insertions, 6 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index ad99397..7eb67ae 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -11953,6 +11953,20 @@ static bool svc_gl_mismatch_new_push(u64 push_va)
return true;
}
+/*
+ * eng89s: the real direct-GL draw markers. The 570.144 client encodes the
+ * draw as CALL_MME_MACRO(0): an IMMD (op 4) write to method 0x3800 whose
+ * immediate is the macro program length (c1022: hdr 0x8d480e00, m=0x3800,
+ * imm=0xd48=3400), followed by CALL slots 44/57/58 as ONE_INC runs to
+ * 0x3960 / 0x39c8 / 0x39d0. The older DRAW_IAB slots 34 (0x3910 macro /
+ * 0x3914 data) stay accepted for the lanes that use them.
+ */
+static bool svc_gl_draw_method(u32 m)
+{
+ return m == 0x3800u || m == 0x3910u || m == 0x3914u ||
+ m == 0x3960u || m == 0x39c8u || m == 0x39d0u;
+}
+
static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word,
u32 *at, u32 *span_out, u32 *runs_out,
bool log_it, struct svc_channel *ch, u64 push_va)
@@ -11988,7 +12002,7 @@ static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word,
if (k && !incr)
break;
m = m0 + 4u * k;
- if (m != 0x3910u && m != 0x3914u)
+ if (!svc_gl_draw_method(m))
continue;
if (!found) {
*at = r;
@@ -12001,6 +12015,23 @@ static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word,
ch->h_object, push_va,
base_word + r, m, op, cnt, span);
}
+ /*
+ * eng89s: the CALL(0) marker is an IMMD: its argument is
+ * the header's immediate, not a following data word.
+ */
+ if (m == 0x3800u) {
+ if (log_it && svc_gl_draw_write_log < 16u) {
+ u32 data = op == 4u ? cnt :
+ (k + 1u < span ?
+ win[r + k + 1u] : 0u);
+
+ svc_gl_draw_write_log++;
+ pr_info("sema-gl: DRAW-WRITE h=0x%x push=0x%llx m=0x3800 op=%u data=0x%x at=%u run=%u\n",
+ ch->h_object, push_va, op, data,
+ r + k, r);
+ }
+ continue;
+ }
/* eng89r: the write word and its data word, bounded
* 16 per push. `at`/`run` are window words. */
if (log_it && svc_gl_draw_write_log < 16u &&
@@ -12364,12 +12395,13 @@ static bool svc_gl_chunk_has_draw_ia(const u32 *win, u32 n)
if ((op <= 3u || op == 5u) && cnt && r + 1u + cnt <= n)
span = 1u + cnt;
- /* eng89r: interior methods again (see svc_gl_draw_walk). */
+ /* eng89r: interior methods again (see svc_gl_draw_walk).
+ * eng89s: the real draw is CALL(0) (0x3800, op 4 IMMD) with
+ * 0x3960/0x39c8/0x39d0 as the slot 44/57/58 secondaries. */
for (k = 0; k < span; k++) {
if (k && !incr)
break;
- if (m0 + 4u * k == 0x3910u ||
- m0 + 4u * k == 0x3914u)
+ if (svc_gl_draw_method(m0 + 4u * k))
return true;
}
r += span;
@@ -12744,6 +12776,11 @@ static bool svc_gl_win_has_draw_legacy(const u8 *buf, u32 len)
* r + (0x3910 - 0x804)/4). Walk every method the run reaches
* (m0 + 4*k, k<span), exactly the pre-eng89p admission that admitted the
* real windows; eng89p's header-only gate rejected all of them.
+ *
+ * eng89s: the real 570.144 direct-GL draw is CALL_MME_MACRO(0) - an IMMD
+ * (op 4) write to 0x3800 whose immediate is the macro program length
+ * (c1022: 0x8d480e00 imm=0xd48=3400) - with CALL slots 44/57/58
+ * (0x3960/0x39c8/0x39d0) as secondaries. The old DRAW_IAB slots stay.
*/
static bool svc_gl_win_has_draw(const u8 *buf, u32 len)
{
@@ -12766,8 +12803,7 @@ static bool svc_gl_win_has_draw(const u8 *buf, u32 len)
for (k = 0; k < span; k++) {
if (k && !incr)
break;
- if (m0 + 4u * k == 0x3910u ||
- m0 + 4u * k == 0x3914u)
+ if (svc_gl_draw_method(m0 + 4u * k))
return true;
}
r += span;
@@ -12775,6 +12811,47 @@ static bool svc_gl_win_has_draw(const u8 *buf, u32 len)
return false;
}
+/*
+ * eng89s: admission predicate for the real draw. The real direct-GL draw
+ * window carries the CALL(0) IMMD but no colour-target bind of its own
+ * (c1022: no 0x800/0x804/0x808/0x80c write in the 2617-word window, and
+ * no persisted bind on the channel), so every RT clause can miss. Accept
+ * the CALL(0) marker only when its immediate is a plausible macro program
+ * length, so a data word that happens to decode as op=4/0x3800 cannot
+ * admit a blob.
+ *
+ * Scan the ADMITTED WINDOW, not the whole push: the push's pre-window data
+ * can contain a run header whose span covers the window head (c1023 push
+ * 0x402f9d8: word 316 decodes op=0 cnt=1059 and swallows words 400..1459,
+ * hiding the real CALL(0) at word 655 from a from-zero walk).
+ */
+static bool svc_gl_win_has_draw_call0(const u8 *buf, u32 len, u32 start_off,
+ u32 at_off)
+{
+ const u32 *win = (const u32 *)buf;
+ u32 n, r, end;
+
+ if (!buf || start_off >= at_off || at_off > len)
+ return false;
+ r = start_off / 4u;
+ end = at_off / 4u;
+ n = len / 4u;
+ while (r < end && r < n) {
+ u32 h = win[r];
+ u32 op = (h >> 29) & 7u;
+ u32 cnt = (h >> 16) & 0x1fffu;
+ u32 span = 1u;
+ u32 m0 = (h & 0xfffu) << 2;
+
+ if ((op <= 3u || op == 5u) && cnt && r + 1u + cnt <= end)
+ span = 1u + cnt;
+ if (op == 4u && m0 == 0x3800u && cnt >= 0x100u)
+ return true;
+ r += span;
+ }
+ return false;
+}
+
static void svc_gl_rt_note(const u8 *buf, u32 len, u64 h, u64 push)
{
u32 A[4] = { 0 }, B[4] = { 0 }, W[4] = { 0 }, H[4] = { 0 };
@@ -12893,6 +12970,27 @@ static bool svc_gl_window_drawwin_ok(const u8 *buf, u32 len, u32 start_off,
return true;
}
/*
+ * eng89s: the real draw window carries the CALL(0) marker but no
+ * colour-target bind of its own (c1022: RT-SCAN found no 0x800..0x80c
+ * write and no bind was persisted on the channel), so every clause
+ * above misses and the window fell to the compute-QMD lane. The
+ * op=4 CALL(0) with a plausible macro-program length is the primary
+ * draw marker of this lane; admit on it. The caller still enforces
+ * the raw/geometry gates before streaming.
+ */
+ if (svc_gl_win_has_draw_call0(buf, len, start_off, at_off)) {
+ static u32 call0_adm_log;
+
+ if (call0_adm_log < 16u) {
+ call0_adm_log++;
+ pr_info("sema-gl: 3D mark admitted (CALL(0) 0x3800 draw marker) start=0x%x at=0x%x win=%u words\n",
+ start_off, at_off,
+ at_off > start_off ?
+ (at_off - start_off) / 4u : 0u);
+ }
+ return true;
+ }
+ /*
* eng89: the draw window usually carries no bind of its own (the
* target was bound by an earlier state push). Admit on the
* persisted bind when one is known; the replay context's RT state