Skip to content

Restrict FFP fastpath shim to external storage volumes - #1843

Merged
utkarshdalal merged 3 commits into
masterfrom
imagefs-bump-investigation-a3222c
Aug 20, 2026
Merged

Restrict FFP fastpath shim to external storage volumes#1843
utkarshdalal merged 3 commits into
masterfrom
imagefs-bump-investigation-a3222c

Conversation

@utkarshdalal

@utkarshdalal utkarshdalal commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Description

1.2.0's store-agnostic FFP gate (bad4d39) enables the fastpath shim for any game whose A: drive is under /storage/ — including internal shared storage (/storage/emulated/), where the shim's benefit was never measured. A user's game (custom game imported as a Steam game, installed under /storage/emulated/0/Download/Games/steamapps/common/) refused to boot on 1.2.0: the environment came up but the guest process died before wine printed a single line. Setting FFP_DISABLE=1 in the container env vars fixed it, confirming the shim kills the guest at process bootstrap on that combination (bionic container, proton-11.0-1-arm64ec, FEXCore 2604). The same gate is the prime suspect for the wider custom-game perf regression reports on internal storage.

This restores the original intent of the gate: FFP only activates when the game tree is on a non-emulated /storage volume (SD cards / USB), where its win is device-validated (BL2 6.5min → seconds). Internal-storage games — where metadata ops are already dcache-fast — no longer get the shim. Game source no longer matters, so custom games imported as Steam games are covered too. FFP_DISABLE=1 remains available as a per-container kill switch.

Follow-up (not this PR): reproduce and fix the shim's process-bootstrap crash with proton-11-arm64ec/FEX so external-storage installs of those containers don't hit it.

Recording

Not applicable — env var gating change, no UI.

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0aca1d8d-d5a3-47cb-88d0-fb1e9adce671

📥 Commits

Reviewing files that changed from the base of the PR and between c5b7e2c and 0ae8047.

📒 Files selected for processing (1)
  • app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The X server screen now enables FFP environment variables for /storage/ game paths, except custom games rooted at /storage/emulated/. The /Android/data/ requirement was removed.

Changes

FFP environment configuration

Layer / File(s) Summary
Exclude custom game paths
app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt
The condition excludes /storage/emulated/ custom-game paths before setting FFP_ENABLE and FFP_MARKERS. It no longer requires /Android/data/.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 0ae80

The change narrows fastpath-shim use for custom games on internal storage while preserving existing behavior elsewhere; no actionable merge-blocking risk remains after normal checks.

Suggested reviewers: nightwalker743, joshuatam

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: disabling the FFP fastpath shim for custom games on internal storage.
Description check ✅ Passed The description explains the cause, scope, rationale, affected game types, and checklist status; it also explains why no recording applies.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch imagefs-bump-investigation-a3222c

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@utkarshdalal utkarshdalal changed the title Don't enable FFP fastpath shim for custom games Scope FFP fastpath shim to Android/data paths Aug 20, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt">

<violation number="1" location="app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt:3842">
P2: The new path-only gate re-enables the FFP shim for custom games whose drive A happens to live under /Android/data/ on external storage, which contradicts the PR goal ("custom games no longer get gating variables automatically") and its own trade-off note. Custom game A: paths come from user-selected folders (SteamService customGameManualFolders), so a custom game placed under /storage/.../Android/data/ now matches `contains("/Android/data/")` and receives FFP_ENABLE/FFP_MARKERS — the scenario the description's trade-off implies should not get the boot-speedup shim. Keep the custom-game exclusion in addition to the path check.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

.firstOrNull { it[0] == "A" }?.let { File(it[1]).canonicalFile.path }
}.getOrNull() ?: ""
if (ffpGameDir.startsWith("/storage/")) {
if (ffpGameDir.startsWith("/storage/") && ffpGameDir.contains("/Android/data/")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new path-only gate re-enables the FFP shim for custom games whose drive A happens to live under /Android/data/ on external storage, which contradicts the PR goal ("custom games no longer get gating variables automatically") and its own trade-off note. Custom game A: paths come from user-selected folders (SteamService customGameManualFolders), so a custom game placed under /storage/.../Android/data/ now matches contains("/Android/data/") and receives FFP_ENABLE/FFP_MARKERS — the scenario the description's trade-off implies should not get the boot-speedup shim. Keep the custom-game exclusion in addition to the path check.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt, line 3842:

<comment>The new path-only gate re-enables the FFP shim for custom games whose drive A happens to live under /Android/data/ on external storage, which contradicts the PR goal ("custom games no longer get gating variables automatically") and its own trade-off note. Custom game A: paths come from user-selected folders (SteamService customGameManualFolders), so a custom game placed under /storage/.../Android/data/ now matches `contains("/Android/data/")` and receives FFP_ENABLE/FFP_MARKERS — the scenario the description's trade-off implies should not get the boot-speedup shim. Keep the custom-game exclusion in addition to the path check.</comment>

<file context>
@@ -3839,7 +3839,7 @@ private fun setupXEnvironment(
                 .firstOrNull { it[0] == "A" }?.let { File(it[1]).canonicalFile.path }
         }.getOrNull() ?: ""
-        if (ffpGameDir.startsWith("/storage/") && gameSource != GameSource.CUSTOM_GAME) {
+        if (ffpGameDir.startsWith("/storage/") && ffpGameDir.contains("/Android/data/")) {
             envVars.put("FFP_ENABLE", "1")
             envVars.put("FFP_MARKERS", "/steamapps/common/;/dosdevices/a:")
</file context>
Suggested change
if (ffpGameDir.startsWith("/storage/") && ffpGameDir.contains("/Android/data/")) {
if (ffpGameDir.startsWith("/storage/") && ffpGameDir.contains("/Android/data/") && gameSource != GameSource.CUSTOM_GAME) {

Comment thread app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt Outdated
@utkarshdalal

Copy link
Copy Markdown
Owner Author

Closing — the /storage/ gate on master is the correct, device-validated design. The shim's win was measured on public storage paths too, so excluding custom games (or narrowing to Android/data) would regress their boot times. The custom-game perf reports need a different explanation.

@utkarshdalal
utkarshdalal deleted the imagefs-bump-investigation-a3222c branch August 20, 2026 09:48
@utkarshdalal utkarshdalal reopened this Aug 20, 2026
@utkarshdalal utkarshdalal changed the title Scope FFP fastpath shim to Android/data paths Disable FFP fastpath shim for custom games on internal storage Aug 20, 2026
@utkarshdalal
utkarshdalal merged commit c38bfca into master Aug 20, 2026
3 checks passed
@utkarshdalal utkarshdalal changed the title Disable FFP fastpath shim for custom games on internal storage Restrict FFP fastpath shim to external storage volumes Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant