Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Duo spike: record why the panel stays dark while open

Jacky9ccab1c2e847
diff --git a/Research/Guest/iphone_duo_bringup.md b/Research/Guest/iphone_duo_bringup.md
index 9c903d8d..3a252325 100644
--- a/Research/Guest/iphone_duo_bringup.md
+++ b/Research/Guest/iphone_duo_bringup.md
@@ -4362,3 +4362,28 @@ window is cover-sized. Open, the panel goes black at 0 fps: SpringBoard
turns the cover display off, as on a real Duo, and on this guest the cover
is Main, the only physical scanout, so the composited inner display has
nowhere to appear. SpringBoard stayed up throughout.
+
+### Open: the cover is powered off below CAWindowServerDisplay (2026-10-28 night)
+
+`com.vphone.display.inner.server-state` logs each render display as
+backboardd holds it. Closed: primary `enabled=1 isBlanked=0`, inner
+`enabled=0 isBlanked=1`. Open: the reverse. backboardd powers the panels
+as a real Duo does, which on this guest leaves the only scanout (the
+primary) off.
+
+Swizzling `-[CAWindowServerDisplay setEnabled:]`/`setBlanked:` showed
+neither is called for the primary when the device opens; the change comes
+from below (QuartzCore has `CA::WindowServer::Display::set_power_state`
+and `IOMFBDisplay::set_power_state_locked`). Re-enabling and unblanking the
+primary through the original setters whenever the inner display was lit
+did make the flags read `enabled=1 isBlanked=0` while open, but the VM
+display still showed no frames (0 fps), so the power state underneath
+stayed off. The experiment was removed. The next lever is either the C++
+power path for the primary, or keeping SpringBoard's backlight host for
+the cover on while the inner display holds primary content.
+
+Separately, SpringBoard crashed three times while the posture changed with
+both panels resolved: a Swift fatal error in UIKitCore
+`ScrollEdgeEffectView.swift`, reached from `-[UIWindow
+_sceneSettingsSceneRegionsDidChange:]` → layout. It restarts on its own;
+the cause is not yet known.
diff --git a/VPhoneGuestComponents/FoldDisplay/FoldDisplayInnerDisplay.m b/VPhoneGuestComponents/FoldDisplay/FoldDisplayInnerDisplay.m
index ad8e3bd6..9806c905 100644
--- a/VPhoneGuestComponents/FoldDisplay/FoldDisplayInnerDisplay.m
+++ b/VPhoneGuestComponents/FoldDisplay/FoldDisplayInnerDisplay.m
@@ -76,6 +76,23 @@ NSNumber *vpInnerDisplaySurfaceType(id deviceName) {
return nil;
}
+// Each render display's power and blanking, as backboardd holds them.
+void vpLogRenderDisplayState(void) {
+ @try {
+ id server = ((id (*)(id, SEL))objc_msgSend)(objc_getClass("CAWindowServer"), sel_registerName("serverIfRunning"));
+ for (id display in ((id (*)(id, SEL))objc_msgSend)(server, sel_registerName("displays"))) {
+ if (![[display valueForKey:@"enabled"] boolValue] && ![[display valueForKey:@"deviceName"] isEqual:@"primary"] &&
+ display != vpInnerRenderDisplay) continue;
+ NSMutableString *state = [NSMutableString stringWithFormat:@"inner display: server %@", [display valueForKey:@"deviceName"]];
+ for (NSString *key in @[@"enabled", @"isBlanked", @"disablesUpdates", @"brightness"])
+ [state appendFormat:@" %@=%@", key, [display respondsToSelector:NSSelectorFromString(key)] ? [display valueForKey:key] : @"-"];
+ vpFoldDisplayLog(state);
+ }
+ } @catch (NSException *exception) {
+ vpFoldDisplayLog([NSString stringWithFormat:@"inner display: server state exception %@", exception.reason]);
+ }
+}
+
void vpInstallInnerRenderDisplay(void) {
if (!vpInnerDisplayRequested()) return;
dispatch_async(dispatch_get_main_queue(), ^{ vpAddInnerRenderDisplay(0); });
diff --git a/VPhoneGuestComponents/FoldDisplay/FoldDisplayPrivate.h b/VPhoneGuestComponents/FoldDisplay/FoldDisplayPrivate.h
index e9327f44..9ed7134d 100644
--- a/VPhoneGuestComponents/FoldDisplay/FoldDisplayPrivate.h
+++ b/VPhoneGuestComponents/FoldDisplay/FoldDisplayPrivate.h
@@ -184,6 +184,7 @@ void vpVirtualDisplayExperiment(BOOL create);
BOOL vpInnerDisplayRequested(void);
NSNumber *vpInnerDisplaySurfaceType(id deviceName);
void vpInstallInnerRenderDisplay(void);
+void vpLogRenderDisplayState(void);
void vpShowInnerDisplay(BOOL shown);
void vpToggleInnerPattern(void);
void vpResolveInnerDisplay(void);
diff --git a/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m b/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
index fc23a49f..7ebeb0aa 100644
--- a/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
+++ b/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
@@ -47,6 +47,9 @@ static void vpInstallBackboardProbes(void) {
^(int token) { vpEnableVirtualDisplayProbe(); });
notify_register_dispatch("com.vphone.display.virtual.tag-unknown", &tagToken, dispatch_get_main_queue(),
^(int token) { vpTagVirtualDisplayProbe(); });
+ static int innerStateToken;
+ notify_register_dispatch("com.vphone.display.inner.server-state", &innerStateToken, dispatch_get_main_queue(),
+ ^(int token) { vpLogRenderDisplayState(); });
}
// MARK: - SpringBoard hooks