feat: Steam's Frame Limit decides; gamescope and the limit follow the refresh rate (#1650)

Remove the Performance mode switch. The session always runs the way
Performance mode did: replaced buffers go back to the game at once
(except while mirroring to glasses), gamescope's WSI layer and winex11
reuse their per-present window checks, and games get eight swapchain
images while uncapped. Steam's Frame Limit in the Quick Access menu is
the only limit.

gamescope 3.16.29-p15 (p14 plus two patches):
- 0119: with the Frame Limit on, gamescope forces FIFO while the WSI
  layer hands the driver MAILBOX, so a game with eight images could
  queue up to seven frames ahead of the screen. While the limiter forces
  FIFO the layer uses its default of 3 images; DXVK and VKD3D-Proton
  recreate their swapchain when the limiter changes, other apps are asked
  to with VK_SUBOPTIMAL_KHR.
- 0120: -r fixed gamescope's pacing and limiter rate for the whole
  session. With GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST=1 a rate the host
  has reported for 300 ms replaces it (a switch from 144 to 120 Hz passes
  through 72 Hz for a few frames), and Steam gets the display information
  again. The session sets it whenever it passes -r.

Steam keeps its Frame Limit as the client setting
gamescope_app_target_framerate and offers the values gamescope's display
state lists. After a refresh change, a limit the new rate does not offer
(72 at 120 Hz) left the slider on its first value while the game kept the
old limit. The Steam helper watches the offered values and, once they
settle, keeps the limit when it is still offered and moves it to the
highest value otherwise, through Steam's own setting so the slider shows
it. Steam's webpack does not expose its module cache, so the gamescope
service is found by the calls its module makes, and the helper retries
the install every 10 s until Steam is ready.

The session window asks for the fastest mode the peak refresh setting
allows and chose again only when the display changed, so after it had
asked for 60 Hz, raising Android's refresh setting left the display,
gamescope and the limit at 60. It now also chooses again when
peak_refresh_rate or min_refresh_rate changes.
This commit is contained in:
The412Banner authored and GitHub committed 2026-10-26 23:17:35 -04:00
1 parent 0e9a31ccfe
commit 4c7e59ed8b
52 files changed
+466 -133

No files matched your search

+37 -2
View File
@@ -96,8 +96,7 @@ running AIO Graphics Test uncapped, Xwayland used 24-32% of a core and the game'
present thread sat about half idle.
The patch can keep the result for `DROIDDECK_WSI_BYPASS_CHECK_MS` milliseconds. Unset
or 0 keeps the per-present check; the app sets 100 only in Performance mode and 0
otherwise. With 100, a window resize or a flip/obscure change is seen up to 100 ms
or 0 keeps the per-present check; the app sets 100. With 100, a window resize or a flip/obscure change is seen up to 100 ms
later than before; surface creation and capability queries still check every time.
## 0118 Wayland: preserve signed plane positions
@@ -121,3 +120,39 @@ The old component lost the image in Fill and magnification. The tested executabl
matches the pinned p14 archive and the locally assembled APK. Hardware checks used
native Gamescope properties; the physical Back+LB shortcut was not independently
confirmed. The original APK and runtime were restored after validation.
## 0119 WSI: default image count while the frame limiter runs
The app sets `GAMESCOPE_WSI_MIN_IMAGE_COUNT=8` so an uncapped game keeps drawing while
gamescope turns its buffers around. With Steam's Frame Limit on, gamescope forces FIFO,
and the layer always hands the driver MAILBOX, so a game with eight images could queue
up to seven frames inside gamescope before it blocked: each one adds a frame of input
latency at the limited rate.
While the limiter forces FIFO, the layer now reports and enforces its default minimum
of 3 images instead of the raised count; with the limiter off it uses the raised count
as before. DXVK and VKD3D-Proton already recreate their swapchain when the limiter
changes (the layer returns `VK_ERROR_OUT_OF_DATE_KHR`), so their image count follows
the Quick Access menu. Other apps keep their swapchain on a limiter change; they now
get `VK_SUBOPTIMAL_KHR` while their image count no longer matches, unless the layer
marks them as not taking it (`NoSuboptimal`).
## 0120 Wayland: nested refresh follows the host
`-r` fixes the refresh gamescope paces at, and the frame limiter and Steam's Frame Limit
slider use the same value. The app passes the panel refresh at session start, so a
panel switched to another mode during the session (for example in the device's own
quick settings) left gamescope pacing at the old rate until the next session; only the
reported output refresh changed.
With `GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST=1`, a refresh the host compositor reports
through presentation feedback replaces the `-r` value, so pacing and the limiter switch
with the panel. `-r` still sets the starting rate, which avoids gamescope assuming
60 Hz until the first frame is shown. When the refresh changes, gamescope also sends
its `gamescope_control` display information to Steam again; Steam otherwise reads it
only when it binds.
A host mode switch can report a passing rate for a few frames (72 Hz between 144 and
120 Hz on the AYANEO Pocket FIT), so with following on a new rate is taken once it has
been reported for 300 ms. Without the variable the reported rate is taken at once, as
upstream does.
@@ -0,0 +1,59 @@
diff --git a/layer/VkLayer_FROG_gamescope_wsi.cpp b/layer/VkLayer_FROG_gamescope_wsi.cpp
index ea4ba84..46d086c 100644
--- a/layer/VkLayer_FROG_gamescope_wsi.cpp
+++ b/layer/VkLayer_FROG_gamescope_wsi.cpp
@@ -201,6 +201,13 @@ namespace GamescopeWSILayer {
return s_minImageCount;
}
+ // The raised count keeps an uncapped game drawing while gamescope turns its buffers around.
+ // Under the frame limiter's FIFO the extra images only queue frames ahead of the screen,
+ // so a limited swapchain gets the default count.
+ static uint32_t getMinImageCount(bool forcingFifo) {
+ return forcingFifo ? std::min(getMinImageCount(), 3u) : getMinImageCount();
+ }
+
static bool getEnsureMinImageCount() {
static bool s_ensureMinImageCount = []() -> bool {
if (auto ensure = parseEnv<bool>("GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT")) {
@@ -984,7 +991,7 @@ namespace GamescopeWSILayer {
pSurfaceCapabilities->currentExtent = rect->extent;
}
- pSurfaceCapabilities->minImageCount = getMinImageCount();
+ pSurfaceCapabilities->minImageCount = getMinImageCount(gamescopeIsForcingFifo(gamescopeSurface->waylandObjects));
return VK_SUCCESS;
}
@@ -1027,7 +1034,7 @@ namespace GamescopeWSILayer {
pSurfaceCapabilities->surfaceCapabilities.currentExtent = rect->extent;
}
- pSurfaceCapabilities->surfaceCapabilities.minImageCount = getMinImageCount();
+ pSurfaceCapabilities->surfaceCapabilities.minImageCount = getMinImageCount(gamescopeIsForcingFifo(gamescopeSurface->waylandObjects));
return VK_SUCCESS;
}
@@ -1305,7 +1312,7 @@ namespace GamescopeWSILayer {
uint32_t minImageCount = swapchainInfo.minImageCount;
if (getEnsureMinImageCount())
- minImageCount = std::max(getMinImageCount(), minImageCount);
+ minImageCount = std::max(getMinImageCount(gamescopeIsForcingFifo(gamescopeSurface->waylandObjects)), minImageCount);
swapchainInfo.minImageCount = minImageCount;
fprintf(stderr, "[Gamescope WSI] Creating swapchain for xid: 0x%0x - oldSwapchain: %p - provided minImageCount: %u - minImageCount: %u - format: %s - colorspace: %s - flip: %s\n",
@@ -1627,6 +1634,13 @@ namespace GamescopeWSILayer {
continue;
}
+ // Other apps keep their swapchain when the limiter changes; ask them to recreate it so
+ // the image count follows the limiter as well.
+ if (!frameLimiterAware && gamescopeSwapchain->forceFifo != forceFifo &&
+ getMinImageCount(true) != getMinImageCount(false) &&
+ !(gamescopeSurface->flags & GamescopeLayerClient::Flag::NoSuboptimal))
+ UpdateSwapchainResult(VK_SUBOPTIMAL_KHR);
+
const bool canBypass = gamescopeSurface->canBypassXWaylandAtPresent(gamescopeSwapchain->isHdrColorspace);
if (canBypass != gamescopeSwapchain->isBypassingXWayland) {
if (canBypass) {
@@ -0,0 +1,95 @@
diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
index 40164ba..cc04fa7 100644
--- a/src/Backends/WaylandBackend.cpp
+++ b/src/Backends/WaylandBackend.cpp
@@ -1698,6 +1698,49 @@ namespace gamescope
}
}
+ // -r sets the refresh gamescope starts with. With GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST=1 a refresh
+ // the host compositor reports later replaces it, so pacing and the frame limiter follow a panel
+ // switched to another mode during the session.
+ static bool NestedRefreshFollowsHost()
+ {
+ static const bool s_bFollow = []
+ {
+ const char *pszFollow = getenv( "GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST" );
+ return pszFollow && atoi( pszFollow ) != 0;
+ }();
+ return s_bFollow;
+ }
+
+ // A mode switch on the host can report a passing rate for a few frames (72 Hz between 144 and
+ // 120 on an AYANEO Pocket FIT); a new rate is taken once it has been reported for 300 ms.
+ static bool HostRefreshChanged( int32_t nRefreshmHz, uint64_t ulPresentedNs )
+ {
+ static int32_t s_nPendingmHz = 0;
+ static uint64_t s_ulPendingSinceNs = 0;
+ if ( !nRefreshmHz || nRefreshmHz == g_nOutputRefresh )
+ {
+ s_nPendingmHz = 0;
+ return false;
+ }
+ if ( !NestedRefreshFollowsHost() )
+ return true;
+ if ( nRefreshmHz != s_nPendingmHz )
+ {
+ s_nPendingmHz = nRefreshmHz;
+ s_ulPendingSinceNs = ulPresentedNs;
+ return false;
+ }
+ return ulPresentedNs - s_ulPendingSinceNs >= 300'000'000ul;
+ }
+
+ static void FollowHostRefresh( int32_t nRefreshmHz )
+ {
+ if ( !NestedRefreshFollowsHost() || !g_nNestedRefresh || g_nNestedRefresh == nRefreshmHz )
+ return;
+ xdg_log.infof( "Nested refresh follows the host: %.3fhz", ConvertmHzToHz( (float) nRefreshmHz ) );
+ g_nNestedRefresh = nRefreshmHz;
+ }
+
void CWaylandPlane::UpdateVRRRefreshRate()
{
if ( m_pParent )
@@ -1724,6 +1767,7 @@ namespace gamescope
// TODO(strategy): We should pick the largest refresh rate.
xdg_log.infof( "Changed refresh to: %.3fhz", ConvertmHzToHz( (float) nLargestRefreshRateMhz ) );
g_nOutputRefresh = nLargestRefreshRateMhz;
+ FollowHostRefresh( nLargestRefreshRateMhz );
}
}
@@ -1794,10 +1838,11 @@ namespace gamescope
if ( uRefreshCycle )
{
int32_t nRefresh = RefreshCycleTomHz( uRefreshCycle );
- if ( nRefresh && nRefresh != g_nOutputRefresh )
+ if ( HostRefreshChanged( nRefresh, ulTime ) )
{
xdg_log.infof( "Changed refresh to: %.3fhz", ConvertmHzToHz( (float) nRefresh ) );
g_nOutputRefresh = nRefresh;
+ FollowHostRefresh( nRefresh );
}
m_pConnector->SetHostCompositorIsCurrentlyVRR( false );
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
index 6c9299d..5fb9086 100644
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -9254,6 +9254,15 @@ void update_vrr_atoms(xwayland_ctx_t *root_ctx, bool force, bool* needs_flush =
g_nCurrentRefreshRate_CachedValue = g_nOutputRefresh;
if (needs_flush)
*needs_flush = true;
+
+ // Steam reads the display's refresh rates from gamescope_control when it binds; send them again.
+ if ( !force )
+ {
+ wlserver_lock();
+ for ( const auto &control : wlserver.gamescope_controls )
+ wlserver_send_gamescope_control( control );
+ wlserver_unlock();
+ }
}
// Don't update this in-sync with DRM vrr usage.
+2 -2
View File
@@ -1,3 +1,3 @@
GAMESCOPE_REPO=Droid-Deck/DroidDeck-Components
GAMESCOPE_TAG=gamescope-3.16.29-p14
GAMESCOPE_SHA256=f0f2f33767c883bcfe66f28c303fddc1564f91a915fb7cedd31eb823570b254c
GAMESCOPE_TAG=gamescope-3.16.29-p15
GAMESCOPE_SHA256=ee592bc7d000db86b12adaecb1aee5d25f8d6565c3584e55975ef1078d7a8e52
@@ -238,6 +238,8 @@ if [ -z "${BL_INSIDE:-}" ]; then
fi
if [ "${BL_REFRESH:-0}" -gt 0 ]; then
args+=(-r "$BL_REFRESH")
# -r is the starting rate; gamescope follows the panel when it switches modes later.
export GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST=1
fi
[ "$mode" = steam ] && [ "${BL_STEAM_UI:-}" != desktop ] && args+=(-e)
if [ "$mode" = steam ] && [ "${BL_XWAYLAND_COUNT:-2}" -gt 1 ]; then
@@ -241,6 +241,74 @@ TOUR_JS = r"""
return "off";
})()
"""
# Steam keeps the Quick Access Frame Limit as the client setting gamescope_app_target_framerate
# (CMsgClientSettings field 21002) and offers the values gamescope's display state lists in
# active_display_info.supported_frame_rates. When the panel's refresh rate changes, a remembered
# limit that is not one of the new values leaves the slider on its first value while the game runs
# at the old limit. The limit is kept when it is still offered and moved to the highest value
# otherwise. Choices are read once they have been unchanged for a moment, since a mode switch can
# report a passing rate first.
FRAME_LIMIT_JS = r"""
(() => {
if (window.__droiddeckFrameLimit) return "present";
const settings = window.settingsStore;
let service = null;
try {
// Steam's webpack does not expose its module cache; the gamescope service client is found by
// the calls its module makes and loaded by id.
let require;
window.webpackChunksteamui.push([[Symbol("droiddeck-frame-limit")], {}, r => { require = r; }]);
for (const id of Object.keys(require.m || {})) {
const source = String(require.m[id]);
if (!source.includes("SetBlurParams") || !source.includes("RegisterForNotifyStateChanged")) continue;
let exports;
try { exports = require(id); } catch (e) { continue; }
if (!exports || typeof exports !== "object") continue;
service = Object.values(exports).find(value => value && typeof value.GetState === "function" &&
typeof value.RegisterForNotifyStateChanged === "function" && typeof value.SetBlurParams === "function");
if (service) break;
}
} catch (e) {
service = null;
}
if (!service || !settings?.clientSettings || typeof SteamClient.Settings?.SetSetting !== "function") return "unavailable";
const self = { choices: null, timer: null };
const write = value => {
const bytes = [];
for (let n of [21002 * 8, value]) {
while (n > 127) { bytes.push((n & 127) | 128); n = Math.floor(n / 128); }
bytes.push(n);
}
SteamClient.Settings.SetSetting(btoa(String.fromCharCode(...bytes)));
};
self.check = async () => {
let rates;
try {
const reply = await service.GetState({});
if (!reply.BSuccess()) return;
rates = reply.Body().toObject().state?.active_display_info?.supported_frame_rates;
} catch (e) {
return;
}
if (!Array.isArray(rates) || rates.length === 0) return;
const choices = rates.join(",");
if (choices === self.choices) return;
self.choices = choices;
const current = settings.clientSettings;
if (!current.gamescope_enable_app_target_framerate || rates.includes(current.gamescope_app_target_framerate)) return;
write(Math.max(...rates));
};
self.schedule = () => {
clearTimeout(self.timer);
self.timer = setTimeout(self.check, 1500);
};
self.subscription = service.RegisterForNotifyStateChanged(self.schedule);
self.interval = setInterval(self.schedule, 5000);
self.schedule();
window.__droiddeckFrameLimit = self;
return "installed";
})()
"""
FILE_BINDING = "droiddeckOpenFileDialog"
FILE_JS = r"""
(() => {
@@ -680,6 +748,8 @@ class Helper:
self.chooser = None
self.controls_state = None
self.controls_installed = False
self.frame_limit_state = None
self.frame_limit_retry = 0
def sync_controls(self):
try:
@@ -702,6 +772,19 @@ class Helper:
except (OSError, ValueError, TypeError):
pass
def sync_frame_limit(self):
# Steam can still be loading its settings and gamescope state when the helper attaches.
if self.frame_limit_state in ("installed", "present") or time.monotonic() < self.frame_limit_retry:
return
try:
state = self.page.evaluate(FRAME_LIMIT_JS)
except RuntimeError as e:
state = "failed (%s)" % e
if state != self.frame_limit_state:
say("frame limit sync: %s" % state)
self.frame_limit_state = state
self.frame_limit_retry = time.monotonic() + 10
def open_chooser(self, payload):
try:
request = json.loads(payload)
@@ -801,6 +884,8 @@ class Helper:
self.page = page
self.controls_state = None
self.controls_installed = False
self.frame_limit_state = None
self.frame_limit_retry = 0
self.sync_controls()
return True
@@ -956,6 +1041,7 @@ class Helper:
self.ensure_tools()
while True:
self.sync_controls()
self.sync_frame_limit()
sources = [self.page.ws] + ([watcher] if watcher.fileno() >= 0 else [])
if self.chooser is not None:
sources.append(self.chooser[1].stdout)
+1
View File
@@ -30,6 +30,7 @@ class DeviceControlsTest(unittest.TestCase):
page.evaluate.side_effect = evaluate
page.drain.side_effect = drain
helper.reconcile = mock.Mock()
helper.sync_frame_limit = mock.Mock()
helper.ensure_tools = mock.Mock(side_effect=[None, StopIteration])
helper.open_chooser = mock.Mock()
watcher = mock.Mock()
+118
View File
@@ -0,0 +1,118 @@
"""The Quick Access Frame Limit follows the panel when its refresh rate changes."""
from pathlib import Path
import runpy
import subprocess
import tempfile
import unittest
from unittest import mock
BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
LIVE = runpy.run_path(str(BIN / "droiddeck-steam-compat"))
HARNESS = r"""
const assert = require('assert');
globalThis.window = globalThis;
globalThis.btoa = text => Buffer.from(text, 'binary').toString('base64');
let timers = new Map(), nextTimer = 0;
globalThis.setTimeout = (callback, ms) => { timers.set(++nextTimer, callback); return nextTimer; };
globalThis.clearTimeout = id => timers.delete(id);
globalThis.setInterval = () => 0;
const fire = async () => {
const pending = [...timers.values()]; timers = new Map();
for (const callback of pending) await callback();
};
let rates = [36, 48, 72, 144];
const notify = [];
const service = {
GetState: async () => ({ BSuccess: () => true,
Body: () => ({ toObject: () => ({ state: { active_display_info: { supported_frame_rates: rates } } }) }) }),
RegisterForNotifyStateChanged(callback) { notify.push(callback); return {}; },
SetBlurParams() {},
};
const writes = [];
globalThis.settingsStore = { clientSettings: {
gamescope_enable_app_target_framerate: true, gamescope_app_target_framerate: 120, gamescope_disable_framelimit: false } };
const varints = bytes => { const out = []; let value = 0, shift = 0;
for (const b of bytes) { value += (b & 127) * 2 ** shift; shift += 7; if (b < 128) { out.push(value); value = 0; shift = 0; } }
return out; };
globalThis.SteamClient = { Settings: { SetSetting(encoded) {
const [key, value] = varints([...Buffer.from(encoded, 'base64')]);
assert.strictEqual(key, 21002 * 8);
writes.push(value);
settingsStore.clientSettings.gamescope_app_target_framerate = value;
} } };
const modules = {
1: { source: () => 'RegisterForNotifyStateChanged only', exports: { other: { GetState() {} } } },
2: { source: () => 'n.MX.SetBlurParams(); n.MX.RegisterForNotifyStateChanged()', exports: { hooks: () => {} } },
3: { source: () => 'SetBlurParams RegisterForNotifyStateChanged GetState', exports: { MX: service } },
};
const webpack = modules => { const require = id => modules[id].exports;
require.m = Object.fromEntries(Object.entries(modules).map(([id, m]) => [id, { toString: m.source }]));
return require; };
globalThis.webpackChunksteamui = { push([, , callback]) { callback(webpack(modules)); } };
const script = require('fs').readFileSync(process.argv[2], 'utf8');
const change = async next => { rates = next; notify.forEach(callback => callback()); };
(async () => {
assert.strictEqual(eval(script), 'installed');
assert.strictEqual(eval(script), 'present');
await fire();
assert.deepStrictEqual(writes, [144], 'a remembered limit the panel does not offer moves to the highest value');
await fire();
assert.deepStrictEqual(writes, [144], 'unchanged choices are not written again');
settingsStore.clientSettings.gamescope_app_target_framerate = 72;
await change([24, 30, 40, 60, 120]);
await fire();
assert.deepStrictEqual(writes, [144, 120], '72 is not offered at 120 Hz');
settingsStore.clientSettings.gamescope_app_target_framerate = 60;
await change([12, 15, 20, 30, 60]);
await fire();
assert.deepStrictEqual(writes, [144, 120], '60 is still offered at 60 Hz and is kept');
await change([18, 24, 36, 72]);
await change([24, 30, 40, 60, 120]);
await fire();
assert.deepStrictEqual(writes, [144, 120], 'a passing rate during a mode switch is not acted on');
settingsStore.clientSettings.gamescope_enable_app_target_framerate = false;
settingsStore.clientSettings.gamescope_app_target_framerate = 72;
await change([36, 48, 144]);
await fire();
assert.deepStrictEqual(writes, [144, 120], 'nothing changes while Steam has the frame limit turned off');
delete window.__droiddeckFrameLimit;
webpackChunksteamui.push = ([, , callback]) => callback(webpack({ 1: modules[1], 2: modules[2] }));
assert.strictEqual(eval(script), 'unavailable');
})().catch(error => { console.error(error); process.exit(1); });
"""
class FrameLimitSyncTest(unittest.TestCase):
def test_limit_is_kept_when_offered_and_moved_to_the_highest_value_otherwise(self):
with tempfile.TemporaryDirectory() as directory:
script = Path(directory) / "frame_limit.js"
script.write_text(LIVE["FRAME_LIMIT_JS"])
test = Path(directory) / "test.js"
test.write_text(HARNESS)
result = subprocess.run(["node", str(test), str(script)], capture_output=True, text=True, timeout=20)
self.assertEqual(result.returncode, 0, result.stderr)
def test_install_is_retried_until_steam_is_ready_and_reported_once_per_state(self):
helper = LIVE["Helper"]("/steam", 0)
page = mock.Mock()
page.evaluate.side_effect = ["unavailable", "unavailable", "installed"]
helper.page = page
said = []
clock = [100.0]
globals_ = LIVE["Helper"].sync_frame_limit.__globals__
with mock.patch.dict(globals_, {"say": said.append}), mock.patch.object(globals_["time"], "monotonic", lambda: clock[0]):
helper.sync_frame_limit()
helper.sync_frame_limit()
clock[0] += 10
helper.sync_frame_limit()
clock[0] += 10
helper.sync_frame_limit()
clock[0] += 10
helper.sync_frame_limit()
self.assertEqual(page.evaluate.call_count, 3)
self.assertEqual(said, ["frame limit sync: unavailable", "frame limit sync: installed"])
if __name__ == "__main__":
unittest.main()
+10 -1
View File
@@ -18,16 +18,19 @@ class SessionPacingTest(unittest.TestCase):
with tempfile.TemporaryDirectory() as directory:
env = dict(os.environ, XDG_RUNTIME_DIR=directory, BL_REFRESH=str(refresh),
BL_MANGOAPP='0', BL_FPS='0', DROIDDECK_GAME_FRAME_LIMIT='0')
env.pop('GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST', None)
env.update(overrides)
script = '''
set -u
mode=steam
pipewire_stub() { return 1; }
run_gamescope() { printf 'ARG:%s\\n' "$@"; }
run_gamescope() { printf 'ARG:%s\\n' "$@"; printf 'FOLLOW:%s\\n' "${GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST:-}"; }
''' + block
result = subprocess.run(['bash', '-c', script], env=env, capture_output=True,
text=True, timeout=5)
self.assertEqual(0, result.returncode, result.stderr)
self.follow = [line.removeprefix('FOLLOW:') for line in result.stdout.splitlines()
if line.startswith('FOLLOW:')]
return [line.removeprefix('ARG:') for line in result.stdout.splitlines()
if line.startswith('ARG:')]
@@ -38,6 +41,12 @@ run_gamescope() { printf 'ARG:%s\\n' "$@"; }
self.assertEqual(str(refresh), args[args.index('-r') + 1])
self.assertIn('-e', args)
def test_gamescope_follows_the_panel_after_the_starting_rate(self):
self.launch(144)
self.assertEqual(['1'], self.follow)
self.launch(0)
self.assertEqual([''], self.follow)
def test_retired_cap_variables_do_not_override_the_display_rate(self):
for performance in ('0', '1'):
with self.subTest(performance=performance):