[Feat] (MG_Remote, P10 A): a present reports the fences finished so far before it returns the credit, so the client the credit releases finds the fence of a frame ago already known

This commit is contained in:
2026-09-29 04:29:49 -04:00
parent bcff9b00cc
commit 625f4db47d
3 changed files with 13 additions and 0 deletions
@@ -425,6 +425,11 @@ namespace MobileGL::MG_Remote::Server {
// swap and not the record's apply. It advances presentAckSerial AND rings the client's
// bell - a client parked in WaitForPresentAck(kWaitForever) needs the pair.
if (ServerSession* session = ServerSession::Active()) {
// P10 (CONTRACT-P10.md §1): the fences finished by now are reported BEFORE the credit
// goes back - a client released by the credit polls or waits on the fence of a frame
// or two ago at once, and a report posted only after this batch would race it. A
// status query, no submit: the swap has just submitted.
if (session->EventRingHasRoom()) ReportSignaledFences(/*flush=*/false);
session->ReturnPresentCredit(m_lastPresentSerial);
}
return true;
@@ -1144,6 +1144,11 @@ namespace MobileGL::MG_Remote::Server {
PublishEvents();
}
Bool ServerSession::EventRingHasRoom() const {
if (!m_accepted || m_link == nullptr) return false;
return m_link->Signals().EventRingFull->load(std::memory_order_acquire) == 0;
}
// PH-6 (ID-P7-2). THE FIRST DROP, AND THE LATCH IT RAISES.
//
// Logged ONCE, by name, with everything a triage needs: which event, how big, what the
@@ -214,6 +214,9 @@ namespace MobileGL::MG_Remote::Server {
// found signaled. Posted and published at once - a client may be polling on it right now.
// Dropped with the same loud line as PostGlError before Accept.
void PostFenceSignaled(MG_Pipe::MGPipeHandle fence);
// True when SEG_EVENT is not latched full: an optional post (a fence report) goes
// there without parking the apply thread. False before Accept.
Bool EventRingHasRoom() const;
Transport::ITransport* Control_Plane();
// ---- PH-6 (ID-P7-2): THE REVERSE CHANNEL IS FORFEITED, NOT FATAL -------------------