mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-30 18:15:42 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5f622f168 |
No files matched your search
@@ -190,6 +190,7 @@ object BwrapSpawner {
|
||||
val env = LinkedHashMap<String, String>()
|
||||
request.optJSONObject("env")?.let { e -> e.keys().forEach { k -> env[k] = e.getString(k) } }
|
||||
withoutRootfsSettings(env, rootfs)
|
||||
sdlAudioOnPulse(env)
|
||||
val envTool = request.optString("envTool").takeIf { it.startsWith("/") }
|
||||
if (envTool == null && binds.any { it.guest == "/dev" }) {
|
||||
val glIcd = coveringBind(GL_ICD_DIR) != null && File(hostPath(binds, root.path, GL_ICD_DIR)).isDirectory
|
||||
@@ -220,6 +221,17 @@ object BwrapSpawner {
|
||||
}
|
||||
}
|
||||
|
||||
private val SDL_AUDIO_DRIVER_KEYS = listOf("SDL_AUDIODRIVER", "SDL_AUDIO_DRIVER")
|
||||
|
||||
internal fun sdlAudioOnPulse(env: MutableMap<String, String>) {
|
||||
if (env["PULSE_SERVER"].isNullOrEmpty()) return
|
||||
for (key in SDL_AUDIO_DRIVER_KEYS) {
|
||||
val drivers = env[key]?.split(',')?.map { it.trim() } ?: continue
|
||||
if (drivers.none { it.equals("pipewire", true) } || drivers.any { it.equals("pulseaudio", true) }) continue
|
||||
env[key] = drivers.map { if (it.equals("pipewire", true)) "pulseaudio" else it }.joinToString(",")
|
||||
}
|
||||
}
|
||||
|
||||
private const val GPU_DIR = "/run/droiddeck-gpu"
|
||||
private const val GL_ICD_DIR = "/usr/lib/aarch64-linux-gnu/GL/vulkan/icd.d"
|
||||
|
||||
|
||||
@@ -77,6 +77,31 @@ class BwrapSpawnerTest {
|
||||
assertEquals("x11", x11["SDL_VIDEODRIVER"])
|
||||
}
|
||||
|
||||
@Test fun sdlPinnedToPipewireUsesTheSessionsPulseServer() {
|
||||
val pulse = "unix:/run/flatpak/pulse/native"
|
||||
val pinned = mutableMapOf("SDL_AUDIODRIVER" to "pipewire", "PULSE_SERVER" to pulse)
|
||||
BwrapSpawner.sdlAudioOnPulse(pinned)
|
||||
assertEquals("pulseaudio", pinned["SDL_AUDIODRIVER"])
|
||||
val sdl3 = mutableMapOf("SDL_AUDIO_DRIVER" to "PipeWire, alsa", "PULSE_SERVER" to pulse)
|
||||
BwrapSpawner.sdlAudioOnPulse(sdl3)
|
||||
assertEquals("pulseaudio,alsa", sdl3["SDL_AUDIO_DRIVER"])
|
||||
}
|
||||
|
||||
@Test fun otherSdlAudioChoicesAreKept() {
|
||||
val noPulse = mutableMapOf("SDL_AUDIODRIVER" to "pipewire")
|
||||
BwrapSpawner.sdlAudioOnPulse(noPulse)
|
||||
assertEquals(mapOf("SDL_AUDIODRIVER" to "pipewire"), noPulse)
|
||||
val pulse = "unix:/run/flatpak/pulse/native"
|
||||
for (choice in listOf("pipewire,pulseaudio", "alsa", "dummy")) {
|
||||
val env = mutableMapOf("SDL_AUDIODRIVER" to choice, "PULSE_SERVER" to pulse)
|
||||
BwrapSpawner.sdlAudioOnPulse(env)
|
||||
assertEquals(choice, env["SDL_AUDIODRIVER"])
|
||||
}
|
||||
val unset = mutableMapOf("PULSE_SERVER" to pulse)
|
||||
BwrapSpawner.sdlAudioOnPulse(unset)
|
||||
assertEquals(mapOf("PULSE_SERVER" to pulse), unset)
|
||||
}
|
||||
|
||||
@Test fun sourcesNamedByTheirKernelPathReachTheSessionsMounts() {
|
||||
val files = "/data/user/0/com.droiddeck.launcher/files"
|
||||
val kernel = "/data/data/com.droiddeck.launcher/files"
|
||||
|
||||
@@ -59,6 +59,10 @@ The spawner also adds what the rootfs gives its own programs:
|
||||
Chromium and Electron apps use zypak's mimic strategy (`ZYPAK_ZYGOTE_STRATEGY_SPAWN=0`). The
|
||||
Flatpak portal's Spawn refuses a caller whose `/proc/<pid>/root` holds no `.flatpak-info`,
|
||||
and a proot sandbox's root is the host's.
|
||||
- **Audio.** The session's sound server is PulseAudio, and Flatpak binds its socket in for apps that ask
|
||||
for it. An app that pins SDL to PipeWire (`SDL_AUDIODRIVER=pipewire`, as Chiaki-ng's does) gets
|
||||
`pulseaudio` in its place when that socket is there. Otherwise SDL finds no PipeWire server and the
|
||||
app quits at start.
|
||||
- **CPU.** `/proc/cpuinfo` without the cores' part numbers. Snapdragon's ARMv9 cores imply SVE2
|
||||
to LLVM, Qualcomm leaves SVE off, and llvmpipe's first shader died with SIGILL.
|
||||
|
||||
|
||||
Reference in new issue
Block a user