[MG_Pipe, MG_Impl, MG_Remote, MG_Backend] (Disaggregated): P5e id - the barriered seam, the allocator guard and the two scopes

- CONTRACT-P5E §2.1's predicate gets its two names in MG_Pipe/PipeApply.h:
  MGPipeBarriered(op, payload, st) and MGPipeApplierCurrentRecordIsBarriered(),
  with MGPipeApplierState::CurrentRecordBarriered as the per-record flag that
  PipeApplier::ApplyOne stamps before every decode. The body answers TRUE for
  every record until ra lands the wait rule, so lockstep is unchanged and this
  package alters no behaviour; ra rebases onto that line rather than adding it.
  Package c0e owns the final declaration of both names - the overlap is one hunk.
- §4.4: MGPipeRefuseAllocatorFromApplyThread now exempts a probe only inside a
  named scope AND while the record being applied is barriered. The client's wait
  is the whole of what makes an apply-thread frontend probe safe; behind an
  unbarriered record the allocator's free list and lifetimeId -> slot map are
  moving under the read, so the value is wrong by construction - there is no
  "count it" arm and MOBILEGL_IPC_STRICT_ERRORS is not consulted.
- MGPipeApplierIsUnbarrieredApply() and
  MGPipeRefuseFrontendKeyedRegistryFromUnbarrieredApply() are the non-allocator
  half of the same rule, for the surfaces that answer from a frontend SharedPtr
  without calling the allocator (SlotTables.h's state note and its reader).
- Ruling 12: MGPipeReverseAnnouncementScope -> MagmaP7AllocatorDebtScope, keyed
  on MG_Config::ActiveBackendType == DirectVulkan. Magma's four apply-thread
  allocator debts move onto it (VulkanRenderer's two hidden-resource shutdowns
  and the named-blit endpoint resolve, ResourceTracker's GPU-write
  announcement); an Espryt probe can no longer borrow Magma's exemption by
  constructing its scope.
- BufferImpl::HandleOfBuffer is Espryt's debt, not Magma's, so it moves to
  MGPipeFrontendKeyedRegistryScope - which the Magma-keyed scope would not have
  exempted at all. It retires when vi/sb carry the handle into
  EnsureBufferResourceForHandle / IsBufferDrawCleanByHandle.
This commit is contained in:
2026-09-18 06:34:48 -04:00
parent 2fde70341d
commit f40a57cc96
8 changed files with 252 additions and 44 deletions
@@ -1055,6 +1055,15 @@ namespace MobileGL::MG_Remote::Server {
// dropped before this function returns, and s1's SessionConsumer::ApplyOne publishes
// appliedSeq only after that - so by the time the client is runnable the flag is down.
const Client::ClientSession::ScopedApplierEntry insideApplier;
// P5e (id), CONTRACT-P5E §2.1 / §4.4: STAMP WHETHER THE CLIENT IS PARKED BEHIND THIS
// RECORD, before anything can ask. It is the input to the allocator guard's exemption
// (SlotAllocator.cpp) and to every frontend-keyed twin member that survives as monolith
// glue (SlotTables.h), and it has to be up before DecodeAndApply because the sinks those
// reach are exactly the askers. MGPipeBarriered answers true for every record until ra
// lands the wait rule, so this line changes nothing this phase and is the line ra
// rebases onto rather than adds.
MG_Pipe::MGPipeApplier().CurrentRecordBarriered = MG_Pipe::MGPipeBarriered(
static_cast<MG_Pipe::MGPWireOp>(record.kind), record.payload, MG_Pipe::MGPipeApplier());
// ORDER IS THE CONTRACT'S: stamp, then apply. The stamp is what makes any server-side
// read of gPipeInputs legal at all (PipeApplier.h's block 1), so a record applied
// before it aborts on the FIRST field inside SyncRenderState.