mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
merge: refresh PRoot removal
This commit is contained in:
commit
d949407c5c
406 files changed
+41180
-3048
No files matched your search
@@ -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.
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user