diff --git a/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.cpp b/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.cpp index e0c29afb..ce38cffc 100644 --- a/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.cpp +++ b/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.cpp @@ -87,6 +87,22 @@ namespace MGITest { return session && session->Control() && session->Control()->producerParked.load(std::memory_order_acquire); #else return false; +#endif + } + bool WaitForSplitAppliedForTesting(unsigned long long seq, unsigned int timeoutMs) { +#if defined(MGITEST_SPLIT_RUNTIME_PEEK_LIVE) + auto* session = MobileGL::MG_Remote::Client::ClientSession::Active(); + auto* control = session ? session->Control() : nullptr; + if (!control) return false; + const auto until = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeoutMs); + do { + if (control->appliedSeq.load(std::memory_order_acquire) >= seq) return true; + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } while (std::chrono::steady_clock::now() < until); + return control->appliedSeq.load(std::memory_order_acquire) >= seq; +#else + (void)seq; (void)timeoutMs; + return false; #endif } void DelaySplitRetirementForTesting(bool enabled) { diff --git a/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.h b/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.h index 0c519ec1..874e2739 100644 --- a/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.h +++ b/MobileGL/MG_IntegrationTest/Harness/SplitRuntimePeek.h @@ -121,6 +121,9 @@ namespace MGITest { bool SplitApplyHoldIsActiveForTesting(); void ReleaseSplitApplyHoldForTesting(); bool SplitProducerIsParkedForTesting(); + // Observe completion for assertions about an emitted frame; does not emit a + // GL command or change the production wait rule. + bool WaitForSplitAppliedForTesting(unsigned long long seq, unsigned int timeoutMs = 5000); // Empty when this process is a real split run that can be asserted about; otherwise the diff --git a/MobileGL/MG_IntegrationTest/Scenarios/F1WireScenario.cpp b/MobileGL/MG_IntegrationTest/Scenarios/F1WireScenario.cpp index 71fc6c97..891efb35 100644 --- a/MobileGL/MG_IntegrationTest/Scenarios/F1WireScenario.cpp +++ b/MobileGL/MG_IntegrationTest/Scenarios/F1WireScenario.cpp @@ -161,6 +161,9 @@ void main() { color = vec4(value, 0.25, 0.75, 1.0); } EXPECT_NEAR(pixel[2], 191, 1); EXPECT_EQ(pixel[3], 255); Gl().EndFrame(); + // Present returns before apply under run-ahead. Inspect this completed + // frame's window, not the previous (possibly empty setup) log line. + ASSERT_TRUE(WaitForSplitAppliedForTesting(PeekSplitRuntime().emitSeq)); const auto window = PipeStatsWindow::LastFromLaneLog(); ASSERT_TRUE(window.found) << "P5f rsp window missing on frame " << frame; // Magma does not publish Espryt's draw counter. The changing uniform and