Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.
C
The status bar's gradient without its filter: the white band is gone; the scroll's number corrected
yehorkaade050fd70005
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4732713..6f7b8d8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -21,11 +21,12 @@ changes to it; the scripts named fetch the release and put the changes on.## 2026-11-04-- metal: 120 frames a second is not reached: hakios-metal 101 in page swipes, 109 in Settings' scroll, 92 at the home button, 4% of frames over 16.7 ms; after the finger lifts, 185 of a swipe's 205 frames take 8.3 ms, while it drags 75 to 80 a second; `docs/reference/metal-measurements.md`+- metal: 120 frames a second is not reached: hakios-metal 101 to 103 in page swipes, about 90 in Settings' scroll, 89 to 92 at the home button, 4 to 6% of frames over 16.7 ms; after the finger lifts, 185 of a swipe's 205 frames take 8.3 ms, while it drags 75 to 80 a second; `docs/reference/metal-measurements.md`- springboard: `wallpaper_freeze=1` makes the wallpaper one picture, from the IOSurface on the panel (`kern.hakios.fb_surface`): home button 92 frames a second, against 28 with `wallpaper_cache=1` and 50 without either; the icons blink once, the wallpaper does not change until the next boot, and the lock screen shows the same picture- windows: `tools/metal-run.sh` sets `wallpaper_freeze=1` and `metal_defer=1`; an argument in `MORE` takes the place of a default of the same name- metal: 250 touch samples a second instead of 125 change nothing (100 to 102); `touch_poll_us` stays 4000 in `tools/metal-run.sh`-- display: `fb_beam=1`, the default: each thread's rows are written behind the panel's scan line (2433 lines, 8338 us), and to the eye the moving bands are gone; it costs no frames (Settings' scroll 109 against 89, home button 92 against 81, swipes 101 against 99)+- springboard: the status bar's legibility gradient (compositing filter `darkenSourceOver`) came out solid white over the top eighth of the home screen, on both Metal paths; it is drawn without the filter now, the wallpaper reaches the top and the status bar reads; why that filter's shader gives white is not known+- display: `fb_beam=1`, the default: each thread's rows are written behind the panel's scan line (2433 lines, 8338 us), and to the eye the moving bands are gone; it costs no frames (Settings' scroll 91 against 89, home button 89 to 92 against 81, swipes 101 against 99)- docs: a short README and a front page by what you came to do; `docs/reference/metal.md` and its measurements; every boot-argument of both Metal paths in the catalogue (`tools/boot-args.py` reads `hm_boot_arg_set`)- licenses: Turnip, AdrenoMetal, metal2vulkan and the plug-in's origin in `THIRD_PARTY_LICENSES.md`; a binary built with `M2V=1` has obligations and is **to verify** before any distributiondiff --git a/README.md b/README.mdindex 4511c12..aae9509 100644--- a/README.md+++ b/README.md@@ -10,7 +10,7 @@ Android.**Documentation:** [docs/](docs/index.md), and the site, [hackios-web.vercel.app](https://hackios-web.vercel.app).**News, 4 November 2026:** on the POCO X5 Pro 5G the window server draws through Metal on the Adreno 642L, two ways. hakios-metal: page-swipes 100 to 104 frames a second, Settings' scroll 109, the home button 92. UniXNU's Metal on Vulkan: swipes 50 to 57, scroll 41. The panel is 120 Hz,+swipes 100 to 104 frames a second, Settings' scroll about 90, the home button about 90. UniXNU's Metal on Vulkan: swipes 50 to 57, scroll 41. The panel is 120 Hz,and **120 frames a second has not been reached**. [Metal on the Adreno](docs/reference/metal.md),[the measurements](docs/reference/metal-measurements.md).diff --git a/README.uk.md b/README.uk.mdindex 4013b78..689d19d 100644--- a/README.uk.md+++ b/README.uk.md@@ -10,7 +10,7 @@**Документація:** [docs/](docs/index.md) (англійською) і сайт [hackios-web.vercel.app](https://hackios-web.vercel.app).**Новини, 4 листопада 2026:** на POCO X5 Pro 5G віконний сервер малює через Metal на Adreno 642L, двома шляхами. hakios-metal: гортання-сторінок 100–104 кадри на секунду, прокручування в Settings 109, кнопка «додому» 92. Metal поверх Vulkan від UniXNU: гортання 50–57, прокручування 41.+сторінок 100–104 кадри на секунду, прокручування в Settings близько 90, кнопка «додому» близько 90. Metal поверх Vulkan від UniXNU: гортання 50–57, прокручування 41.Панель працює на 120 Гц, і **120 кадрів на секунду не досягнуто**. [Metal на Adreno](docs/reference/metal.md),[вимірювання](docs/reference/metal-measurements.md).diff --git a/README.zh.md b/README.zh.mdindex c5e8fd6..075df98 100644--- a/README.zh.md+++ b/README.zh.md@@ -6,7 +6,7 @@**文档:** [docs/](docs/index.md)(英文),以及网站 [hackios-web.vercel.app](https://hackios-web.vercel.app)。-**动态,2026 年 11 月 4 日:** 在 POCO X5 Pro 5G 上,窗口服务器通过 Metal 在 Adreno 642L 上绘制,有两条路径。hakios-metal:翻页每秒 100 至 104 帧,Settings 滚动 109 帧,主屏幕按钮 92 帧。UniXNU 的 Metal on Vulkan:翻页 50 至 57 帧,滚动 41 帧。屏幕是 120 Hz,**尚未达到每秒 120 帧**。[Adreno 上的 Metal](docs/reference/metal.md),[测量结果](docs/reference/metal-measurements.md)。+**动态,2026 年 11 月 4 日:** 在 POCO X5 Pro 5G 上,窗口服务器通过 Metal 在 Adreno 642L 上绘制,有两条路径。hakios-metal:翻页每秒 100 至 104 帧,Settings 滚动约 90 帧,主屏幕按钮约 90 帧。UniXNU 的 Metal on Vulkan:翻页 50 至 57 帧,滚动 41 帧。屏幕是 120 Hz,**尚未达到每秒 120 帧**。[Adreno 上的 Metal](docs/reference/metal.md),[测量结果](docs/reference/metal-measurements.md)。从 [Getting started](docs/getting-started/index.md)、[On the phone](docs/getting-started/phone.md) 或 [Port a device](docs/porting/index.md) 开始。各部分的工作情况:[文档首页](docs/index.md#what-works)。diff --git a/docs/metal-plan.md b/docs/metal-plan.mdindex 396eb7c..a192708 100644--- a/docs/metal-plan.md+++ b/docs/metal-plan.md@@ -1,7 +1,7 @@# Metal on the Adreno: the plan, and where it stands**Where it stands, 4 November 2026.** The window server draws through Metal on the phone, on two paths, and the plan below is done as far-as that: hakios-metal at 100 to 104 frames a second in page swipes (109 in Settings' scroll), UniXNU's Metal on Vulkan at 50 to 57, on a 120 Hz panel. 120 has not+as that: hakios-metal at 100 to 104 frames a second in page swipes (about 90 in Settings' scroll), UniXNU's Metal on Vulkan at 50 to 57, on a 120 Hz panel. 120 has notbeen reached. What to read now: [Metal on the Adreno](reference/metal.md) and [the measurements](reference/metal-measurements.md).Everything below the next section is the record of how it went, with the dates, and says what was known then.diff --git a/docs/reference/metal-measurements.md b/docs/reference/metal-measurements.mdindex 5cf20e2..7f64df1 100644--- a/docs/reference/metal-measurements.md+++ b/docs/reference/metal-measurements.md@@ -24,7 +24,7 @@ metal2vulkan as measured on 3 November, before those.| Motion | hakios-metal | metal2vulkan ||---|---|---|| Page swipe | 101 (100 to 104 over the runs) | 50 to 57 |-| Settings' scroll | 109 | 41 |+| Settings' scroll | 89 to 91 (109 in one run of six, not repeated) | 41 || Opening an app | about 90 | not recorded || Home button | 92 | 41 to 57 || Frames over 16.7 ms | 4% | not recorded |@@ -58,7 +58,7 @@ On hakios-metal, each as the commit that made the change measured it, newest fir| Change | Before | After ||---|---|---|-| `wallpaper_freeze=1 metal_defer=1` | home button 50 (28 with `wallpaper_cache=1`); Settings' scroll 90; frames over 16.7 ms 9% | home button 92; scroll 109; 4%; swipes 101 |+| `wallpaper_freeze=1 metal_defer=1` | home button 50 (28 with `wallpaper_cache=1`); Settings' scroll 90; frames over 16.7 ms 9% | home button 89 to 92; scroll 91 (109 once); 4 to 6%; swipes 101 to 103 || Eight cores, not one, for the first boot | first frame at 159 s | 86 s || `fb_threads=6`, not 3 | Settings' scroll 75 | 84 || `wallpaper_cache=1` | swipes 85 to 91; an app's close 40 | swipes 97 to 103; an app's close 22 to 30, slower: the poster changes under its zoom |@@ -103,6 +103,6 @@ It costs no frames. The same run otherwise, 4 November:| | `fb_beam=1` | `fb_beam=0` ||---|---|---|| Page swipe | 101 | 99 |-| Settings' scroll | 109 | 89 |+| Settings' scroll | 91 | 89 || Home button | 92 | 81 || Frames over 16.7 ms | 4% | 6% |diff --git a/docs/reference/metal.md b/docs/reference/metal.mdindex 12a5cf4..6513645 100644--- a/docs/reference/metal.md+++ b/docs/reference/metal.md@@ -5,7 +5,7 @@ measure it, and what is not known. The numbers: [Metal measurements](metal-measu[the plan](../metal-plan.md).**Status, POCO X5 Pro 5G, 3 and 4 November 2026.** Both paths draw the system correctly. hakios-metal is the faster: page swipes 100-to 104 frames a second, Settings' scroll 109, the home button 92. metal2vulkan: swipes 50 to 57, scroll 41. **120 frames a second has not been+to 104 frames a second, Settings' scroll about 90, the home button about 90. metal2vulkan: swipes 50 to 57, scroll 41. **120 frames a second has not beenreached on either.** Neither is on by default: without `metal=1` the window server draws through OpenGL ES, as it always has.diff --git a/docs/ru/metal.md b/docs/ru/metal.mdindex 1a073cb..7301ad0 100644--- a/docs/ru/metal.md+++ b/docs/ru/metal.md@@ -2,7 +2,7 @@> **Обновление, 4 ноября 2026.** Этот разбор написан в октябре, и вывода раздела 4 («(В): ни то, ни другое») больше нет: теперь оконный> сервер рисует через Metal на Adreno 642L телефона, двумя путями, и оба рисуют правильно. **hakios-metal** (близко к пути (А) раздела 4,-> без Vulkan: AIR через NIR в ir3, собственные пакеты PM4): перелистывание страниц 100–104 кадра в секунду, прокрутка Settings 109, кнопка «домой» 92.+> без Vulkan: AIR через NIR в ir3, собственные пакеты PM4): перелистывание страниц 100–104 кадра в секунду, прокрутка Settings около 90, кнопка «домой» около 90.> **metal2vulkan** (стек UniXNU: фронтенд AdrenoMetal, metal2vulkan, Turnip — пути, которого в разделе 4 не было): перелистывание 50–57,> прокрутка 41. Панель 120 Гц; **120 кадров в секунду не достигнуто**. Без `metal=1` система по-прежнему рисует через OpenGL ES. Стена с> `default.metallib` снята не плагином: `tools/ca-metallib.py` делает эту библиотеку на вашей машине из того, что вы даёте сами. Чтоdiff --git a/userland/rc.jobs.layers b/userland/rc.jobs.layersnew file mode 100644index 0000000..26a75d6--- /dev/null+++ b/userland/rc.jobs.layers@@ -0,0 +1,3 @@+# Commands run by the launchd job com.hakios.demo (see com.hakios.demo.plist): unlock, and the layers SpringBoard has on+# the screen at the home screen (com.hakios.layers, see inject_sb.c), for what draws what where+/redwood/bin/rwtouch wait 30 swipe 0.5 0.985 0.5 0.3 200 wait 35 notify com.hakios.layers wait 10diff --git a/userland/src/inject_sb.c b/userland/src/inject_sb.cindex 6eed30f..b8bd496 100644--- a/userland/src/inject_sb.c+++ b/userland/src/inject_sb.c@@ -1111,6 +1111,77 @@ wallpaper_freeze(void)});}+/*+ * The status bar's legibility gradient at the top of the home screen (SBFStatusBarLegibilityView: a CAGradientLayer 100+ * points high, compositing filter darkenSourceOver) comes out solid white through Metal, on hakios-metal and metal2vulkan+ * alike: a white band over the top eighth of the wallpaper, the status bar's white text unreadable on it (seen on the+ * phone, 4 November; the layers said by com.hakios.layers). Why that filter's shader gives white has not been found out.+ * Without the filter the gradient is drawn as any other, source over, which is near enough what it is for and asks the+ * GPU for no read of what lies under it.+ */+static IMP legibility_layout_original;++static void+legibility_plain(id view)+{+ id sublayers = SEND(id, SEND(id, view, "layer"), "sublayers");+ unsigned long count = sublayers != NULL ? SEND(unsigned long, sublayers, "count") : 0;++ for (unsigned long i = 0; i < count; i++) {+ id layer = ((id (*)(id, SEL, unsigned long))objc_msgSend)(sublayers, sel_registerName("objectAtIndex:"), i);++ if (SEND(id, layer, "compositingFilter") != NULL) {+ ((void (*)(id, SEL, id))objc_msgSend)(layer, sel_registerName("setCompositingFilter:"), NULL);+ say("hakios: SpringBoard: the status bar's legibility gradient: its compositing filter taken off\n");+ }+ }+}++static void+legibility_layout(id self, SEL selector)+{+ ((void (*)(id, SEL))legibility_layout_original)(self, selector);+ legibility_plain(self);+}++/* the views there are already: they are laid out again only when something asks */+static void+legibility_find(id view, int depth)+{+ id subviews = SEND(id, view, "subviews");+ unsigned long count = subviews != NULL ? SEND(unsigned long, subviews, "count") : 0;++ if (strcmp(object_getClassName(view), "SBFStatusBarLegibilityView") == 0) {+ legibility_plain(view);+ }+ for (unsigned long i = 0; depth < 6 && i < count; i++) {+ legibility_find(((id (*)(id, SEL, unsigned long))objc_msgSend)(subviews, sel_registerName("objectAtIndex:"), i), depth + 1);+ }+}++static void+legibility_gradient(void)+{+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 15 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{+ Class view = objc_getClass("SBFStatusBarLegibilityView");+ SEL layout = sel_registerName("layoutSubviews");+ id app = SEND(id, objc_getClass("UIApplication"), "sharedApplication");+ id windows = app != NULL ? SEND(id, app, "windows") : NULL;+ unsigned long count = windows != NULL ? SEND(unsigned long, windows, "count") : 0;++ if (view == NULL) {+ return;+ }+ if (legibility_layout_original == NULL) {+ legibility_layout_original = class_getMethodImplementation(view, layout);+ class_replaceMethod(view, layout, (IMP)legibility_layout, "v@:");+ }+ for (unsigned long i = 0; i < count; i++) {+ legibility_find(((id (*)(id, SEL, unsigned long))objc_msgSend)(windows, sel_registerName("objectAtIndex:"), i), 0);+ }+ });+}+static voidwallpaper_cache(void){@@ -1858,6 +1929,7 @@ hakios_springboard_init(void)ui_lite();wallpaper_cache();wallpaper_freeze();+ legibility_gradient();original_lock_long_press = (void (*)(id, SEL, id))replace_method("SBLockHardwareButton", "longPress:", 0x1c4f6ab44UL,(IMP)lock_long_press);poster_switcher = replace_method("SBMainDisplayPolicyAggregator", "_allowsCapabilityPosterSwitcherWithExplanation:",