summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/gsp_sema_service.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 140e8e7..8cc7aaa 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -12231,22 +12231,33 @@ static bool svc_gl_win_has_draw(const u8 *buf, u32 len)
if (!buf)
return false;
for (i = 0; i + 4u <= len; i += 4u) {
- u32 w, op, m;
+ u32 w, op, cnt, m;
memcpy(&w, buf + i, 4);
op = (w >> 29) & 7u;
+ cnt = (w >> 16) & 0xfffu;
+ m = (w & 0x1fffu) << 2;
/*
* The client encodes these real draw markers as different
* run forms: CALL_MME_MACRO(34) 0x3910 arrives as ONE_INCR
- * (op 5, header 0xa00a0e44) and BEGIN 0x1618 as an immd13
- * (op 4). Accept the method-stream ops rather than only the
- * INC form; data words that alias these methods are rare and
- * the per-window bind validity is not required on this path.
- */
- if (op != 1u && op != 3u && op != 4u && op != 5u)
- continue;
- m = (w & 0x1fffu) << 2;
- if (m == 0x1618u || m == 0x0d78u || m == 0x3910u)
+ * (op 5, header 0xa00a0e44), BEGIN 0x1618 as an immd13 (op 4)
+ * or inside a multi-method INC run (c940-c945: VP-METHOD
+ * 0x1618 op=1 in push 0x400108c while has_draw stayed 0).
+ * Accept the method-stream ops and a marker covered by the
+ * run's method span (+4 for the parser's first-data-word
+ * convention); data words that alias these methods are rare
+ * and the per-window bind validity is not required here.
+ */
+#define SVC_GL_MARK_COVERED(m, cnt, t) \
+ ((m) <= (t) && (t) < (m) + (cnt) * 4u + 4u)
+ if ((op == 1u || op == 3u || op == 5u) && cnt &&
+ (SVC_GL_MARK_COVERED(m, cnt, 0x1618u) ||
+ SVC_GL_MARK_COVERED(m, cnt, 0x0d78u) ||
+ SVC_GL_MARK_COVERED(m, cnt, 0x3910u)))
+ return true;
+#undef SVC_GL_MARK_COVERED
+ if ((op == 1u || op == 3u || op == 4u || op == 5u) &&
+ (m == 0x1618u || m == 0x0d78u || m == 0x3910u))
return true;
}
return false;