mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
fix: Frame Limit sync and refresh follow on a still screen (review follow-ups) (#1663)
The Steam helper checked the Frame Limit only when the offered frame rates changed. With the limit off during a refresh change, turning it back on left a value the new rate does not offer, and a failed write was not tried again. It now checks on every state change and every 5 s, and waits for Steam's settings write so a rejected write is caught and tried again on the next check. gamescope 3.16.29-p16 (0120 changed): gamescope took a new host refresh only from the presentation feedback of a frame it drew, so with nothing moving on screen it kept the old rate. It now presents once when the host's wl_output mode changes and keeps presenting while a new rate is pending, so the 300 ms check runs on a still screen too. Found by CodeRabbit in the reviews of #1650 and #1663.
This commit is contained in:
1 parent
07a0a7e344
commit
43a0ce93f9
4 files changed
+48
-14
No files matched your search
@@ -272,14 +272,14 @@ FRAME_LIMIT_JS = r"""
|
||||
service = null;
|
||||
}
|
||||
if (!service || !settings?.clientSettings || typeof SteamClient.Settings?.SetSetting !== "function") return "unavailable";
|
||||
const self = { choices: null, timer: null };
|
||||
const self = { 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)));
|
||||
return SteamClient.Settings.SetSetting(btoa(String.fromCharCode(...bytes)));
|
||||
};
|
||||
self.check = async () => {
|
||||
let rates;
|
||||
@@ -291,12 +291,12 @@ FRAME_LIMIT_JS = r"""
|
||||
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));
|
||||
try {
|
||||
await write(Math.max(...rates));
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
self.schedule = () => {
|
||||
clearTimeout(self.timer);
|
||||
|
||||
Reference in new issue
Block a user