mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-16 06:23:23 +09:00
[Feat] (P13 W3b): subsystem bits 0-13 are fixed on and refused by name at startup, the legacy-memo and texel-retain knobs are gone
This commit is contained in:
@@ -3694,29 +3694,6 @@ namespace {
|
||||
std::string m_previous;
|
||||
};
|
||||
|
||||
// Sets the two knobs into the combination that leaves no twin-table arm at all -
|
||||
// kMGPipeSubsystemEsprytSlots clear and PipeLegacyMemos false, which is what
|
||||
// MOBILEGL_PIPE_PUSH=0 MOBILEGL_PIPE_LEGACY_MEMOS=0 in the environment produces - and
|
||||
// restores MG_Config::Features on every exit path.
|
||||
struct ScopedArmlessKnobPair {
|
||||
ScopedArmlessKnobPair():
|
||||
m_savedPush(MobileGL::MG_Config::Features.PipePush),
|
||||
m_savedLegacy(MobileGL::MG_Config::Features.PipeLegacyMemos) {
|
||||
MobileGL::MG_Config::Features.PipePush =
|
||||
m_savedPush & ~MobileGL::MG_Pipe::kMGPipeSubsystemEsprytSlots;
|
||||
MobileGL::MG_Config::Features.PipeLegacyMemos = false;
|
||||
}
|
||||
~ScopedArmlessKnobPair() {
|
||||
MobileGL::MG_Config::Features.PipePush = m_savedPush;
|
||||
MobileGL::MG_Config::Features.PipeLegacyMemos = m_savedLegacy;
|
||||
}
|
||||
ScopedArmlessKnobPair(const ScopedArmlessKnobPair&) = delete;
|
||||
ScopedArmlessKnobPair& operator=(const ScopedArmlessKnobPair&) = delete;
|
||||
|
||||
private:
|
||||
MobileGL::Uint64 m_savedPush;
|
||||
MobileGL::Bool m_savedLegacy;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
// The property the whole slice exists for. The pre-P2 registry keyed twins on the frontend heap
|
||||
@@ -4642,115 +4619,6 @@ TEST(DirectGLESSlotTable, ASavedCopyOfARealRegistryDropsTheTwinOnTheSameNotice)
|
||||
EXPECT_FALSE(registry.DestroyByLifetimeId(0)) << "sanity: a null id frees nothing";
|
||||
}
|
||||
|
||||
// The gate on MAJOR 1 of the round-3 review. Commit d89fb684 raised
|
||||
// Fatal{PipeLegacyMemosDisabled} from inside InitDisplayAndContext(), i.e. from inside EGL
|
||||
// bring-up - and the integration harness pre-flights EGL bring-up in a FORKED CHILD, converting
|
||||
// any child that dies on a signal into "no usable GPU/display/ICD" and SKIPPING every scenario.
|
||||
// So `MOBILEGL_PIPE_PUSH=0 MOBILEGL_PIPE_LEGACY_MEMOS=0 ctest -L integration-gpu -R DirectGLES`
|
||||
// reported 100% tests passed while running nothing at all, on the exact pair of env vars the
|
||||
// D14/D18 A/B is driven with. ROADMAP.md:7 forbids a gate that cannot go red for the reason it
|
||||
// exists, and a lane that goes green by skipping is the worst version of that.
|
||||
//
|
||||
// The split this case pins: bring-up DIAGNOSES (and returns), first twin lookup STOPS. It
|
||||
// checks the message and not only the signal, because an operator who is handed a bare
|
||||
// "Subprocess aborted" has been told nothing about which two knobs they set.
|
||||
TEST(DirectGLESSlotTable, AnArmlessKnobCombinationStopsInsteadOfSkippingTheLane) {
|
||||
GTEST_SKIP() << "this build compiles no legacy twin registry, so no knob combination can "
|
||||
"leave the process without an arm";
|
||||
}
|
||||
|
||||
// The two guards the armless cases stand on, pinned on their own: whatever an operator had in
|
||||
// MOBILEGL_LOG_FILE_PATH - a path, or nothing - and whatever MG_Config::Features held are back,
|
||||
// byte for byte, once the guards go out of scope, with or without a failure inside. Before
|
||||
// this the armless case unset the variable for every later case in the binary and restored
|
||||
// the config only on its success path (the round-4 review's minor 5).
|
||||
TEST(DirectGLESSlotTable, TheArmlessCasesLeaveTheLogPathAndTheConfigAsTheyFoundThem) {
|
||||
using namespace MobileGL;
|
||||
|
||||
const Uint64 push = MG_Config::Features.PipePush;
|
||||
const Bool legacy = MG_Config::Features.PipeLegacyMemos;
|
||||
std::string previousPath;
|
||||
const bool hadPreviousPath = std::getenv("MOBILEGL_LOG_FILE_PATH") != nullptr;
|
||||
if (hadPreviousPath) previousPath = std::getenv("MOBILEGL_LOG_FILE_PATH");
|
||||
|
||||
// With an operator path in place...
|
||||
const std::filesystem::path operatorPath = UniqueScratchLogPath("mobilegl-espryt-operator");
|
||||
SetEnvVar("MOBILEGL_LOG_FILE_PATH", operatorPath.string().c_str());
|
||||
{
|
||||
const ScopedArmlessKnobPair knobs;
|
||||
const ScopedLogFileRedirect redirect(UniqueScratchLogPath("mobilegl-espryt-guard"));
|
||||
EXPECT_EQ(MG_Config::Features.PipePush & MG_Pipe::kMGPipeSubsystemEsprytSlots, 0ull);
|
||||
EXPECT_FALSE(MG_Config::Features.PipeLegacyMemos);
|
||||
EXPECT_STRNE(std::getenv("MOBILEGL_LOG_FILE_PATH"), operatorPath.string().c_str());
|
||||
}
|
||||
ASSERT_NE(std::getenv("MOBILEGL_LOG_FILE_PATH"), nullptr) << "the operator's log path was unset";
|
||||
EXPECT_STREQ(std::getenv("MOBILEGL_LOG_FILE_PATH"), operatorPath.string().c_str());
|
||||
EXPECT_EQ(MG_Config::Features.PipePush, push);
|
||||
EXPECT_EQ(MG_Config::Features.PipeLegacyMemos, legacy);
|
||||
|
||||
// ...and with none.
|
||||
UnsetEnvVar("MOBILEGL_LOG_FILE_PATH");
|
||||
{
|
||||
const ScopedLogFileRedirect redirect(UniqueScratchLogPath("mobilegl-espryt-guard"));
|
||||
EXPECT_NE(std::getenv("MOBILEGL_LOG_FILE_PATH"), nullptr);
|
||||
}
|
||||
EXPECT_EQ(std::getenv("MOBILEGL_LOG_FILE_PATH"), nullptr)
|
||||
<< "a log path was left behind where the operator had none";
|
||||
|
||||
if (hadPreviousPath) {
|
||||
SetEnvVar("MOBILEGL_LOG_FILE_PATH", previousPath.c_str());
|
||||
}
|
||||
std::error_code ignored;
|
||||
std::filesystem::remove(operatorPath, ignored);
|
||||
}
|
||||
|
||||
// The round-4 review's minor 4: the case above pins the two FUNCTIONS, and nothing failed if
|
||||
// InitDisplayAndContext() (DirectGLES.cpp) was edited back to call the stopping one - which is
|
||||
// exactly the regression that produced the round-3 major. This pins the CALL SITE, by running
|
||||
// the real bring-up entry point under the armless pair.
|
||||
//
|
||||
// No display is needed: InitDisplayAndContext's twin-arm call is its first statement after
|
||||
// the context teardown, ahead of eglGetDisplay, so an EGL table whose eglGetDisplay answers
|
||||
// EGL_NO_DISPLAY takes bring-up through that call and straight back out with `false`. The
|
||||
// child must then EXIT with the code below. If the site stops again it dies of SIGABRT
|
||||
// instead, and the death test fails - naming both knobs - rather than skipping: in the
|
||||
// integration harness that same abort is what turned into a green lane that ran nothing.
|
||||
//
|
||||
// Not skipped in a build without the legacy arm either: there the verdict is Handles and
|
||||
// bring-up has nothing to diagnose, but it must still return, and this says so.
|
||||
TEST(DirectGLESSlotTable, EglBringUpUnderTheArmlessKnobPairReturnsInsteadOfStopping) {
|
||||
#if defined(_WIN32)
|
||||
GTEST_SKIP() << "needs a forked death test";
|
||||
#else
|
||||
using namespace MobileGL;
|
||||
|
||||
constexpr int kBringUpReturnedFalse = 0x51;
|
||||
constexpr int kBringUpReturnedTrue = 0x52;
|
||||
|
||||
// The redirect is set up in the PARENT: the child inherits the environment and writes the
|
||||
// file, the parent reads it once the child has gone, and the guard restores the operator's
|
||||
// log path either way.
|
||||
const ScopedLogFileRedirect log(UniqueScratchLogPath("mobilegl-espryt-armless-bringup"));
|
||||
|
||||
EXPECT_EXIT(
|
||||
{
|
||||
const ScopedArmlessKnobPair knobs;
|
||||
MG_External::EGLFunctionsTable egl{};
|
||||
egl.eglGetDisplay = +[](EGLNativeDisplayType) -> EGLDisplay { return EGL_NO_DISPLAY; };
|
||||
MG_Backend::DirectGLES::SetEGLFuncsTable(egl);
|
||||
const Bool ok = MG_Backend::DirectGLES::InitPbufferSurface(1, 1);
|
||||
MG_Util::Debug::Close();
|
||||
std::exit(ok ? kBringUpReturnedTrue : kBringUpReturnedFalse);
|
||||
},
|
||||
::testing::ExitedWithCode(kBringUpReturnedFalse), "")
|
||||
<< "EGL bring-up under MOBILEGL_PIPE_PUSH with kMGPipeSubsystemEsprytSlots clear and "
|
||||
"MOBILEGL_PIPE_LEGACY_MEMOS=0 did not RETURN: InitDisplayAndContext() is stopping "
|
||||
"on the armless knob pair again instead of diagnosing it, and the integration "
|
||||
"harness's forked pre-flight turns that stop into a lane that skips every scenario";
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// P3a REWORK C-1's gate, and the case that would have caught it.
|
||||
//
|
||||
// A persistently mapped buffer whose store was NOT adopted - under the 16 MiB threshold, or
|
||||
|
||||
Reference in New Issue
Block a user