[Feat] (MG_Remote): a record can tell the server its answer will never be read - the bit works and cuts a frame's replies by 92%, and it proves the window's real blocker is the FIFO drain, not the pool depth

The create window could not collect its deferred answers. The previous commit
diagnosed that as the reply pool being 8 slots deep against 55,903 replies in one
frame, and left a no-reply bit as the way out. This lands that bit, measures it on
the device, and reports that the diagnosis was half wrong.

WHAT LANDED. ClientSession::EmitAndWaitTails takes a second question beside
wantReply: willReadReply. They are not the same question and the window is the case
that separates them - it emits with wantReply=false and READS the answer later, so
its records must still be answered. kRecNoReply (RingRecordFlags bit 5, which
aliases kOptional in the call-flag space; the flag-space asserts were extended and
the alias named) is stamped when willReadReply is false, and the decoder skips
PostReply while keeping every acceptance counter - "nobody reads the answer" is not
"nothing happened". The two illegal combinations are Fatal by name.

Three call sites say it: SetTextureParams for a confirmed object, the respecify
row's fire-and-forget half, and sub-data where MGPipeSubDataWantsItsReply decides.

MEASURED ON THE DEVICE (aikjs4s8cys8ba7l, rebuilt APK + client, both halves new):
    server:  skipped=50,001   answered=4,521        (a frame's replies: 55,903 -> 4,543)
    client:  Reply frames received seen=4,501, latest seq=97,181
    frame-sent: identical per op, records untouched
    create row: by_op 2 = 9,070 (was 4,536)  - because the drain's blocking take is
               now counted, so the row's number stays honest instead of reading as
               "create stopped waiting" while the waiting merely moved
AND THE WINDOW STILL READ BACK NOTHING: readfail 8,951 -> 8,872, i.e. -0.9%.

THE REAL CAUSE, from the miss probe:
    P12miss n=1     want=310 replySeq=1504   ring=[1175..1504]
    P12miss n=9001  want=310 replySeq=102915 ring=[102866..102915]
want=310 every time. The drain is STRICTLY FIFO and a failed read has no way out -
it retries the same head for ever. Any reply buffer is bounded by design (8 pool
slots, or the 8-frame ring the stream link now keeps), so with 4,536 deferred
answers at least one is overwritten before it is read, and that one wedges the
window permanently. Cutting the churn by two orders of magnitude does not help: it
turns a certainty into a certainty. That is the constraint, not the depth.

THE FIX IS NAMED AND NOT TAKEN (the goal this work ran under stops here on purpose).
On a failed read of the head, abandon it: MGPipeNoteHandleUnpublished +
NoteCreateSuspect + pop - the DECLINE path reused for "unknown". The window then
self-heals through the blocking path and the object merely gets slower. It needs its
own gate: a failed read must let the window ADVANCE.

Gates, all green (172 + 13 + 22 + 103):
  PipeWireCodecTest.TheNoReplyBitSkipsTheAnswerAndKeepsTheAcceptanceRecord - the skip,
    the kept tally, the answered/skipped split, and the negative control that a record
    WITHOUT the bit is still answered (a server that stopped answering everything
    would otherwise pass)
  RemoteClientControls.ACreateWindowDefersTheAnswersAndTheWindowOffDoesNot - now also
    asserts the answers CAME BACK (answers_taken=11, outstanding=1, fallbacks=0 against
    12 records). RED-ONCE PROVED: giving the window's creates the literal
    "fire-and-forget => skip" predicate makes this case fail.
  RingTest - the sixth and last flag alias, and the hand-written exhaustiveness list
    extended (with a note that it is only as exhaustive as that list).
  Server side: AnsweredRecords()/SkippedAnswers() - the number that made this
    debuggable, since a wire change whose effect is invisible is undebuggable.

Client-first is safe: an old server ignores bit 5 and replies as before, so the two
cross-version directions degrade to today's behaviour - this is "both ends must
upgrade to take EFFECT", not "to avoid breaking". Hit that in practice first.
This commit is contained in:
BZLZHH
2026-09-26 02:00:44 +08:00
parent 7c822cdc85
commit 4e48702f26
77 changed files with 270328 additions and 23 deletions
+19 -2
View File
@@ -1801,7 +1801,7 @@ namespace MobileGL::MG_Remote::Client {
Uint64 payloadBytes, const Wire::WireTail* tails,
Uint32 tailCount, void* replyOut, Uint64 replyBytes,
Int32* statusOut, Uint64* replySizeOut,
Bool wantReply) {
Bool wantReply, Bool willReadReply) {
Uint64 varTailBytes = 0;
for (Uint32 i = 0; i < tailCount; ++i) varTailBytes += tails[i].Size;
if (statusOut != nullptr) *statusOut = Wire::ReplySink::kStatusError;
@@ -1838,7 +1838,24 @@ namespace MobileGL::MG_Remote::Client {
const Bool rowCarriesReplySlot =
(MG_Pipe::MGPipeCallFlagsFor(op) & static_cast<Uint32>(MG_Pipe::kReplySlot)) != 0;
const Bool ownsReplySlot = rowCarriesReplySlot && wantReply;
Uint64 seq = m_encoder.EncodeRecord(op, payload, payloadBytes, tails, tailCount);
// P12: THE SKIP THE SERVER MAY TAKE, and the two ways a caller may not ask for it. See
// the declaration in ClientSession.h - the create window is why wantReply is not the
// question, and a Fatal rather than an assert because both mistakes are silent: one
// blocks on an answer nobody will send, the other discards an answer that never existed.
if (wantReply && !willReadReply) {
SessionFail(MGFatalFamily::ReplyError, "MGPipe: Fatal{ReplyError, \"%s\"} - the caller asked to"
" block on this record's answer AND declared that nobody will read it; the server"
" would skip the answer this call is about to wait for",
Wire::WireOpName(op));
}
if (!willReadReply && !rowCarriesReplySlot) {
SessionFail(MGFatalFamily::ReplyError, "MGPipe: Fatal{ReplyError, \"%s\"} - the caller declared this"
" record's answer unread, but the row carries no reply slot: there was no answer to"
" skip, so the declaration is a mistake about which row this is",
Wire::WireOpName(op));
}
const Bool skipAnswer = rowCarriesReplySlot && !willReadReply;
Uint64 seq = m_encoder.EncodeRecord(op, payload, payloadBytes, tails, tailCount, skipAnswer);
if (seq == Wire::kInvalidSeq) {
if (DeviceLost() || m_encoder.Cancelled()) return declineCancelled();
// EncodeRecord already refused individually oversized records. This one fits,
+20 -1
View File
@@ -211,7 +211,26 @@ namespace MobileGL::MG_Remote::Client {
Uint64 EmitAndWaitTails(MG_Pipe::MGPWireOp op, const void* payload, Uint64 payloadBytes,
const Wire::WireTail* tails, Uint32 tailCount, void* replyOut,
Uint64 replyBytes, Int32* statusOut,
Uint64* replySizeOut = nullptr, Bool wantReply = true);
Uint64* replySizeOut = nullptr, Bool wantReply = true,
Bool willReadReply = true);
// `willReadReply` (P12) and `wantReply` ARE TWO QUESTIONS AND MUST STAY TWO.
//
// wantReply does THIS CALL read the answer (it blocks on the barrier and takes the
// reply slot before returning);
// willReadReply will the answer be read AT ALL - now, or later by somebody else.
//
// The create window is the case that makes the difference load-bearing: it emits with
// wantReply=false and its answers are read afterwards by the window's drain, so a record
// it emits must still be ANSWERED. Only willReadReply=false tells the server it may skip
// the answer (Transport::kRecNoReply), and only three sites may say it: the parameter row
// for a confirmed object, the respecify row's fire-and-forget half, and the sub-data row
// - each of which answers its own caller locally and reads nothing from the wire.
//
// THE TWO ILLEGAL COMBINATIONS ARE FATAL BY NAME rather than ignored, because both would
// fail silently in opposite directions: wantReply && !willReadReply is a caller blocking
// on an answer it has just told the server not to send, and !willReadReply on a row with
// no reply slot is a caller discarding an answer that never existed.
// MOBILEGL_IPC_VERB_BARRIER. False is the R-1 negative control and is EXPECTED to be
// red; it must be run once and the way it goes red recorded.
+55 -6
View File
@@ -54,6 +54,8 @@
// P12: kDefaultReplySlotCount, because the create window's ceiling is derived from the pool it
// shares rather than from a number written twice (see kCreateWindowMax below).
#include <MG_Remote/Transport/ReplySlot.h>
// P12: LinkMetricsBeginReply/ReplyApplied, so the window's blocking take is visible in by_op 2.
#include <MG_Remote/Transport/LinkMetrics.h>
#include <atomic>
#include <cstdlib>
@@ -343,6 +345,20 @@ namespace MobileGL::MG_Remote::Client {
// readfail=8,951, pending pinned at 4. The drain READ the window's answers back and failed
// every time.
//
// ---- AND THE DIAGNOSIS BELOW WAS HALF WRONG; READ THIS FIRST ----------------------
//
// The arithmetic that follows is real and the no-reply bit it motivated WORKS (measured:
// the server skipped 50,001 answers and wrote 4,521, cutting a frame's replies by 92%).
// IT DID NOT FIX THE WINDOW: the drain still read back nothing (readfail 8,951 -> 8,872,
// -0.9%). The binding constraint is not how fast the bounded buffer is overwritten but
// that the drain is STRICTLY FIFO AND HAS NO WAY OUT OF A FAILED READ: it retries the
// same head for ever. Measured on the device (P12miss): `want=310` on every miss while
// `replySeq` climbed from 1,504 to 102,915 - one answer lost to a bounded buffer wedges
// the window permanently, and with 4,536 deferred answers that is a certainty rather
// than a risk. notes/p12/CREATE-WINDOW-MEASURED.md section 8 has the numbers and the
// shape of the fix (abandon the head: un-latch the object, add it to the suspect list,
// and pop - the DECLINE path reused for "unknown").
//
// WHY, IN THE PROTOCOL'S OWN ARITHMETIC. An answer is readable only until its reply-pool
// slot is reused, and the pool is kDefaultReplySlotCount = 8 slots deep. The frame posts a
// reply for EVERY reply-owning record - not only for the rows that wait, because the server
@@ -405,6 +421,13 @@ namespace MobileGL::MG_Remote::Client {
Uint32 g_createWindowHead = 0;
Uint32 g_createWindowCount = 0;
Uint64 g_createRefusals = 0;
// How many deferred answers the window has actually TAKEN BACK, which is the one number
// that says the deferral worked rather than merely happened. It is not inferable from the
// others: `pending` staying at the ceiling is consistent BOTH with a drain that collects
// one per create and with a drain that collects nothing while a server-skip keeps the
// answers from existing at all - the second is what a no-reply bit keyed on wantReply
// would produce, and it would leave every other reading green.
Uint64 g_createWindowTaken = 0;
// A HANDLE WHOSE CREATE CAME BACK DECLINED IS NEVER WINDOWED AGAIN. Without this the window
// would UNDO the repair it exists to keep: every later use of the object sends another create,
@@ -459,8 +482,19 @@ namespace MobileGL::MG_Remote::Client {
Bool blocking = blockForOldest;
while (g_createWindowCount != 0) {
const PendingCreate head = g_createWindow[g_createWindowHead];
// THE WAIT THIS ROW PAYS IS PAID HERE (P12), so the metric has to see it HERE.
// Without this, by_op 2 counts only the fallback emissions and a WORKING window
// reads as "create stopped waiting" when the row had merely moved the waiting
// into this loop - the false green the design review named. Counted for the
// blocking take only: the poll is not a round trip, and it is the blocking take
// that is the thing MOBILEGL_IPC_CREATE_WINDOW divides (4,536 -> creates/window).
const Uint64 metricStart =
blocking ? Transport::LinkMetricsBeginReply(
true, static_cast<std::uint32_t>(MGPWireOp::ResourceCreate))
: 0;
const Transport::SessionWait wait =
session.WaitForApplied(head.Seq, blocking ? 120000u : 0u);
if (blocking) Transport::LinkMetricsReplyApplied(metricStart);
if (wait != Transport::SessionWait::Reached) return;
Int32 status = Wire::ReplySink::kStatusError;
Uint64 size = 0;
@@ -486,6 +520,7 @@ namespace MobileGL::MG_Remote::Client {
}
g_createWindowHead = (g_createWindowHead + 1) % kCreateWindowMax;
--g_createWindowCount;
++g_createWindowTaken;
blocking = false;
}
}
@@ -546,9 +581,13 @@ namespace MobileGL::MG_Remote::Client {
}
}
Int32 status = Wire::ReplySink::kStatusError;
const Uint64 seq =
session.EmitAndWaitTails(MGPWireOp::ResourceCreate, payload, sizeof(*payload), nullptr,
0, nullptr, 0, &status, nullptr, /*wantReply=*/false);
// willReadReply IS TRUE AND THAT IS THE WHOLE POINT OF THE WINDOW: this record does
// not wait for its answer, and the drain above reads it later. A P12 no-reply bit
// keyed on wantReply would tell the server to skip the very answer this row comes
// back for (docs/.../p12/CREATE-WINDOW-MEASURED.md section 7).
const Uint64 seq = session.EmitAndWaitTails(
MGPWireOp::ResourceCreate, payload, sizeof(*payload), nullptr, 0, nullptr, 0,
&status, nullptr, /*wantReply=*/false, /*willReadReply=*/true);
if (seq == Wire::kInvalidSeq) {
// Cancelled: there is no ordinal to read an answer from, and the caller must NOT
// latch an object the record never described.
@@ -596,7 +635,7 @@ namespace MobileGL::MG_Remote::Client {
if (confirmed) {
seq = session.EmitAndWaitTails(MGPWireOp::SetTextureParams, payload, sizeof(*payload),
nullptr, 0, nullptr, 0, &status, nullptr,
/*wantReply=*/false);
/*wantReply=*/false, /*willReadReply=*/false);
status = seq == Wire::kInvalidSeq ? Wire::ReplySink::kStatusDeclined
: Wire::ReplySink::kStatusOk;
} else {
@@ -642,7 +681,13 @@ namespace MobileGL::MG_Remote::Client {
const Uint64 seq = session.EmitAndWaitTails(
MGPWireOp::ResourceSubData, &record, sizeof(record),
varTail != nullptr ? &tail : nullptr, varTail != nullptr ? 1u : 0u, nullptr, 0,
&status, nullptr, wantReply);
&status, nullptr, wantReply,
// ONE ANSWER TO BOTH QUESTIONS, and on this row that is not a shortcut: the
// wire arm's MGPipeSubDataWantsItsReply is false for the whole texture half
// (PipeRoute.h), the caller discards the Bool either way, and the record's own
// comment above already says "nothing reads it". A buffer-half caller that DID
// read it would pass wantReply=true and get its answer.
wantReply);
// Cancellation has no wire ordinal; retain the caller's nonzero local ticket.
if (seq != Wire::kInvalidSeq) reply->Id = seq;
const Int32 postedStatus = (seq == Wire::kInvalidSeq || status == Wire::ReplySink::kStatusDeclined)
@@ -726,7 +771,7 @@ namespace MobileGL::MG_Remote::Client {
if (!wantsReply) {
const Uint64 seq = session.EmitAndWaitTails(
MGPWireOp::ResourceRespecify, &record, sizeof(record), nullptr, 0, nullptr, 0,
&status, nullptr, /*wantReply=*/false);
&status, nullptr, /*wantReply=*/false, /*willReadReply=*/false);
status = seq == Wire::kInvalidSeq ? Wire::ReplySink::kStatusDeclined
: Wire::ReplySink::kStatusOk;
} else {
@@ -1167,6 +1212,10 @@ namespace MobileGL::MG_Remote::Client {
// against the effective ceiling and the array size, which are the two numbers the guard itself
// is written in terms of, and not against a literal repeated in the test.
Uint32 ClientCreateWindowPending() { return g_createWindowCount; }
// Taken + Pending is every create the window ever accepted: the answers it has read back and
// the ones still outstanding. A create the window accepted and then LOST would break that
// sum, which is the failure a provisional accept makes possible and a count cannot show.
Uint64 ClientCreateWindowTaken() { return g_createWindowTaken; }
Uint32 ClientCreateWindowEffective() { return CreateWindowEffective(); }
Uint32 ClientCreateWindowArraySize() { return kCreateWindowMax; }
// Objects whose create came back DECLINED: out of the window, next create blocking, and back
+4
View File
@@ -87,6 +87,10 @@ namespace MobileGL::MG_Remote::Client {
// clamped to the array), the array's own size, and the two tallies - objects whose create came
// back DECLINED and are therefore out of the window, and how many refusals there have been.
Uint32 ClientCreateWindowPending();
// How many deferred answers the window has read back. THE NUMBER THAT SAYS IT WORKED: a
// drain that never collects leaves Pending at the ceiling and every other reading unchanged,
// which is exactly what the device measured before the stream link learned to answer by seq.
Uint64 ClientCreateWindowTaken();
Uint32 ClientCreateWindowEffective();
Uint32 ClientCreateWindowArraySize();
Uint32 ClientCreateWindowSuspects();
+11
View File
@@ -283,6 +283,17 @@ namespace MobileGL::MG_Remote::Transport {
kRecPad = 1u << 2, // filler to the wrap boundary, no payload meaning
kRecBorrowSlot = 1u << 3, // slot is borrowed into the GPU timeline; retires late
kRecVarTail = 1u << 4,
// P12: THE PEER NEED NOT ANSWER THIS RECORD. Set by the producer for a record whose
// answer NOBODY WILL EVER READ - not "whose caller is not waiting". The distinction is
// the whole point: the create window's records are emitted without a wait and their
// answers are read later by the drain, so they must NOT carry this bit.
//
// IT ALIASES kOptional (1<<5) IN THE CALL-FLAG SPACE, and that is harmless for the same
// reason the other five aliases are: the two spaces share one 16-bit field and are kept
// apart by the ENCODER'S TRANSLATION, never by stamping (PipeWireCodec.cpp's FlagSpace
// block names each pair and asserts them). kOptional is in kDropped - it never reaches
// this field - so nothing can set this bit by accident.
kRecNoReply = 1u << 5,
};
// Reserved kind for the wrap filler. The catalogue starts at 1.
+43 -8
View File
@@ -88,7 +88,8 @@ namespace MobileGL::MG_Remote::Wire {
static_cast<Uint16>(Transport::kRecHasBlob) |
static_cast<Uint16>(Transport::kRecPad) |
static_cast<Uint16>(Transport::kRecBorrowSlot) |
static_cast<Uint16>(Transport::kRecVarTail);
static_cast<Uint16>(Transport::kRecVarTail) |
static_cast<Uint16>(Transport::kRecNoReply);
// The three call flags the encoder TRANSLATES, and the three it deliberately drops
// because MGPipeCallFlagsFor(op) recovers them from the opcode.
constexpr Uint16 kTranslated = static_cast<Uint16>(MG_Pipe::kNeedsAck) |
@@ -103,7 +104,7 @@ namespace MobileGL::MG_Remote::Wire {
"MGPipeCallFlags gained or lost an enumerator; re-derive the translation in "
"EncodeRecord and extend the overlap assertions below before assuming the "
"new bit is safe to drop");
static_assert(FlagSpace::kRingAll == 0x1Fu,
static_assert(FlagSpace::kRingAll == 0x3Fu,
"RingRecordFlags gained or lost an enumerator; the two spaces share one "
"16-bit field, so a new ring bit may now alias a call flag");
static_assert((FlagSpace::kTranslated | FlagSpace::kDropped) == FlagSpace::kCallAll &&
@@ -111,8 +112,13 @@ namespace MobileGL::MG_Remote::Wire {
"every MGPipeCallFlags bit must be either translated or deliberately "
"dropped; a seventh enumerator that needs a ring bit would otherwise be "
"dropped in silence");
// FIVE OF THE SIX CALL-FLAG BITS ALIAS A RING BIT. Only kOptional (1<<5) is free, and it
// is free by luck rather than by design - RingRecordFlags simply has not reached 1<<5 yet.
// ALL SIX CALL-FLAG BITS NOW ALIAS A RING BIT. The sixth, kOptional, was free "by luck
// rather than by design" (RingRecordFlags had not reached 1<<5) until P12 gave bit 5 a
// meaning of its own, kRecNoReply. The alias is harmless for the usual reason - kOptional is
// in kDropped, so it is never stamped into this field, and kRecNoReply is only ever set by
// the encoder's translation - and the named assert below is where that is stated rather than
// assumed. What it costs is the WARNING this comment used to carry: there is no spare bit
// left, so the next call flag or ring flag needs a wider field, not another enumerator.
static_assert((FlagSpace::kCallAll & FlagSpace::kRingAll) == FlagSpace::kRingAll,
"the overlap between the two flag spaces moved");
// Named individually so a failure says WHICH pair, and so the three that actually bite are
@@ -140,9 +146,14 @@ namespace MobileGL::MG_Remote::Wire {
"stamps kRecVarTail on nine opcodes, and a reader who believes "
"PipeWire.inc's 'MGPipeCallFlags of the call' comment reads those nine as "
"kReplySlot");
static_assert((static_cast<Uint16>(MG_Pipe::kOptional) & FlagSpace::kRingAll) == 0,
"kOptional is the one call flag with no ring alias, and only because "
"RingRecordFlags has not reached 1<<5");
static_assert(static_cast<Uint16>(MG_Pipe::kOptional) ==
static_cast<Uint16>(Transport::kRecNoReply),
"kOptional == kRecNoReply - the alias P12 created. Harmless because kOptional "
"is in kDropped (never stamped) and kRecNoReply is only ever set by the "
"encoder: a reader that saw a stamped kOptional would read \"do not answer\" off "
"a flag that means \"this call may be absent from the backend table\". If this "
"pair ever stops being true, keep translating anyway - the hazard is two flag "
"spaces in one field, not this particular overlap");
// ---- and the two headers really are one layout -----------------------------------
//
@@ -1059,7 +1070,7 @@ namespace MobileGL::MG_Remote::Wire {
}
Uint64 PipeWireEncoder::EncodeRecord(MGPWireOp op, const void* payload, Uint64 payloadBytes,
const WireTail* tails, Uint32 tailCount) {
const WireTail* tails, Uint32 tailCount, Bool noReply) {
if (Cancelled()) return kInvalidSeq;
if (!Valid()) {
WireProtocolFatal("PipeWireEncoder::EncodeRecord", "no SEG_CMD producer installed");
@@ -1127,6 +1138,10 @@ namespace MobileGL::MG_Remote::Wire {
if ((callFlags & static_cast<Uint32>(kNeedsAck)) != 0) ringFlags |= Transport::kRecNeedsAck;
if ((callFlags & static_cast<Uint32>(kHasBlob)) != 0) ringFlags |= Transport::kRecHasBlob;
if ((callFlags & static_cast<Uint32>(kVarTail)) != 0) ringFlags |= Transport::kRecVarTail;
// P12: THE ONE BIT THAT IS NOT A TRANSLATION OF THE OPCODE, because it is not a property
// of the row - set_texture_params waits for an unconfirmed object and does not for a
// confirmed one, so the same opcode answers both ways and only the client knows which.
if (noReply) ringFlags |= Transport::kRecNoReply;
// BOTH WRAP READINGS ARE TAKEN FROM THE PRODUCER'S OWN CURSOR, not from a flag Reserve
// does not return. The cursor is a monotonic byte count and the ring is indexed
@@ -1452,6 +1467,8 @@ namespace MobileGL::MG_Remote::Wire {
Uint64 PipeWireDecoder::AcceptedRecords() const { return m_accepted; }
Uint64 PipeWireDecoder::DeclinedRecords() const { return m_declined; }
Uint64 PipeWireDecoder::AnsweredRecords() const { return m_answered; }
Uint64 PipeWireDecoder::SkippedAnswers() const { return m_skipped; }
void PipeWireDecoder::PostReply(MGPWireOp op, Uint64 seq, Int32 status, const void* bytes,
Uint64 size) {
@@ -1723,6 +1740,14 @@ namespace MobileGL::MG_Remote::Wire {
// four lines inside one lambda, made under R-17 by c1 because it is the server half of
// the routing R-17 assigns, and it is called out in c1-v2.md so the integrator can
// move it if the call belongs elsewhere.
// P12: MAY THIS RECORD'S ANSWER BE SKIPPED? Read from the RING FRAMING field, not from
// MGPipeCallFlagsFor(op): the client decides per CALL, and the opcode cannot answer for
// it (set_texture_params waits for an unconfirmed object and does not for a confirmed
// one). MGPWireRecHeader and RingRecordHeader are the same eight bytes, so `record` -
// which is the header, with the payload behind it - is where the producer's bit is.
const Bool answerSkipped =
(static_cast<const MGPWireRecHeader*>(record)->Flags &
static_cast<Uint16>(Transport::kRecNoReply)) != 0;
const auto noteAcceptance = [&](Bool accepted) {
m_lastAcceptanceKnown = true;
m_lastAcceptance = accepted;
@@ -1731,6 +1756,16 @@ namespace MobileGL::MG_Remote::Wire {
} else {
++m_declined;
}
// THE BOOKKEEPING ABOVE IS NOT CONDITIONAL, and the skip is placed BELOW it rather
// than around it on purpose: m_accepted / m_declined / LastAcceptance are the
// acceptance record (MG_Test asserts on them), while the PostReply below is the WIRE
// cost this bit exists to remove. A row whose answer is skipped still has to say what
// it decided - "nobody reads the answer" is not "nothing happened".
if (answerSkipped) {
++m_skipped;
return;
}
++m_answered;
// DECLINED is a real answer and carries no payload (ReplySlot.h): the four Bool
// rows say `false` with it, exactly as MapPersistent says nullptr with it.
PostReply(op, seq, accepted ? ReplySink::kStatusOk : ReplySink::kStatusDeclined,
+20 -1
View File
@@ -274,7 +274,16 @@ namespace MobileGL::MG_Remote::Wire {
// can only report a corrupt stream. That is the same arithmetic the decoder runs, so
// the check is real rather than a restatement of the caller's own belief.
Uint64 EncodeRecord(MG_Pipe::MGPWireOp op, const void* payload, Uint64 payloadBytes,
const WireTail* tails, Uint32 tailCount);
const WireTail* tails, Uint32 tailCount, Bool noReply = false);
// `noReply` (P12) stamps Transport::kRecNoReply, which tells the server it may SKIP the
// answer for this record. IT IS NOT "the caller is not waiting" - that is `wantReply` on
// ClientSession::EmitAndWaitTails, and the two are deliberately different questions: the
// create window emits without waiting and READS the answer later, so its records must not
// carry this. Only a record whose answer nobody will ever read may set it, and the client
// is where that is known - the server cannot recover it from the opcode, because the same
// row answers both ways (set_texture_params waits for an unconfirmed object and does not
// for a confirmed one).
// Releases every SEG_STAGE run named by a record the apply side has RETIRED
// (RingControl::retiredSeq, R-9, which this class only ever READS). Called from
@@ -739,6 +748,14 @@ namespace MobileGL::MG_Remote::Wire {
Bool LastAcceptance() const;
Uint64 AcceptedRecords() const;
Uint64 DeclinedRecords() const;
// P12: HOW MANY ANSWERS WERE WRITTEN AND HOW MANY WERE SKIPPED, counted where the
// decision is made. This is the pair a deferral's viability is read off: only the
// ANSWERED records compete for the reply pool, so `AnsweredRecords() / creates` is how
// many replies stand between two deferred answers. Without it the client can see that
// its drain failed but not whether the server was ever told it could stop answering -
// and a wire change whose effect is invisible is a wire change nobody can debug.
Uint64 AnsweredRecords() const;
Uint64 SkippedAnswers() const;
// Points MG_Pipe::gMGPipeWireRecordApply at this layer's thunk. Called once from the
// constructor and modelled on SegmentTable::InstallProcessResolver, which is the same
@@ -772,6 +789,8 @@ namespace MobileGL::MG_Remote::Wire {
Bool m_lastAcceptance = false;
Uint64 m_accepted = 0;
Uint64 m_declined = 0;
Uint64 m_answered = 0;
Uint64 m_skipped = 0;
// The SEG_STAGE runs the record being applied resolved, for the 0xDD fill. Eight deep
// so CreateShaderState's seven blob members plus a tail would fit if a later phase
// declares them; today at most one run is ever noted (see PoisonedStageBytes).