From d7038a2b507efb591b0aa72e869aaec933ece0a5 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Mon, 21 Sep 2026 11:38:37 -0400 Subject: [PATCH] Performance: sysmem and Zink lazy-descriptor switches The two tunables the Fold experiment needs, as switches under Performance rather than files in Downloads: TU_DEBUG=sysmem for the runtime's Turnip and ZINK_DESCRIPTORS=lazy for the client's menus. The Downloads files still win. --- README.md | 7 ++++ .../com/steamdeck/launcher/MainActivity.kt | 7 ++++ .../launcher/session/SessionPrefs.kt | 14 +++++++ .../launcher/session/SessionService.kt | 5 +++ .../launcher/ui/PerformanceDialog.kt | 37 +++++++++++++++++++ 5 files changed, 70 insertions(+) diff --git a/README.md b/README.md index e1ee62f7ac..8a97dd9f38 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,13 @@ separate because they are wanted at the same time and suit different things: Both apply at the next session start. +Under the same dialog, two **driver tunables** for a runtime that renders slowly, tried one at a +time: **Turnip: sysmem rendering** (`TU_DEBUG=sysmem`, Banners-Turnip's advice for an Adreno 8xx that +looks glitchy or slow; a 710/720/722 gets it on its own) and **Zink: lazy descriptors** +(`ZINK_DESCRIPTORS=lazy`, for Steam's menus, which Chromium draws through Zink — the first thing to +try when they are slow while games are fast). The `steamdeck-tu-debug` and `steamdeck-env` files in +Downloads still win over both. + ## Compatibility tools **Compatibility tools** (main screen and drawer) installs GE-Proton or proton-cachyos — native diff --git a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt index 7507aae885..2f232c8cf4 100644 --- a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt @@ -82,6 +82,8 @@ class MainActivity : ComponentActivity() { private var clientOverride by mutableStateOf(false) private var clientCores by mutableStateOf>(emptySet()) private var gameCores by mutableStateOf>(emptySet()) + private var tuSysmem by mutableStateOf(false) + private var zinkLazy by mutableStateOf(false) private var directAudio by mutableStateOf(false) private var mic by mutableStateOf(false) private var linuxRows by mutableStateOf>(emptyList()) @@ -172,7 +174,10 @@ class MainActivity : ComponentActivity() { if (showPerformance) PerformanceDialog( cores = CpuCores.all.map { c -> CoreRow(c, "cpu$c" + (CpuCores.maxGhz(c)?.let { String.format(java.util.Locale.US, " · %.1f GHz", it) } ?: "")) }, clientOverride = clientOverride, clientCores = clientCores, gameCores = gameCores, + tuSysmem = tuSysmem, zinkLazy = zinkLazy, onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on }, + onTuSysmem = { on -> SessionPrefs.setTuSysmem(this, on); tuSysmem = on }, + onZinkLazy = { on -> SessionPrefs.setZinkLazy(this, on); zinkLazy = on }, onClientCore = { core, on -> clientCores = if (on) clientCores + core else clientCores - core SessionPrefs.setClientCpus(this, CpuCores.format(clientCores)) @@ -320,6 +325,8 @@ class MainActivity : ComponentActivity() { clientOverride = SessionPrefs.clientCpusOverride(this) clientCores = CpuCores.parse(SessionPrefs.clientCpus(this)).ifEmpty { CpuCores.all.toSet() } gameCores = CpuCores.parse(SessionPrefs.gameCpus(this)).ifEmpty { CpuCores.all.toSet() } + tuSysmem = SessionPrefs.tuSysmem(this) + zinkLazy = SessionPrefs.zinkLazy(this) } private fun refreshProtons() { diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt index 79eb96fa29..6d7579d8a8 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt @@ -105,6 +105,20 @@ object SessionPrefs { prefs(context).edit().putString("gameCpus", list).apply() } + /** Turnip's sysmem rendering (TU_DEBUG=sysmem) for the runtime's driver: bypasses GMEM tiling. */ + fun tuSysmem(context: Context): Boolean = prefs(context).getBoolean("tuSysmem", false) + + fun setTuSysmem(context: Context, on: Boolean) { + prefs(context).edit().putBoolean("tuSysmem", on).apply() + } + + /** Zink's lazy descriptor mode (ZINK_DESCRIPTORS=lazy) for the client's GL-on-Vulkan UI. */ + fun zinkLazy(context: Context): Boolean = prefs(context).getBoolean("zinkLazy", false) + + fun setZinkLazy(context: Context, on: Boolean) { + prefs(context).edit().putBoolean("zinkLazy", on).apply() + } + /** The Android driver the compositor loads: "" = pick by GPU, else a bundled or imported id. */ @JvmStatic fun androidDriver(context: Context): String = prefs(context).getString("androidDriver", "") ?: "" diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt index 36a48d4369..b0175dda13 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt @@ -88,6 +88,7 @@ class SessionService : Service() { val override = File(Environment.getExternalStorageDirectory(), TU_DEBUG_SWITCH) .takeIf { it.isFile }?.let { FileUtils.readString(it)?.trim() } if (!override.isNullOrEmpty()) return override + if (SessionPrefs.tuSysmem(this)) return "sysmem" if (linuxDriverId.isEmpty()) return null val name = LinuxVulkanDriverManager(this).getDriverName(linuxDriverId).lowercase() return if (name.contains("710-720") || name.contains("710_720")) "sysmem" else null @@ -144,6 +145,10 @@ class SessionService : Service() { // imported driver from the A710/A720/A722 legs gets "sysmem" on its own, which is what both // its authors advise for those GPUs and what nothing else in the list needs. tuDebug(linuxDriverId)?.let { guest.add("TU_DEBUG=$it") } + // Zink renders the client's UI (Chromium -> ANGLE -> Zink -> Turnip). Lazy descriptors is + // the mode Zink recommends where the driver has no descriptor buffer, and what Ludashi ships + // by default for its Zink path; a switch here because on one Fold the menus run at 14 fps. + if (SessionPrefs.zinkLazy(this)) guest.add("ZINK_DESCRIPTORS=lazy") // Anything else, for a device that cannot be reached with a debugger: Downloads/steamdeck-env // holds KEY=VALUE lines that go into the session's environment as written, after ours, so a // line here wins. Zink and Turnip tunables (ZINK_DESCRIPTORS=lazy, MESA_*), gamescope's, diff --git a/app/src/main/java/com/steamdeck/launcher/ui/PerformanceDialog.kt b/app/src/main/java/com/steamdeck/launcher/ui/PerformanceDialog.kt index 4bab672c94..398b3ae151 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/PerformanceDialog.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/PerformanceDialog.kt @@ -34,7 +34,11 @@ fun PerformanceDialog( clientOverride: Boolean, clientCores: Set, gameCores: Set, + tuSysmem: Boolean, + zinkLazy: Boolean, onClientOverride: (Boolean) -> Unit, + onTuSysmem: (Boolean) -> Unit, + onZinkLazy: (Boolean) -> Unit, onClientCore: (Int, Boolean) -> Unit, onGameCore: (Int, Boolean) -> Unit, onDismiss: () -> Unit, @@ -73,6 +77,39 @@ fun PerformanceDialog( ) Spacer(Modifier.height(4.dp)) CoreGrid(cores, gameCores, enabled = true, onToggle = onGameCore) + + Spacer(Modifier.height(12.dp)) + HorizontalDivider() + Spacer(Modifier.height(10.dp)) + + Text("Driver tunables", style = MaterialTheme.typography.titleSmall) + Text( + "Two switches for a runtime that renders slowly, tried one at a time. Both apply at the next session start.", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) { + Column(modifier = Modifier.weight(1f)) { + Text("Turnip: sysmem rendering", style = MaterialTheme.typography.bodyMedium) + Text( + "Renders without the GPU's tile memory (TU_DEBUG=sysmem). Banners-Turnip's own advice for an Adreno 8xx that looks glitchy or slow, and required on a 710/720/722 (set on its own there).", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + Switch(checked = tuSysmem, onCheckedChange = onTuSysmem) + } + Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) { + Column(modifier = Modifier.weight(1f)) { + Text("Zink: lazy descriptors", style = MaterialTheme.typography.bodyMedium) + Text( + "The Steam client's menus are drawn through Zink (GL on Vulkan). Lazy descriptor updates (ZINK_DESCRIPTORS=lazy) is the mode Zink recommends on drivers without descriptor buffers, and the first thing to try when the menus are slow while games are fast.", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + Switch(checked = zinkLazy, onCheckedChange = onZinkLazy) + } } }, confirmButton = { TextButton(onClick = onDismiss) { Text("OK") } },