Performance: the client and game core masks, from Bannerlator's Linux session

A Steam session runs two things that want different cores at the same time,
and one affinity cannot serve both (Bannerlator cfca3912).

The client is the case that prompted it: Steam pins its own interface renderer
to a subset of cores it chooses - five of eight on one device, leaving out both
little cores and the fastest one - reasonable while a game is running and wrong
when the client is all there is, where it shows as Big Picture feeling sluggish.
BL_CLIENT_CPUS overrides it, re-applied on a beat by the session script because
steamwebhelper spawns children continuously and each inherits Steam's choice.
That block is Bannerlator's, verbatim. One deliberate difference: the client's
mask is sent whenever the override is on, even when it names every core,
because undoing Steam's pin is the whole point and the scheduler's default is
exactly what that pin takes away.

A game gets BL_GAME_CPUS instead, consumed by the Proton wrappers that r27
already carries, and as in Bannerlator it is sent only when it is a real
restriction: a list naming every core is what the scheduler does unaided.

Both live behind a Performance dialog with a checkbox per core, labelled with
its ceiling, and apply at the next session start.
This commit is contained in:
The412Banner committed 2026-09-21 10:49:34 -04:00
1 parent fbe3737dc4
commit beab4e7849
8 files changed
+242

No files matched your search

@@ -33,7 +33,10 @@ import com.steamdeck.launcher.session.ProtonExtras
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.ui.ProtonDialog
import com.steamdeck.launcher.ui.ProtonRow
import com.steamdeck.launcher.core.CpuCores
import com.steamdeck.launcher.ui.AudioDialog
import com.steamdeck.launcher.ui.CoreRow
import com.steamdeck.launcher.ui.PerformanceDialog
import com.steamdeck.launcher.ui.DriverDialog
import com.steamdeck.launcher.ui.DriverRow
import com.steamdeck.launcher.ui.ConfirmDialog
@@ -75,6 +78,10 @@ class MainActivity : ComponentActivity() {
private var protonRows by mutableStateOf<List<ProtonRow>>(emptyList())
private var showDrivers by mutableStateOf(false)
private var showAudio by mutableStateOf(false)
private var showPerformance by mutableStateOf(false)
private var clientOverride by mutableStateOf(false)
private var clientCores by mutableStateOf<Set<Int>>(emptySet())
private var gameCores by mutableStateOf<Set<Int>>(emptySet())
private var directAudio by mutableStateOf(false)
private var mic by mutableStateOf(false)
private var linuxRows by mutableStateOf<List<DriverRow>>(emptyList())
@@ -121,6 +128,7 @@ class MainActivity : ComponentActivity() {
onProtons = { refreshProtons(); showProtons = true },
onDrivers = { refreshDrivers(); showDrivers = true },
onAudio = { directAudio = SessionPrefs.directAudio(this); mic = SessionPrefs.micEnabled(this); showAudio = true },
onPerformance = { refreshCores(); showPerformance = true },
onCredits = { showCredits = true },
)
if (showApps) DesktopAppsDialog(
@@ -161,6 +169,20 @@ class MainActivity : ComponentActivity() {
},
onDismiss = { showAudio = false },
)
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,
onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on },
onClientCore = { core, on ->
clientCores = if (on) clientCores + core else clientCores - core
SessionPrefs.setClientCpus(this, CpuCores.format(clientCores))
},
onGameCore = { core, on ->
gameCores = if (on) gameCores + core else gameCores - core
SessionPrefs.setGameCpus(this, CpuCores.format(gameCores))
},
onDismiss = { showPerformance = false },
)
if (showRemove) ConfirmDialog(
title = "Remove Linux runtime",
text = "This deletes the runtime, the Steam client inside it, and every game installed there.",
@@ -293,6 +315,13 @@ class MainActivity : ComponentActivity() {
null
}
/** The two masks as the dialog shows them; an empty stored list shows as every core ticked. */
private fun refreshCores() {
clientOverride = SessionPrefs.clientCpusOverride(this)
clientCores = CpuCores.parse(SessionPrefs.clientCpus(this)).ifEmpty { CpuCores.all.toSet() }
gameCores = CpuCores.parse(SessionPrefs.gameCpus(this)).ifEmpty { CpuCores.all.toSet() }
}
private fun refreshProtons() {
protonRows = ProtonExtras.tools.map { ProtonRow(it.id, it.name, ProtonExtras.installed(this, it), ProtonExtras.queued(this, it)) }
}