Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/plan-ios-first-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ so each candidate needs the same "nobody calls it" proof as a stop.
| **1** (done here) | `oneios-tool phone procs`: the process list with CPU and RAM, read only | none: named files are read, nothing is written | unit tests, the stand-in phone; then the three captures of 1.3 on the phone | - |
| **2a** (built, section 5b) | the fork's stop loop without 15 `getprop` a second: one long-lived wait on the three properties (a small `propwait` in the runtime: `__system_property_wait`, as `usb.c` reads serials), or the same loop at 1 s | a zygote that starts is stopped up to 1 s later | the fork's script tests; `phone procs`: the fork's group at about 0 % | the old loop |
| **2b** (built for `session-mode=takeover`, section 5b) | the switch stops zygote's restart list where no bridge uses it: `cameraserver`, `mediaextractor`, `mediametrics`, `media.tuner`, `perfmond`, `wificond`; then `netd` (after a session's Wi-Fi join without it) and `media` (after one HEIC encode without it) | a kept HAL waits for a stopped service and spins or blocks [U] | stand-in tests of the fork's scripts (the record, the return's starts); a session: `phone procs` before and after, Wi-Fi join, a sound, a photo tile, the return in place | the return starts them; take the name off the list |
| **3a** | `displayctl drm`: the read-only probe of 2.1 step 2, beside One UI | none: no master, nothing set | host test against a stand-in device; one run on the phone | - |
| **3a** (built) | `displayctl drm [PATH]`: the read-only probe of 2.1 step 2, beside One UI (`runtime/display/src/drm_probe.rs`) | none: no master, nothing set | unit tests + `displayctl` test; one run on the phone (`displayctl drm`) | - |
| **3b** | the fork's part alone: a session with `display=none` in which the switch stops surfaceflinger and the composer, 60 s, automatic return | the panel stays dark for the session (the dead-man timer and the chord return); the composer or surfaceflinger does not come back: the failsafe reboot | the fork's script tests; one session: `return.log` shows the composer and surfaceflinger started, One UI's screen back | `display=shm` (today's path) stays the default |
| **3c** | xnuhost's KMS back end as the probe says (atomic, two buffers, flips), `display=drm` | a dark or wrong picture: return by the chord or the timer; nothing persists | host tests against a stand-in DRM device (vkms in the Linux container [U]); a session: the Apple logo, touch to frame, `display:` lines | `display=shm` |
| **3d** | panel power at display off, the real vsync, then the import of the guest's surface (no copy) | as 3c | as 3c, the `display: 10 s` line with 0 rows copied | the copy path |
Expand Down
6 changes: 5 additions & 1 deletion docs/switches.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ a new switch is on the screen with the runtime that has it.
xnuhost logs every switch once, after the `versions:` line:

```text
switches: session-mode=hosted stop-loop=wait takeover-reclaim=1 takeover-swappiness=keep task-trim=1 timer-coalesce=1 ram-fit-terms=tasks ram-ondemand=0 uclamp-rule=work gpu-down=governor gpu-blob-entries=65532 wifi-ring-wait=1 wifi-send-wait=1 wifi-buffers=1 wifi-joined-scan=cache encoder-10bit=main10 encoder-warmup=1 display-post=apart display-present=ahb decoder=auto decoder-codecs=h264,hevc,vp9,av1 astc=1 sensors=auto sensors-hz=50 sensors-light=auto oneios-motion=0 oneios-als-spu=0 oneios-wifi-rssi=1 oneios-telemetry-jobs=0 oneios-pool-cut=1 oneios-pressure-big=512 oneios-disable-allowed=1 oneios-nested-exact=1 oneios-upgrade-flush=0 oneios-fill-fast-fault=1 oneios-audio-rt=1 oneios-audio-curve=1 oneios-codec-irq=1 oneios-idle-spares=1 oneios-bo-cache-idle=1 oneios-keep-room=8 oneios-dl-full=1 sheng-vsync-min=60 oneios-compile-s=120 oneios-snapshot-astc=0 oneios-camera-notify=1 oneios-m2v-shader-fix=1 oneios-dont-care=1 oneios-queue-priority=1 (docs/switches.md); all at their defaults
switches: session-mode=hosted stop-loop=wait takeover-reclaim=1 takeover-swappiness=keep task-trim=1 timer-coalesce=1 ram-fit-terms=tasks ram-ondemand=0 uclamp-rule=work gpu-down=governor gpu-kgsl-ui-rb=0 gpu-off-level=1 gpu-blob-entries=65532 wifi-ring-wait=1 wifi-send-wait=1 wifi-buffers=1 wifi-joined-scan=cache encoder-10bit=main10 encoder-warmup=1 display-post=apart display-present=ahb decoder=auto decoder-codecs=h264,hevc,vp9,av1 astc=1 sensors=auto sensors-hz=50 sensors-light=auto oneios-motion=0 oneios-als-spu=0 oneios-wifi-rssi=1 oneios-telemetry-jobs=0 oneios-pool-cut=1 oneios-pressure-big=512 oneios-disable-allowed=1 oneios-nested-exact=1 oneios-upgrade-flush=0 oneios-fill-fast-fault=1 oneios-audio-rt=1 oneios-audio-curve=1 oneios-codec-irq=1 oneios-idle-spares=1 oneios-bo-cache-idle=1 oneios-keep-room=8 oneios-dl-full=1 sheng-vsync-min=60 oneios-compile-s=120 oneios-snapshot-astc=0 oneios-camera-notify=1 oneios-m2v-shader-fix=1 oneios-dont-care=1 oneios-queue-priority=1 (docs/switches.md); all at their defaults
```

When some are changed, the end says which: `not at the default: wifi-send-wait gpu-down`. Kernel switches are read
Expand All @@ -52,6 +52,8 @@ change (the default value), and whether one has run the other value.
| `ram-fit-terms` | `tasks\|old` | `tasks` | tasks: ram=auto's 3b8742a terms (tasks, hold share, 1536 MiB headroom locked); old: the terms before 3b8742a (headroom 768 MiB locked / 1 GiB unlocked, page tables 8 %, no task cost, no hold share; any of those keys given still wins). With `task-trim=0` too this is the v0.1.19 sizing | this build (3b8742a) | tasks: no; old: v0.1.19's sessions |
| `uclamp-rule` | `work\|all` | `work` | work: xnuhost alone sets a vCPU thread's uclamp (0 at idle, the released thread's floor, the guest's request); drm2kgsl's animation boost only for the frame's threads; background/utility 0. all: before 03d85ac: drm2kgsl's boost on every started vCPU thread and every iOS thread not background, the cpufreq device sets the vCPU thread's clamp, nothing at idle | 03d85ac + this build | no |
| `gpu-down` | `governor\|bottom` | `governor` | governor: the GPU level leaves the top when a frame fits at the governor's clock in a burst (learned ratio); bottom: when it fits at KGSL's lowest clock (before 3b36ff0: on the S24 Ultra it never came down) | 3b36ff0 + this build | bottom: every session up to 21:11 (the GPU at the top all session); governor: no |
| `gpu-kgsl-ui-rb` | `0\|1` | `0` | 0: render server and front app run at KGSL priority 8 (out of Android's 4-7 UI ringbuffer, avoiding tile-memory collisions with One UI; drm2kgsl patch 0011, G5 of `docs/ports-2026-11-25-gpu.md`); 1: priority 4 (in the UI ringbuffer, as before) | `feat/takeover-drm-gpu` | no |
| `gpu-off-level` | `0\|1` | `1` | 1: hold KGSL at `KGSL_CONSTRAINT_PWR_MIN` while iOS's display is off (`brightness::display_on() == false`, drm2kgsl patch 0011, T4 of `docs/ports-2026-11-25-gpu.md`) so standby wakes do not boost the GPU; 0: render server stays at the governor's choice (as before) | `feat/takeover-drm-gpu` | no |
| `gpu-blob-entries` | `16384..65532` | `65532` | the most entries of a guest 3D blob the device takes; 16384: the limit before 78c4b86 (an 80 MiB blob of single pages refused; drm2kgsl 0010 keeps that from aborting) | 78c4b86 + this build | no |
| `wifi-ring-wait` | `0\|1` | `1` | 1: a frame for iOS that finds its receive ring full waits for the guest's kick (20 ms data, 50 ms the station's own); 0: dropped at once (before cbf97ea) | cbf97ea + this build | 1: 2026-11-23 19:40 |
| `wifi-send-wait` | `0\|1` | `1` | 1: a frame of iOS's that finds wlan0's send buffer full waits (256 at most, 20 ms); 0: it fails at once (`send failed, last errno 11`, before b704922) | b704922 + this build | 0: 19:40 (the old code); 1: no |
Expand Down Expand Up @@ -134,6 +136,8 @@ ram-fit-terms=tasks
ram-ondemand=0
uclamp-rule=work
gpu-down=governor
gpu-kgsl-ui-rb=0
gpu-off-level=1
gpu-blob-entries=65532
wifi-ring-wait=1
wifi-send-wait=1
Expand Down
2 changes: 1 addition & 1 deletion runtime/bridges/brightness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod session;
#[cfg(test)]
pub(crate) mod tests;

pub use session::{AlsFn, AlsSample, Bright, Info, Options, TraceFn};
pub use session::{display_on, AlsFn, AlsSample, Bright, Info, Options, TraceFn};

/// The level scale of the bridge channel (struct ob_bright_set; drivers/brightness/oneios_bl_request.h's
/// OBL_FRACTION_FULL).
Expand Down
9 changes: 9 additions & 0 deletions runtime/bridges/brightness/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ use std::os::fd::AsRawFd;
use std::os::unix::fs::FileExt;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};

/// Whether iOS's display is currently on (updated by [`Bright::display`]).
pub static DISPLAY_ON: AtomicBool = AtomicBool::new(true);

/// Returns whether iOS's display is currently on.
pub fn display_on() -> bool {
DISPLAY_ON.load(Ordering::Relaxed)
}
use std::sync::{Arc, Condvar, Mutex, PoisonError};
use std::thread::{self, JoinHandle};
use std::time::{Duration, Instant};
Expand Down Expand Up @@ -615,6 +623,7 @@ impl Bright {
/// off when nothing has set another, then the IC woken. A level of 0 alone does neither: it is a dim panel, not an
/// off one.
pub fn display(&self, on: bool, why: Option<&str>) {
DISPLAY_ON.store(on, Ordering::Relaxed);
{
let mut s = lock(&self.panel.state);
let was = s.display_on;
Expand Down
2 changes: 2 additions & 0 deletions runtime/display/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ adb shell su -c '/data/local/tmp/oneios-display-test/displayctl test -- --datasp
adb shell su -c '/data/local/tmp/oneios-display-test/displayctl test --seconds 20 --format rgba16f'
# what surfaceflinger has while it runs (second shell)
adb shell su -c 'dumpsys SurfaceFlinger --list' | grep OneiOS
# read-only DRM/KMS probe (stage 3a of docs/plan-ios-first-session.md; no master, nothing set)
adb shell su -c '/data/local/tmp/oneios-display-test/displayctl drm'
# clean up
adb shell su -c 'rm -rf /data/local/tmp/oneios-display-test'
```
Expand Down
22 changes: 21 additions & 1 deletion runtime/display/src/bin/displayctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Pattern {

fn usage() -> ExitCode {
eprintln!(
"usage: displayctl test [--seconds N] [--size WxH] [--format bgrx|rgba16f] [--helper PATH] [-- helper options]"
"usage: displayctl test [--seconds N] [--size WxH] [--format bgrx|rgba16f] [--helper PATH] [-- helper options]\n displayctl drm [PATH]"
);
ExitCode::from(2)
}
Expand Down Expand Up @@ -218,8 +218,28 @@ fn mkdtemp(template: &str) -> Result<PathBuf, Errno> {
Ok(PathBuf::from(String::from_utf8_lossy(&bytes).into_owned()))
}

fn run_drm(args: &[String]) -> ExitCode {
if args.len() > 3 {
return usage();
}
let path = args.get(2).map(String::as_str).unwrap_or("/dev/dri/card0");
match oneios_display::drm_probe::probe(path) {
Ok(report) => {
print!("{report}");
ExitCode::SUCCESS
}
Err(e) => {
eprintln!("displayctl drm: {e}");
ExitCode::from(1)
}
}
}

fn main() -> ExitCode {
let args: Vec<String> = std::env::args().collect();
if args.get(1).map(String::as_str) == Some("drm") {
return run_drm(&args);
}
let o = match parse(&args) {
Ok(o) => o,
Err(code) => return code,
Expand Down
Loading
Loading