[Feat] (MG_Remote): fence polls are answered from the server's reports - the apply thread posts kEventFenceSignaled as the GPU finishes each client fence (and submits and re-checks while idle), glClientWaitSync(0) / glGetSynciv answer locally, and only every MOBILEGL_IPC_POLL_ESCALATE-th unanswered poll crosses

This commit is contained in:
2026-09-29 03:59:44 -04:00
parent de33d40173
commit bcff9b00cc
18 changed files with 538 additions and 17 deletions
+22 -2
View File
@@ -22,6 +22,7 @@
#include "../Transport/FdPassing.h"
#include "../Transport/InProcessTransport.h"
#include "WireTables.h"
#include "EmitTables.h"
#include <MGGitHash.h>
#include <MG_Backend/MGPipe/PipeInputs.h>
@@ -482,9 +483,22 @@ namespace MobileGL::MG_Remote::Client {
++delivered;
break;
}
case Transport::kEventFenceSignaled: {
// P10 (CONTRACT-P10.md §1): remembered for every later poll of that fence.
if (view.payloadSize < sizeof(Transport::EventFenceSignaledHead)) {
SessionFail(MGFatalFamily::ProtocolCorruption, "MGPipe: Fatal{ProtocolCorruption, \"kEventFenceSignaled\"} - "
"a %llu-byte record is shorter than the fence handle it carries",
static_cast<unsigned long long>(view.payloadSize));
}
const auto* head =
static_cast<const Transport::EventFenceSignaledHead*>(view.payload);
NoteFenceSignaledByServer(MG_Pipe::MGPipeHandle{head->Fence.Slot, head->Fence.Gen});
++delivered;
break;
}
default:
MGLOG_W("MG_Remote client: reverse-channel record kind %u is not consumed in "
"P5c (four of the ten callbacks are armed; the rest are P9's)",
MGLOG_W("MG_Remote client: reverse-channel record kind %u is not one this "
"build consumes",
static_cast<unsigned>(view.kind));
break;
}
@@ -2235,6 +2249,12 @@ namespace MobileGL::MG_Remote::Client {
}
}
void ClientSession::PollEntry() {
if (!m_started || m_events == nullptr || DeviceLost()) return;
Flush();
DrainEventRing(*m_events);
}
void ClientSession::Finish() {
// glFinish. Nothing goes on the wire - Flush and Finish have no record (ARCHITECTURE
// §11) - and under lockstep there was nothing to do, because the client had already