merge: refresh PRoot removal

This commit is contained in:
Kurt Himebauch committed 2026-12-05 16:30:33 -05:00
commit d949407c5c
406 files changed
+41180 -3048

No files matched your search

+3 -1
View File
@@ -24,7 +24,9 @@ ways:
| `app/src/testDebug/.../ui/PreviewRenderTest.kt` | The render test |
Previews cover the launcher on each tab (Steam, Library, Library with no games, Stores, Downloads, Settings, Settings with
no runtime) and the in-game menu's pages (Controller, Display, HUD, Session, and the Desktop menu).
no runtime), the in-game menu's pages (Controller, Display, HUD, Session, and the Desktop menu), and the frosted
background: the Steam and Library tabs, Settings with frosted cards and with both transparencies at 100 %, and a
settings step opened over frosted page text.
## Adding one
+54
View File
@@ -0,0 +1,54 @@
# Easy Anti-Cheat and BattlEye
On a Steam Deck, Proton loads Valve's anti-cheat runtimes (Proton EasyAntiCheat Runtime, app 1826330, and
Proton BattlEye Runtime, app 1161040). Their bridge libraries are x86 only, so the ARM64 DroidDeck-Proton
cannot load them. Games that need them run an x86-64 DroidDeck-Proton under FEX instead.
## Routing
The Proton launchers (`steam-compatibility`: the built-in DroidDeck-Proton launcher and the wrapper put around
every tool in `compatibilitytools.d`) check each `run` and `waitforexitandrun` before any ARM64 setup:
- **Condition.** The game folder (`STEAM_COMPAT_INSTALL_PATH`, three levels deep) holds one of
`EasyAntiCheat/Settings.json`, `easyanticheat_x64.so`, `BEClient_x64.so` or `BEService_x64.exe`. No
title, app ID or device list is involved.
- **Chosen tool.** Only launches through DroidDeck's own Proton (the built-in launcher or a `DroidDeck-Proton*`
folder) are moved. A game set to any other tool, such as GE-Proton, Bionic or Valve's Proton, in DroidDeck or
in Steam's Properties, runs on that tool and the launcher logs that it was chosen.
- **Tool.** The newest `compatibilitytools.d/DroidDeck-Proton*` whose layout is x86-64
(`files/lib/wine/x86_64-unix`, no `files/bin-arm64`).
- **Runtime.** `PROTON_EAC_RUNTIME` or `PROTON_BATTLEYE_RUNTIME` when it already points at a folder with the
bridge libraries, otherwise the runtime's folder in any Steam library.
- **Launch.** `droiddeck-fex proton <tool>/proton <verb> <args>`: FEX with the Steam Linux Runtime rootfs,
keeping the game's own `STEAM_COMPAT_DATA_PATH` prefix.
Without the x86-64 tool or the runtime files the launch stays on ARM64 and the launcher logs why.
`DROIDDECK_ANTICHEAT=off` in the game's launch options keeps it on ARM64. Picking the x86-64 tool for a
game in Steam always runs it under FEX.
## Why the x86-64 build needs its own Wine patches
Android kernels use 39-bit user address spaces. Easy Anti-Cheat's launcher maps fixed memory at
`0x7001_0000_0000`, which FEX serves from emulated guest pages (`tools/fex/patches/0027`). Exclusive load and store pairs on that
memory are emulated as a compare-and-swap, so hosts without LSE atomics work too. `tools/fex/probes/guest-high-memory.c`
checks loads, stores, atomics, iovec system calls, `madvise` and code written through a high alias. The x86-64 Wine
in DroidDeck-Proton carries `ntdll-fixed-allocations-above-host-address-limit.patch` (fixed mappings above
the host limit go to the emulator) and `ntdll-keep-libc-in-native-syscall-dispatch-range.patch` (the
re-armed syscall user dispatch range keeps libc native). Stock x86-64 Proton stops after "Hack native
syscalls" on the same game.
Easy Anti-Cheat's launcher attaches to the game with ptrace, stops it on a `rt_sigprocmask` call, runs its
own loader and restores the registers it saved at the stop. The call then returns `ENOSYS` without writing
the old mask, as it does on a desktop kernel. `ntdll-retry-blocking-signals-dropped-by-a-tracer.patch`
retries the block once when it fails, so Wine never restores an uninitialised mask that blocks `SIGSYS`.
## The container's procfs
Android mounts `/proc` with `hidepid=invisible,gid=3009`, and Easy Anti-Cheat refuses that mount with
launch error 261. Without root, user namespaces or PID namespaces, no procfs instance without those options
can be mounted. Every program in the container runs as the app's user and already sees all of the
container's processes, as it would in a PID-namespaced sandbox on a desktop, so FEX's emulated
`/proc/<pid>/mounts` and `/proc/<pid>/mountinfo` show the proc mount without `hidepid=`, `gid=` and
`subset=` (`tools/fex/patches/0029`). Only x86 programs under FEX see this view; every other line of the
table is the host's. Processes of other Android users stay hidden, as host processes do from a desktop
sandbox.
+3 -2
View File
@@ -50,8 +50,9 @@ feature-level or game compatibility changes.
- Compare the same scene on baseline main and this branch: FG off/on, Linear,
FSR, GSR, GSR HQ, NIS, FSR Fit, sharpen-only and nearest.
- Test each supported interpolation multiplier, both engines, warm-up/no
generated frames, 720p-to-1080p and 1080p-to-panel scaling, and no upscale.
- Test each supported interpolation multiplier on LSFG, DDFG and ZeroFG,
including warm-up/no generated frames, 720p-to-1080p and 1080p-to-panel
scaling, and no upscale.
- Check real and generated frames for consistent sharpness, halos, ghosting,
text/cursor artifacts, black bars, stretching and frame-order errors.
- Change resolution/filter/engine/multiplier live; open Steam/QAM, rotate,
+9 -1
View File
@@ -117,7 +117,7 @@ the UI shows a restart reminder instead of enabling logs that would be discarded
| `PROTON_LOG` | `1` |
| `PROTON_LOG_DIR`, `PROTON_CRASH_REPORT_DIR`, `DXVK_LOG_PATH` | The actual session log directory |
| `DXVK_LOG_LEVEL` | `debug` |
| `VKD3D_DEBUG` | `info` |
| `VKD3D_DEBUG`, `VKD3D_SHADER_DEBUG` | `warn` |
| `WINEDEBUG` | Valid custom channels plus Proton's standard diagnostic channels |
Diagnostics take precedence over conflicting inherited, shared, or per-game log
@@ -193,6 +193,14 @@ A Unity game under FEX (`UnityPlayer.dll` for Windows builds under Proton,
turns it off: without TSO such games can deadlock or crash (seen with Megabonk
and Crab Game). A FEX preset chosen for the game itself still applies.
A game that ships the PlayStation PC SDK runtime installer
(`install_pspc_sdk_runtime.bat`, `PsPcSdkRuntimeInstaller.msi` or
`PsPcSdkRuntimeManager.msi`, next to the executable, one folder below, or in an
Unreal launcher's `<Project>/Binaries/Win64`) gets FEX's full x87 precision.
The SDK's obfuscated x87 code depends on full precision; with reduced precision
the game crashes or hangs at startup (FEX-Emu/FEX#4556, FEX-Emu/FEX#5988). A
FEX preset or value chosen for the game itself still applies.
An Inno Setup installer added as a game runs with the Stability preset's FEX
settings (full TSO, full x87 precision, no multiblock). Under the default
Performance + TSO preset the 32-bit setup stub corrupts its own paths and stops
@@ -0,0 +1,19 @@
# Opt-in producer acquire fences for Steam
[Thor investigation and captured benchmark](https://github.com/Droid-Deck/DroidDeck/pull/3636).
The existing copy path is the default. In Steam display settings, **Direct game frames (experimental)** is a separate opt-in, applied at the next session. It requires zero-copy presentation, an eligible Adreno/native-worker Steam session, and a signed APK containing a capable Gamescope asset. The next normal session without the option, or a session with custom or Agent launch environment overrides, sees no private host global. Non-compatible clients and older components keep their current path. This is not a trust boundary against arbitrary code already executing as the Android app UID.
## Source and lifetime
- APK preparation verifies the Gamescope archive digest. At run time, the app compares the staged executable against the signed APK copy. It also checks the staged session script. No Agent executable, user environment, debug property, or test key can arm the host. Only a launch of the exact staged Gamescope path can qualify.
- One app-owned session prepares a short-lived worker ticket. Only the matching Steam backend launch can consume it. The dedicated, app-bound non-exported Worker reports its own PID/start time through the existing local Binder exchange, not into a guest message. The broker uses a live pidfd, a matching start time, and an exact executable mapping after exec. If Android hides the pre-exec stat entry, the Worker receipt is provisional only until the same timestamp is observable after exec. A malformed or wrong timestamp, wrong executable, stale worker, or no pidfd denies the private global. The bound grant remains scoped to that worker and is revoked on stop or worker exit.
- Gamescope only offers v1 to nested clients after negotiating v1 with that authenticated host. Mesa must export a real native sync_file for that particular attachment. Gamescope ties it to the exact submitted buffer/commit, waits on its duplicate normally, and forwards only a successful, signaled fence for unchanged source content. It cannot use a source fence as proof for composited output. The host consumes only a matching attachment's genuine successful fence and retains existing release and copy behavior. No fence, failed export, unsupported buffer, missing global, or X11-only path is not a license to scan out unsynchronized content.
## Validation and rollout gates
The historical controlled build on Thor used the same APK/components in both arms, the same Bright Family House camera with 120/no VSync and Steam limiter off at 60 Hz. Independent Android actual-presentation timestamps measured **21.08 FPS OFF → 37.42 FPS ON**. The compositor separately submitted 42.5–42.6 FPS on the direct path. This validates the technical approach, not the final candidate or physical panel behavior.
Before default changes or release: after testing the exact signed candidate with the intended Gamescope and Turnip binaries, record OFF/ON same-scene timestamps and direct/layer/full/verified-acquire counters; old producer/host, malformed/missing proof, X11/FIFO and unsupported import should use safe fallback. Exercise cap changes, pause/resume, Home→return, and a cold restart to verify no stale fence/buffer/cap state. Test boot with the option off. Use an external camera on the actual panel for tearing/corruption; Android captures cannot settle it. Keep the feature off by default and hold rollout if these checks do not pass.
The APK pins the SHA-256 of [the exact tested Gamescope archive](https://github.com/Droid-Deck/DroidDeck-Components/releases/tag/gamescope-3.16.29-verified-acquire-v1), promoted without rebuilding or replacing the previous release. It includes the signed APK capability marker. A compatible DD-Turnip producer is still required for actual direct frames: an older driver or missing fence retains the copy path even if the option is enabled.
+34
View File
@@ -42,3 +42,37 @@ Gradient in the list, and Setup shows a Speed slider (1 to 10, `SessionPrefs.rgb
Compose applies Android's animator scale to it, and the colour holds still when animations are off in the app (`Motion.scale`) or in Android's own settings. The hue is written to `Themes.rgbHue` in 3° steps, which restyles the
app only when the colour visibly moves; a slow cycle costs few recompositions.
## Frosted background
Setup › Launcher › Frosted (`SessionPrefs.launcherFrost`, off by default) is the master switch. Under it, while it is
on, sit Frosted wallpaper and Frosted cards (`frostWallpaper`, `frostCards`, both on by default, so the first time
Frosted is turned on both apply at their defaults), each with its own transparency from 0 to 100 % in steps of 10
(`frostTransparency` from 80 %, `frostCardTransparency` from 50 %). Frosted cards is greyed out while Frosted wallpaper is
off, since a card can only show the wallpaper the page behind it shows; each slider stays in place and is greyed out
while it has nothing to set.
Frosted wallpaper shows the device's wallpaper, blurred, behind the launcher. Android draws it: the launcher's window
is see-through and carries `FLAG_SHOW_WALLPAPER` and `FLAG_BLUR_BEHIND`, so the app never reads the wallpaper and needs
no permission (`ui/LauncherFrost.kt`). It works with any theme except True black, which keeps the page unlit.
Over the wallpaper sits one veil of the theme's `background` (`frostLook`). 0 % is nearly solid and 100 % shows the most
wallpaper. While the frost shows, the theme moves `onSurfaceVariant` toward `onBackground` (`Palette.frosted`): halfway
up to 50 %, and further above it, all the way at 100 %. The veil grows past the chosen transparency only as far as that
hint text needs to keep 4.5:1, on the page and on a card (the rail and the bottom bar are cards here), as far as the
theme's own colours allow: a Custom theme whose hint text matches its background stays unreadable with or without the
frost. Android reports only a wallpaper's main colours, and any part of it can sit behind text, so the check takes the
worst wallpaper there is: white under a dark theme and black under the light one. The veil is then about 0.7 at 50 %,
0.63 at 80 % and 0.6 at 100 % on a dark theme, and 0.7, 0.57 and 0.52 on the light one. The wallpaper slider starts at
80 % so the wallpaper shows about as much as the game page's glass (0.58) does.
`LocalFrost` carries the veil and the launcher's root steps aside. With Frosted cards on, the theme hands out `surface`
and `surfaceVariant` see-through by the card transparency (0.6 on a dark theme and 0.74 on the light one at 50 %, solid at 0 %), and dialogs, popups, menus and
settings steps take the solid palette back (`SolidSurfaces`), so no page text shows through them. The rail and the bottom bar draw
`surface`, so they follow the cards: see-through with them and solid without.
The rows show on Android 12 and later when the system can blur behind windows, and also while Battery Saver pauses the
blur, when the page shows the plain background until the blur returns. A window is see-through or not from its first
frame, so the launcher prepares its window whenever the wallpaper frost is on at start, whether or not the blur is
available then. Turning the wallpaper frost on restarts the launcher once only if the window was not prepared at start;
otherwise turning it off and on, and the blur pausing and coming back, switch between the frost and the plain
background at once.
+14 -3
View File
@@ -216,9 +216,10 @@ alone would then read as an installed client.
NullReferenceException, internal CLR errors). A writable mapping or mprotect now write-protects the
overlapping part of any alias that is already executable, so the first write faults and invalidates.
`FEX_SMCCHECKS=full` was the only workaround; no setting is needed with the patch.
- `0007-cmake-install-code-without-depends`: CMake 4.5 rejects the `DEPENDS` argument FEX passes to
`install(CODE ...)` for the guest thunk libraries, so builds with host thunks stopped at configure.
The guest libraries are external projects in the default build, which `install` already follows.
- `0007-cmake-install-code-without-depends` (`Fixed-upstream: FEX-2612`): CMake 4.5 rejects the
`DEPENDS` argument FEX passes to `install(CODE ...)` for the guest thunk libraries, so builds with
host thunks stopped at configure. The guest libraries are external projects in the default build,
which `install` already follows.
- `0008-signal-return-restores-syscall-state`: a guest `rt_sigreturn` is a system call, so FEX's
syscall stub marks every static register as spilled (`InSyscallInfo = 0xFFFF`). When the handler
left RIP alone, the return resumed the interrupted JIT code without passing the stub's reset, and
@@ -303,6 +304,16 @@ alone would then read as an installed client.
hook records the guest handler as it does for `sigaction()` and keeps its own installed, so a
program that sets a crash handler is no longer killed by the next blocked system call
(`tools/tests/test_native_hook_sigsys_mask.py`).
- `0020-guest-stack-clear-of-host-stack-reserve`: FEX places the guest's 128 MB stack range
with `MAP_FIXED_NOREPLACE`, scanning down from the top of the address space. With a 39-bit address
space the host stack sits in that top range in about one start in eight, and the guest stack then
landed directly below it, inside the space the kernel keeps free for the host stack to grow
(`RLIMIT_STACK`, at least 128 MB). A deep host call chain (the native userland's `execve` hook
and libc `syscall()` wrappers) then grew the host stack into the top of the guest stack, where
the guest's argument and environment strings live, and the next program started with a corrupted
environment (Proton failing with `KeyError: 'PWD'` or "No compat data path"). The guest stack is
now placed below that reserve. On a Retroid Pocket Duo, 100 nested Proton starts ran clean, 10 of
them with the host stack at the top; without the patch 3 of 25 were corrupted.
- **Building and publishing.** Droid-Deck/DroidDeck-Components' `build-fex.yml` builds `tools/fex` from
this repository at a chosen ref (default `main`) with host thunks, in the same Arch Linux ARM container
with a read-only token, then a separate job replaces `fex.tzst` on Components' single `fex` release,
+53 -3
View File
@@ -171,7 +171,7 @@ there.
### B. Exec-in-place workers for long-lived processes
Declare a pool of `android:process` services (`:g0`…`:g95`). Each long-lived program runs as the
Declare a pool of `android:process` services (`:g0`…`:g127`). Each long-lived program runs as the
main process of one worker (Gap 2): full app privileges, direct GPU, normal signals and `/proc`
(same uid and SELinux domain), and the app hears its exit through binder death. Costs and limits:
@@ -261,8 +261,29 @@ vfork-safe (Python's subprocess execs under `vfork`). Details that mattered:
session (KDE Plasma, 17–19 counted at rest), a Konsole running 40 `sleep 600 &` jobs peaked at
61 counted and lost 27 processes to Android's limit (Konsole, D-Bus, the portal) before this, and
at 20 with no kills after. Still counted, and not handed off: a terminal's foreground jobs (a
`make -j` and its compilers), the D-Bus daemon's activation helpers (forks that never exec) and
the desktop's own programs started by KDE's launchers.
`make -j` and its compilers) and the D-Bus daemon's activation helpers (forks that never exec).
- **The desktop.** Plasma's own programs are listed (`startplasma-wayland`, `plasma_session`,
KWin, `kded6`, `ksmserver`, `plasmashell`, PowerDevil, KDE Connect, the KIO workers, the D-Bus
activated portal, dconf and activity manager) along with DroidDeck's desktop helpers. Discover's
update notifier, GeoClue's demo agent and the global-menu proxy are off in the user's Autostart.
A program a desktop launcher starts (`DD_HANDOFF_LAUNCHERS`: Plasma's shell, KRunner, Dolphin)
goes to a worker when it is a plain fork and exec: in the launcher's process group and session,
with no controlling terminal. Those launchers are Qt programs, which wait with `waitpid()` once
the hook has taken their pidfds away. A terminal's shell (its own session and terminal) stays.
Firefox runs with fission off, at most two web content processes and no crash helper. The
desktop and its apps use about 80 workers with Steam and a game running, hence 128.
Counted children on the Thor (main: the session as #3338 and #3594 left it):
| | main | this |
|---|---|---|
| desktop at rest | 30 | 0 |
| Dolphin, Konsole, Firefox, Kate and System Settings open | not measured (49 on a Pocket FIT without Firefox, the terminal running 40 jobs) | 7 |
| those, the desktop's Steam client and Bully running | not measured | 20 (30 with 64 workers: Wine's services were refused one) |
With Bully running, six scans forced with the stock limit of 32 killed nothing. What stays
counted then: Steam's client and launch chain (10), Firefox's helpers (6), Konsole's shell,
Proton's script and `wineserver`.
Default list: the portals, at-spi, `python3`, PipeWire, WirePlumber, Decky's PluginLoader, the log's
`gnudd`, `xprop -spy`, the web helper's renderers, `wine`, `wine-preloader`, `wineserver`.
@@ -509,6 +530,35 @@ the old behavior and the old requirement.
7. A (the isolated tier) only if B stops working on a future Android; it needs a file and socket
broker and keeps the GPU outside.
## Zombies
Every session process is a child subreaper (`tools/linuxfs/preload/subreaper.c`, so that a
double-forked Xwayland is not left to init, which some vendor kernels kill), and most programs
never wait for a child they did not fork. What they adopted stayed a zombie: the grandchildren of
Qt's `startDetached()` under Plasma's shell, KWin and kaccess, Wine's double-forked processes,
wlroots' Xwayland under gamescope. A parent that never waits at all (Plasma's shell, for what it
launches) also kept the forked child of each program it handed off. On the Thor, main had 4
zombies in Steam mode at rest and 19 in Bully, and the desktop gained one per app closed.
The hook now reaps them from SIGCHLD (`ddh_reap_unclaimed()`):
- **Adopted:** each process records, at its pid, the parent that started it and its own start
time, in one file for the session (`DD_PARENTS`). A fork's child does it at the fork, any other
program at its start. A zombie child whose record names another parent was adopted. An own child
(recorded with this parent, or with no record, such as a static program a `vfork()` started) is
left for its program's wait.
- **A handed-off program's forked child,** as a wait's look reaps it: the program's exit stays in
the table for the parent's wait.
The program's SIGCHLD action runs first, and `sigaction()` shows it as the program set it.
`SIG_IGN` and `SA_NOCLDWAIT` stay the kernel's. A program that leaves SIGCHLD alone gets the
handler only when `DD_REAP_ADOPTED` names it (Plasma's programs, D-Bus, gamescope, Wine's
launchers, Decky's loader): with a handler, `poll()`, `sleep()` and the like return `EINTR` when a
child exits. With these changes there are no zombies left in either mode, Bully included.
qemu-user has no `PR_SET_CHILD_SUBREAPER`, so the adoption tests skip under it (CI) and were run on
the Thor's kernel.
## Robustness
- Gap 1's path mismatch is a bug that could be fixed; the app-zygote skip is deliberate. Use app
+1
View File
@@ -32,6 +32,7 @@ Links of the form `droiddeck://settings/<section>` open a Settings section direc
| Controller | Settings › Controller (`droiddeck://settings/controller`) | gamepad, buttons, mapping, profile, remap |
| Smart glasses | Settings › Smart glasses (`droiddeck://settings/glasses`) | xreal, viture, vr, ar |
| Theme | Settings › Launcher (`droiddeck://settings/launcher`) | color, dark |
| Frosted | Settings › Launcher (`droiddeck://settings/launcher`) | blur, wallpaper, background, cards, transparent, transparency, opacity, glass |
| App scale | Settings › Launcher (`droiddeck://settings/launcher`) | size, zoom |
| App icon | Settings › Launcher (`droiddeck://settings/launcher`) | |
| Animations | Settings › Launcher (`droiddeck://settings/launcher`) | |
+23
View File
@@ -0,0 +1,23 @@
# Chinese input
The app ships a pinyin input method payload with the session files; it needs no network at run time.
## Android keyboard
1. Select your Android input method (for example Sogou or Gboard) in the system settings, then start a DroidDeck session and open its Android keyboard.
2. Type pinyin, pick a candidate, and commit it; confirm mixed Chinese/Latin and emoji text such as `中文` and `😀` arrives in the focused field, and that a backspace or Enter sent after a commit stays after it.
## Steam on-screen keyboard
Steam pinyin requires a Linux runtime built with IBus. The APK installs the pinyin engine and its data, but does not replace an installed Linux runtime. A runtime without IBus can still start Steam and cannot offer pinyin until it is updated.
Start a Steam session, open Steam's on-screen keyboard on a text field, switch it to Simplified Chinese (pinyin), and confirm committing a candidate puts the characters in the field. Physical keys, shortcuts, and Latin input keep working as before.
## X11 text-input fallback
For clients without native Wayland text input, committed Android IME text is delivered to the focused X11 display.
- **One focused display.** Text goes only to the focused X11 display.
- **Mappings stay stable.** Each keysym keeps its keycode and mapping until the helper exits, because clients may decode key events after they arrive.
- **Capacity is finite.** Only originally empty, non-modifier, unheld keycodes 8..255 can be reserved (at most 248 per display, in practice fewer); a frame that needs more distinct symbols than remain is refused before anything is injected, so restart the session to reclaim the slots.
- **Scope of the limitation.** Steam's own built-in IBus pinyin keyboard and native Wayland text input do not use this fallback and are not subject to it.