mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
fix(native): proot fast path turns off and greys out while running without proot
This commit is contained in:
1 parent
c0bcebc919
commit
1008da4e8d
6 files changed
+19
-9
No files matched your search
@@ -12,15 +12,16 @@ object ProotFastPath {
|
|||||||
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
|
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
|
||||||
const val MAX_BINDS = 256
|
const val MAX_BINDS = 256
|
||||||
|
|
||||||
fun allows(preference: Boolean, noSeccomp: Boolean, source: String): Boolean =
|
fun allows(preference: Boolean, noSeccomp: Boolean, source: String, nativeUserland: Boolean = false): Boolean =
|
||||||
preference && !noSeccomp && source == LinuxRuntime.PROOT_PACK
|
preference && !noSeccomp && !nativeUserland && source == LinuxRuntime.PROOT_PACK
|
||||||
|
|
||||||
fun enabled(context: Context): Boolean {
|
fun enabled(context: Context): Boolean {
|
||||||
val preference = SessionPrefs.prootFastPath(context)
|
val preference = SessionPrefs.prootFastPath(context)
|
||||||
val noSeccomp = SessionPrefs.prootNoSeccomp(context)
|
val noSeccomp = SessionPrefs.prootNoSeccomp(context)
|
||||||
|
val nativeUserland = SessionPrefs.nativeUserland(context)
|
||||||
val source = LinuxRuntime.prootSource(context)
|
val source = LinuxRuntime.prootSource(context)
|
||||||
val on = allows(preference, noSeccomp, source)
|
val on = allows(preference, noSeccomp, source, nativeUserland)
|
||||||
if (preference && !noSeccomp && !on)
|
if (preference && !noSeccomp && !nativeUserland && !on)
|
||||||
Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
|
Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
|
||||||
return on
|
return on
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ object SessionFiles {
|
|||||||
if (patched > 0) Log.i(TAG, "native userland: $patched system call sites in ld.so and libc answer Android's blocked calls")
|
if (patched > 0) Log.i(TAG, "native userland: $patched system call sites in ld.so and libc answer Android's blocked calls")
|
||||||
com.droiddeck.launcher.runtime.NativeGuest.syncLibraryDirs(root)
|
com.droiddeck.launcher.runtime.NativeGuest.syncLibraryDirs(root)
|
||||||
}
|
}
|
||||||
if (ProotFastPath.enabled(context) && !nativeUserland) {
|
if (ProotFastPath.enabled(context)) {
|
||||||
val library = com.droiddeck.launcher.agent.AgentEnv.fastPathLibrary(context)
|
val library = com.droiddeck.launcher.agent.AgentEnv.fastPathLibrary(context)
|
||||||
preload.append(library + "\n")
|
preload.append(library + "\n")
|
||||||
if (startsSession && library != ProotFastPath.LIBRARY) Log.i(TAG, "fast path preload: $library (debugging override)")
|
if (startsSession && library != ProotFastPath.LIBRARY) Log.i(TAG, "fast path preload: $library (debugging override)")
|
||||||
|
|||||||
@@ -666,7 +666,7 @@ class SessionService : Service() {
|
|||||||
|
|
||||||
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir)
|
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir)
|
||||||
val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this)
|
val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this)
|
||||||
val fastPathKey = if (ProotFastPath.enabled(this) && !nativeUserland) {
|
val fastPathKey = if (ProotFastPath.enabled(this)) {
|
||||||
val prootBinds = LinuxRuntime.binds(
|
val prootBinds = LinuxRuntime.binds(
|
||||||
this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds,
|
this, sessionRoot, runtimeDir, Environment.getExternalStorageDirectory(), binds,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -189,9 +189,13 @@ fun PerformancePage(
|
|||||||
)
|
)
|
||||||
ToggleRow(
|
ToggleRow(
|
||||||
host, "fastpath", stringResource(R.string.perf_fastpath),
|
host, "fastpath", stringResource(R.string.perf_fastpath),
|
||||||
if (prootNoSeccomp) stringResource(R.string.perf_fastpath_needs_seccomp)
|
when {
|
||||||
else stringResource(R.string.perf_fastpath_hint),
|
nativeUserland -> stringResource(R.string.perf_fastpath_needs_proot)
|
||||||
prootFastPath && !prootNoSeccomp, enabled = !prootNoSeccomp, onChange = onProotFastPath,
|
prootNoSeccomp -> stringResource(R.string.perf_fastpath_needs_seccomp)
|
||||||
|
else -> stringResource(R.string.perf_fastpath_hint)
|
||||||
|
},
|
||||||
|
prootFastPath && !prootNoSeccomp && !nativeUserland, enabled = !prootNoSeccomp && !nativeUserland,
|
||||||
|
onChange = onProotFastPath,
|
||||||
)
|
)
|
||||||
ToggleRow(
|
ToggleRow(
|
||||||
host, "nativeuserland", stringResource(R.string.perf_native_userland),
|
host, "nativeuserland", stringResource(R.string.perf_native_userland),
|
||||||
|
|||||||
@@ -651,6 +651,7 @@
|
|||||||
<string name="perf_native_userland">Run without proot (experimental)</string>
|
<string name="perf_native_userland">Run without proot (experimental)</string>
|
||||||
<string name="perf_native_userland_hint">Starts the Linux side directly on Android. Applies to the next session. Turn off if something fails to start.</string>
|
<string name="perf_native_userland_hint">Starts the Linux side directly on Android. Applies to the next session. Turn off if something fails to start.</string>
|
||||||
<string name="perf_fastpath">proot fast path</string>
|
<string name="perf_fastpath">proot fast path</string>
|
||||||
|
<string name="perf_fastpath_needs_proot">Not used without proot.</string>
|
||||||
<string name="perf_fastpath_needs_seccomp">Needs proot\'s seccomp filter.</string>
|
<string name="perf_fastpath_needs_seccomp">Needs proot\'s seccomp filter.</string>
|
||||||
<string name="perf_fastpath_hint">Faster file lookups and less stutter. Turn off if a program can\'t find its files.</string>
|
<string name="perf_fastpath_hint">Faster file lookups and less stutter. Turn off if a program can\'t find its files.</string>
|
||||||
<string name="perf_cursor_composite">Draw the cursor inside gamescope</string>
|
<string name="perf_cursor_composite">Draw the cursor inside gamescope</string>
|
||||||
|
|||||||
@@ -33,4 +33,8 @@ class ProotFastPathTest {
|
|||||||
assertFalse(ProotFastPath.allows(preference = false, noSeccomp = false, source = LinuxRuntime.PROOT_PACK))
|
assertFalse(ProotFastPath.allows(preference = false, noSeccomp = false, source = LinuxRuntime.PROOT_PACK))
|
||||||
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = true, source = LinuxRuntime.PROOT_PACK))
|
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = true, source = LinuxRuntime.PROOT_PACK))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun fastPathStaysOffWithoutProot() {
|
||||||
|
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = false, source = LinuxRuntime.PROOT_PACK, nativeUserland = true))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user