[Feat] (Plugin, P11 B1): the broker presents the PairBind pair at hand-off (PairBindFrames, the encoder's bytes) and answers v2 with that flag and the apply core its supervisor announced; the helper passes MOBILEGL_IPC_FD_PAIRED=1 on, and Java no longer re-derives the reserved core

This commit is contained in:
2026-09-29 15:03:52 -04:00
parent 582adb0dd6
commit 7ccb920ad2
8 changed files with 214 additions and 91 deletions
+17 -18
View File
@@ -94,24 +94,23 @@ public final class ServerEnvironmentTest {
expect("an unmeasured view fills the view",
java.util.Arrays.toString(ServerEnvironment.aspectFit(0, 0, 640, 480)), "[-1, -1]");
// ---- P11 B1: the apply core the broker tells the helper to keep the client off ------------------
// The Java mirror of MG_Remote/Server/ApplyThreadPolicy.h ReservedApplyCore over DetectBigCoreMask.
long[] redmi = {3532800, 3532800, 3532800, 3532800, 3532800, 3532800, 4320000, 4320000};
expect("the Redmi (cpu6-7 prime): the LOWEST prime core, cpu6",
ServerEnvironment.reservedApplyCore(redmi, null), 0x40L);
expect("`auto` and an empty override are the policy's own", ServerEnvironment.reservedApplyCore(redmi, "auto"),
0x40L);
expect("an operator's affinity (a mask or off) reserves nothing",
ServerEnvironment.reservedApplyCore(redmi, "0x80") + ServerEnvironment.reservedApplyCore(redmi, "off"),
0L);
expect("a symmetric machine has no prime pair to split",
ServerEnvironment.reservedApplyCore(new long[]{2000000, 2000000, 2000000, 2000000}, ""), 0L);
expect("one prime core is not a pair",
ServerEnvironment.reservedApplyCore(new long[]{1800000, 1800000, 1800000, 3000000}, null), 0L);
expect("within 15% of the peak is big: cpu2 and cpu3 of {1.0, 1.0, 2.6, 3.0} GHz, the lowest is cpu2",
ServerEnvironment.reservedApplyCore(new long[]{1000000, 1000000, 2600000, 3000000}, null), 0x4L);
expect("an unreadable ceiling gives no answer, like the native probe",
ServerEnvironment.reservedApplyCore(new long[]{3532800, 0, 4320000, 4320000}, null), 0L);
// ---- P11 B1: the apply core the supervisor announces and the broker relays ---------------------
// The native policy is the one source; the service only reads the supervisor's start-up line.
expect("the announcement as the supervisor prints it",
ServerEnvironment.parseReservedApplyCore("MG_Remote server: apply core reserved for dialled-in "
+ "shared-segment clients: 0x40 (auto: the lowest of the prime cores, the rest left to the "
+ "dialled-in shared-segment client)"), 0x40L);
expect("none reserved is 0, not absent",
ServerEnvironment.parseReservedApplyCore("MG_Remote server: apply core reserved for dialled-in "
+ "shared-segment clients: 0x0 (auto: unpinned - no asymmetric big/prime topology to split)"), 0L);
expect("a 64-bit mask", ServerEnvironment.parseReservedApplyCore(
"MG_Remote server: apply core reserved for dialled-in shared-segment clients: 0x8000000000000000 (x)"),
Long.MIN_VALUE);
expect("any other supervisor line is not the announcement",
ServerEnvironment.parseReservedApplyCore("MG_Remote server: pid=12 listening on @x"), -1L);
expect("a truncated announcement is not one",
ServerEnvironment.parseReservedApplyCore("MG_Remote server: apply core reserved for dialled-in "
+ "shared-segment clients: 0x"), -1L);
if (failures != 0) {
System.err.println("ServerEnvironmentTest: " + failures + " failure(s)");