feat: adjustable RAM and VRAM caps for the container (#1537)

* feat: adjustable RAM and VRAM caps for the container

Performance > Memory gets two sliders:

- RAM cap (soft, Steam sessions): when the session is resident above the
  cap, the session watcher compresses the Steam client into zRAM, waits for
  its page-out acknowledgment, then compresses the rest of the session
  (processes that loaded libblsession) if still over. Nothing is closed.
  Measured at most every 30 s; the client is read back once usage drops
  below the cap. Invalid values leave the cap off. Needs zRAM swap.
- VRAM cap: sets dxgi.maxDeviceMemory ahead of the game's own DXVK_CONFIG,
  so Direct3D games budget for less video memory. A game profile still
  wins. Applies from the next session.

* fix: back off the RAM cap when paging out cannot get under it

A cap below the game's working set was never met, so the watcher paged out
the client and the whole session every 30 s for the rest of the session.
Usage is still measured every 30 s, but after a page-out that leaves the
session over the cap the next one waits twice as long (60 s up to 10 min),
resetting once usage is under the cap. The client step is skipped while the
client is already under 512 MB resident.

* fix: RAM cap covers desktop Steam, signals each group once, no idle churn

- Steam opened from the desktop runs the same session watcher, so the cap
  is exported whenever the Steam client runs, not only in Steam mode.
- The second page-out goes to the rest of the session only; Steam was
  signalled again even when its own step had been skipped as already small.
- A cap page-out while no game runs stays paged out. Reading the client back
  right away pushed it over the cap again and repeated every minute; only a
  game closing while over the cap still defers a read-back.

* fix: RAM cap marks the client packed only when it compressed it

When the cap skipped the client as already small during a game, it still
recorded the client as packed, so the regular in-game client page-out
waited up to 300 s for a page-out that never happened.

---------

Co-authored-by: jazzyjames <182448902+jazzyjamesgames@users.noreply.github.com>
This commit is contained in:
Jamison Prineandjazzyjames authored and GitHub committed 2026-10-25 12:06:45 -04:00
1 parent dfe8227f49
commit 2be08bc67d
10 files changed
+180 -13

No files matched your search

+8
View File
@@ -552,6 +552,14 @@
<string name="perf_gsrealtime">gamescope: realtime GPU queue</string>
<string name="perf_gsrealtime_hint">Prioritizes the compositor\'s GPU work. Can smooth frame pacing at some cost to games.</string>
<string name="perf_gpu">GPU</string>
<string name="perf_memory">Memory</string>
<string name="perf_cap_off">Off</string>
<string name="perf_cap_auto">Driver default</string>
<string name="perf_ram_cap">RAM cap</string>
<string name="perf_ram_cap_hint">Applies while the Steam client runs, in Steam mode or from the desktop. When the session uses more than this, Steam and then the session\'s other supported processes are compressed into zRAM. A soft cap: nothing is closed, but games may stutter while pages come back.</string>
<string name="perf_ram_cap_unavailable">Needs zRAM swap, which this device does not have.</string>
<string name="perf_vram_cap">VRAM cap</string>
<string name="perf_vram_cap_hint">The video memory DXVK reports to Direct3D games, so they budget textures for less. A game\'s own DXVK settings still win. Takes effect at the next session.</string>
<string name="perf_gpuclock">Hold the GPU at its top clock</string>
<string name="perf_gpuclock_hint">Adreno only. Fewer hitches, more battery use and heat.</string>
<string name="perf_fixes">Session fixes</string>