mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-17 23:13:22 +09:00
[MG_Remote, MG_Pipe, MG_Test, CI, tools, docs] (P6.5): the first wave completed and reviewed - archive v2, publication boundary, half-close, AcceptPair/role fixes, device re-validation
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#if !defined(__ANDROID__)
|
||||
#include <MG_State/GLState/BufferState/BufferObject.h>
|
||||
#include <MG_State/GLState/Core.h>
|
||||
#include <MG_Util/Metrics/PipeStats.h>
|
||||
#include <Config.h>
|
||||
#define MGITEST_PERSISTENT_MAP_PEEK_LIVE 1
|
||||
#endif
|
||||
|
||||
@@ -27,6 +29,19 @@
|
||||
|
||||
namespace MGITest {
|
||||
|
||||
bool PeekSeparateClientMapStats(unsigned long long* acquisitions, unsigned long long* pushedBytes) {
|
||||
#if defined(MGITEST_PERSISTENT_MAP_PEEK_LIVE) && MOBILEGL_BUILD_DISAGGREGATED && MOBILEGL_PIPE_PUSH
|
||||
if (MobileGL::MG_Config::Transport != MobileGL::MG_Config::TransportMode::Spawn) return false;
|
||||
namespace Stats = MobileGL::MG_Util::PipeStats;
|
||||
*acquisitions = Stats::TotalCalls(Stats::CallClass::MapPersistentRoundtrips);
|
||||
*pushedBytes = Stats::TotalBytes(Stats::ByteClass::PersistentMapPush);
|
||||
return true;
|
||||
#else
|
||||
(void)acquisitions; (void)pushedBytes;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool PersistentMapPeekAvailable() {
|
||||
#if defined(MGITEST_PERSISTENT_MAP_PEEK_LIVE)
|
||||
return true;
|
||||
|
||||
@@ -58,4 +58,8 @@ namespace MGITest {
|
||||
// Same contract as above: false means "could not look".
|
||||
bool PeekBufferIsLivePersistentMap(unsigned int bufferName, bool* outLive);
|
||||
|
||||
// Separate-process clients own these counters; the remote Present window
|
||||
// belongs to the server and cannot report client map acquisitions or bytes.
|
||||
bool PeekSeparateClientMapStats(unsigned long long* acquisitions, unsigned long long* pushedBytes);
|
||||
|
||||
} // namespace MGITest
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace MGITest::PipeStatsWindow {
|
||||
// "the stats channel never reached the process". Concatenated, Last() takes whichever role
|
||||
// emitted the final summary.
|
||||
inline Window LastFromLaneLog() {
|
||||
return Last(ReadWholeFile(LibraryLogPath()) + ReadWholeFile(ServerLibraryLogPath()));
|
||||
return Last(ReadLaneLog());
|
||||
}
|
||||
|
||||
// One counter out of that line, by its short name ("mpr", "draws", "csom"), or -1 when the
|
||||
|
||||
@@ -18,6 +18,15 @@ foreach(listName IN ITEMS @MGL_SPLIT_ARM_TEST_LISTS@)
|
||||
foreach(entry IN LISTS ${listName})
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
|
||||
if(entry MATCHES "TriangleScenario.TheServerStampedAVerbBoundaryOnThisDrawingFrame$")
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MGITEST_STRICT_ARMING_LANE=1;MOBILEGL_PIPE_STATS=1;MOBILEGL_PIPE_STATS_PERIOD=1")
|
||||
elseif(entry MATCHES "PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares$")
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MGITEST_PMAP_LANE=1;MGITEST_PERSISTENT_MAP_ARM=emulated;MOBILEGL_PIPE_STATS=1;MOBILEGL_PIPE_STATS_PERIOD=1")
|
||||
elseif(entry MATCHES "CtWireScenario\\.")
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT "MOBILEGL_TEST_SERVER_COUNTERS=1")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
foreach(entry IN LISTS MGL_SPLIT_PA_STRICT_DRAW_TESTS MGL_SPLIT_PA_STRICT_DISPATCH_TESTS)
|
||||
@@ -28,6 +37,13 @@ foreach(scenario @MGL_SPLIT_SMALL_RING_SCENARIOS@)
|
||||
foreach(entry IN LISTS MGL_SPLIT_SMALL_${scenario}_TESTS)
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MOBILEGL_LOG_FILE_PATH=@CMAKE_CURRENT_BINARY_DIR@/split-logs/${entry}.log")
|
||||
if(entry MATCHES "TriangleScenario.TheServerStampedAVerbBoundaryOnThisDrawingFrame$")
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MGITEST_STRICT_ARMING_LANE=1;MOBILEGL_PIPE_STATS=1;MOBILEGL_PIPE_STATS_PERIOD=1")
|
||||
elseif(entry MATCHES "PersistentCoherentMapScenario.TheMapLandsInTheArmItsLaneDeclares$")
|
||||
set_tests_properties("${entry}" PROPERTIES ENVIRONMENT
|
||||
"MGITEST_PMAP_LANE=1;MGITEST_PERSISTENT_MAP_ARM=emulated;MOBILEGL_PIPE_STATS=1;MOBILEGL_PIPE_STATS_PERIOD=1")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
# d1's entries are covered by MGL_SPLIT_ARM_TESTS above (P6 `t6`).
|
||||
|
||||
@@ -55,24 +55,30 @@ namespace {
|
||||
return MobileGL::MG_Remote::Server::ServerSessionInstance().Applier().Verbs();
|
||||
}
|
||||
|
||||
// P6 `t6`: THE COUNTERS BELOW LIVE IN THE SERVER'S PROCESS, and under spawn that is not
|
||||
// this one.
|
||||
//
|
||||
// ServerVerbs() reads PipeApplier's in-process tallies. Under inproc the applier is a thread
|
||||
// here and the numbers are this process's own; under spawn it is a thread in a DIFFERENT
|
||||
// process and this process's copy stays 0 forever - so these cases would fail asserting a
|
||||
// fact about somebody else's memory, which is a harness limit and not a product defect.
|
||||
//
|
||||
// SKIPPED BY NAME RATHER THAN EXCLUDED FROM THE LANE. Exit gate 9.2 asks that
|
||||
// integration-spawn's case-name SET equal integration-split's, and a case dropped from the
|
||||
// registration would make the two sets differ silently - the exact drift the shared
|
||||
// registration macro exists to prevent. A skip keeps the name, states the reason, and is
|
||||
// counted as a skip rather than as coverage.
|
||||
//
|
||||
// WHAT WOULD RETIRE IT: cross-process telemetry, which is also what `t6`'s S8 needs for
|
||||
// SessionFaultCount() over a whole run. Until that exists this is the honest answer.
|
||||
bool ServerCountersAreObservableHere() {
|
||||
return MobileGL::MG_Config::Transport != MobileGL::MG_Config::TransportMode::Spawn;
|
||||
// Inproc reads its local sink. A separate-process session snapshots that
|
||||
// same sink on LogFlush, after the client fences its complete command prefix.
|
||||
// TCP forwards the server log; unix+shm reads the server's local role file.
|
||||
struct CounterSnapshot {
|
||||
bool valid = false;
|
||||
MobileGL::Uint64 resets = 0, serial = 0, deaths = 0;
|
||||
};
|
||||
|
||||
CounterSnapshot ServerCounters() {
|
||||
if (MobileGL::MG_Config::Transport != MobileGL::MG_Config::TransportMode::Spawn) {
|
||||
return {true, ServerVerbs().ApplierResets(), ServerVerbs().ExpectedApplierResetSerial(),
|
||||
ServerVerbs().ObjectDeaths()};
|
||||
}
|
||||
MGPipeSyncPeerLog();
|
||||
const std::string log = PipeStatsWindow::ReadWholeFile(PipeStatsWindow::ServerLibraryLogPath());
|
||||
const auto at = log.rfind("MGPipe server counters:");
|
||||
if (at == std::string::npos) return {};
|
||||
const PipeStatsWindow::Window window{true, log.substr(at, log.find('\n', at) - at)};
|
||||
const auto resets = PipeStatsWindow::CounterOrAbsent(window, "resets");
|
||||
const auto serial = PipeStatsWindow::CounterOrAbsent(window, "reset-serial");
|
||||
const auto deaths = PipeStatsWindow::CounterOrAbsent(window, "deaths");
|
||||
if (resets < 0 || serial < 0 || deaths < 0) return {};
|
||||
return {true, static_cast<MobileGL::Uint64>(resets), static_cast<MobileGL::Uint64>(serial),
|
||||
static_cast<MobileGL::Uint64>(deaths)};
|
||||
}
|
||||
|
||||
class CtWireScenario : public ScenarioTest {
|
||||
@@ -116,24 +122,20 @@ namespace {
|
||||
|
||||
TEST_F(CtWireScenario, ApplierResetCrossesAtThePrimedEdgeInSerialOrder) {
|
||||
if (!Ready()) return;
|
||||
if (!ServerCountersAreObservableHere()) {
|
||||
GTEST_SKIP() << "transport=spawn: the applier's counters are in the SERVER's process "
|
||||
"and this one's copy is 0 by construction. The record still crosses - "
|
||||
"the retrace lane is what proves that - but this case asserts on a "
|
||||
"tally only an in-process applier can publish.";
|
||||
}
|
||||
// The first verb of the process primes the tracker; the edge is the producer. The
|
||||
// clear also gives the case its pixels, so a lane that emitted nothing is red twice
|
||||
// (here and in the fixture's emit-ordinal rule).
|
||||
glClearColor(0.2f, 0.4f, 0.6f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
EXPECT_GE(ServerVerbs().ApplierResets(), 1u)
|
||||
const auto counters = ServerCounters();
|
||||
ASSERT_TRUE(counters.valid) << "server control-record telemetry missing";
|
||||
EXPECT_GE(counters.resets, 1u)
|
||||
<< "the FreshlyPrimed edge emitted no applier_reset; the server's g_applier was "
|
||||
"never reset for this session";
|
||||
// The serial sequence is the session's own count (§1: asserted, never dispatched
|
||||
// on): every record the sink accepted carried the serial it expected, or the counter
|
||||
// and the accepted tally would disagree.
|
||||
EXPECT_EQ(ServerVerbs().ExpectedApplierResetSerial(), ServerVerbs().ApplierResets())
|
||||
EXPECT_EQ(counters.serial, counters.resets)
|
||||
<< "an applier_reset record was dropped or replayed on the wire";
|
||||
|
||||
GLubyte pixel[4]{};
|
||||
@@ -169,12 +171,9 @@ namespace {
|
||||
// The object dies unbound so the destructor - and the death record - fire at the
|
||||
// delete, and the tally is read AFTER the EmitAndWait the delete blocked on.
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
if (!ServerCountersAreObservableHere()) {
|
||||
GTEST_SKIP() << "transport=spawn: ObjectDeaths is the SERVER process's tally and this "
|
||||
"process's copy never moves. The death record itself crosses; what "
|
||||
"cannot cross today is the counter that would prove it here.";
|
||||
}
|
||||
const MobileGL::Uint64 deathsBefore = ServerVerbs().ObjectDeaths();
|
||||
const auto beforeCounters = ServerCounters();
|
||||
ASSERT_TRUE(beforeCounters.valid) << "server object-death telemetry missing";
|
||||
const MobileGL::Uint64 deathsBefore = beforeCounters.deaths;
|
||||
glDeleteTextures(1, &texture);
|
||||
// THE FENCE, the framebuffer case's exactly (MOBILEGL_IPC_BATCH_WAITS, default on):
|
||||
// object_death is a kCtxObject value-class record, published WITHOUT waiting for its
|
||||
@@ -183,7 +182,9 @@ namespace {
|
||||
// clock-free spin changed that timing, then failed 1 in 5. A clear is kCtxVerb and
|
||||
// still waits, and its wait covers the death.
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
EXPECT_GT(ServerVerbs().ObjectDeaths(), deathsBefore)
|
||||
const auto afterCounters = ServerCounters();
|
||||
ASSERT_TRUE(afterCounters.valid) << "server object-death telemetry missing";
|
||||
EXPECT_GT(afterCounters.deaths, deathsBefore)
|
||||
<< "the texture's death produced no object_death record; the server's twin was "
|
||||
"never told to let go";
|
||||
|
||||
@@ -230,12 +231,9 @@ namespace {
|
||||
// Die unbound, framebuffer first so the attachment's own death is a separate record.
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
if (!ServerCountersAreObservableHere()) {
|
||||
GTEST_SKIP() << "transport=spawn: ObjectDeaths is the SERVER process's tally and this "
|
||||
"process's copy never moves. The death record itself crosses; what "
|
||||
"cannot cross today is the counter that would prove it here.";
|
||||
}
|
||||
const MobileGL::Uint64 deathsBefore = ServerVerbs().ObjectDeaths();
|
||||
const auto beforeCounters = ServerCounters();
|
||||
ASSERT_TRUE(beforeCounters.valid) << "server object-death telemetry missing";
|
||||
const MobileGL::Uint64 deathsBefore = beforeCounters.deaths;
|
||||
glDeleteFramebuffers(1, &fbo);
|
||||
// THE FENCE (MOBILEGL_IPC_BATCH_WAITS, default on): object_death is a kCtxObject
|
||||
// value-class record - published WITHOUT waiting for its own apply (production-safe:
|
||||
@@ -243,7 +241,9 @@ namespace {
|
||||
// server-side counter this assertion reads only moves at apply time, so it needs a
|
||||
// wait boundary: a clear is kCtxVerb and still waits, and its wait covers the death.
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
EXPECT_GT(ServerVerbs().ObjectDeaths(), deathsBefore)
|
||||
const auto afterCounters = ServerCounters();
|
||||
ASSERT_TRUE(afterCounters.valid) << "server object-death telemetry missing";
|
||||
EXPECT_GT(afterCounters.deaths, deathsBefore)
|
||||
<< "the framebuffer's death produced no object_death record - and no other "
|
||||
"opcode can carry it";
|
||||
glDeleteRenderbuffers(1, &renderbuffer);
|
||||
|
||||
@@ -466,6 +466,8 @@ void main() { oColor = vec4(vColor, 1.0); }
|
||||
}
|
||||
|
||||
Gl().EndFrame(); // close the setup window; SetUp's own store and map go in it
|
||||
unsigned long long acquisitionsBefore = 0, pushedBefore = 0;
|
||||
const bool separateClientStats = PeekSeparateClientMapStats(&acquisitionsBefore, &pushedBefore);
|
||||
|
||||
// One acquisition inside the counted window: one fresh immutable store, mapped once.
|
||||
const CoherentStore store = MakeCoherentlyMappedQuadStore();
|
||||
@@ -500,7 +502,16 @@ void main() { oColor = vec4(vColor, 1.0); }
|
||||
"not reach the process, or nothing reached PipeStats::OnPresent.";
|
||||
RecordProperty("stats_line", window.line.c_str());
|
||||
|
||||
const long long roundtrips = PipeStatsWindow::CounterOrAbsent(window, "mpr");
|
||||
unsigned long long acquisitionsAfter = 0, pushedAfter = 0;
|
||||
if (separateClientStats) {
|
||||
ASSERT_TRUE(PeekSeparateClientMapStats(&acquisitionsAfter, &pushedAfter));
|
||||
ASSERT_GE(acquisitionsAfter, acquisitionsBefore);
|
||||
ASSERT_GE(pushedAfter, pushedBefore);
|
||||
RecordProperty("stats_counter_owner", "client process totals over the counted workload");
|
||||
}
|
||||
const long long roundtrips = separateClientStats
|
||||
? static_cast<long long>(acquisitionsAfter - acquisitionsBefore)
|
||||
: PipeStatsWindow::CounterOrAbsent(window, "mpr");
|
||||
ASSERT_GE(roundtrips, 0) << "the summary line carries no mpr= field: " << window.line;
|
||||
EXPECT_EQ(roundtrips, kExpectedRoundtrips)
|
||||
<< "one PERSISTENT|WRITE|COHERENT map of one freshly defined store is ONE acquisition "
|
||||
@@ -523,7 +534,9 @@ void main() { oColor = vec4(vColor, 1.0); }
|
||||
// cross-check. Deriving the arm from pmap would have made "the push was never wired" and
|
||||
// "the store was adopted" the same reading, and they are different defects with different
|
||||
// owners.
|
||||
const double pushedBytes = PipeStatsWindow::CounterAsDoubleOrAbsent(window, "pmap");
|
||||
const double pushedBytes = separateClientStats
|
||||
? static_cast<double>(pushedAfter - pushedBefore)
|
||||
: PipeStatsWindow::CounterAsDoubleOrAbsent(window, "pmap");
|
||||
ASSERT_GE(pushedBytes, 0.0) << "the summary line carries no pmap= field: " << window.line;
|
||||
RecordProperty("persistent_map_push_bytes_per_frame", std::to_string(pushedBytes).c_str());
|
||||
RecordProperty("map_persistent_roundtrips", std::to_string(roundtrips).c_str());
|
||||
|
||||
Reference in New Issue
Block a user