feat: Performance mode puts frame pacing and per-frame window-check fixes behind one switch (#1563)

Adds a Performance mode switch under Mode settings > Frame rate, off by default and stored per mode like the frame limit. Off keeps today's behaviour. On:

- with no frame limit, the compositor hands buffers back to the game as soon as they are replaced instead of once per refresh, and gamescope's WSI layer is asked for at least 8 swapchain images; a chosen frame limit still paces
- DROIDDECK_WSI_BYPASS_CHECK_MS=100 lets gamescope's WSI layer reuse its present-time Xwayland bypass check (patch 0117, gamescope-3.16.29-p13); WINE_OFFSCREEN_CHECK_MS=100 does the same for winex11 once a DroidDeck-Proton release carries that fix. Off sets both to 0.

The gamescope pack now ships the patched WSI layer and SessionFiles stages it over the runtime's stock copy. Two per-game options, off by default: PROTON_DXVK_D3D8 and WINE_D3D_CONFIG renderer=vulkan|gl.

AIO Graphics Test on an AYANEO Pocket FIT (Adreno 750), off -> on: Vulkan 204 -> 1787, OpenGL 296 -> 2169, D3D12 308 -> 3563, D3D11 1133 -> 2874, D3D9 1253 -> 3098 fps; DiRT Showdown 92.2 -> 93.4 (GPU-bound).
This commit is contained in:
The412Banner authored and GitHub committed 2026-10-25 20:29:26 +00:00
1 parent 12eac3e9ee
commit 38926b3157
17 files changed
+176 -11

No files matched your search

+14
View File
@@ -85,3 +85,17 @@ the patched component retained 1/20, then 0 after destruction. The unassigned
control retained 20/20 and then 0. In Backpack Battles, two batches of ten touch
drags leaked 188 and 197 SHM descriptors before the fix; the same batches added
zero after the fix (112 total descriptors before and after each batch).
## 0117 WSI: cache the present-time Xwayland bypass check
`QueuePresentKHR` in the WSI layer calls `canBypassXWayland` for every swapchain on
every present. Each call makes several synchronous X requests (window geometry,
`_WINE_ALLOW_FLIP`, parent window, a child-window scan, the toplevel window). At
high frame rates that is thousands of round trips a second: on an AYANEO Pocket FIT
running AIO Graphics Test uncapped, Xwayland used 24-32% of a core and the game's
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
later than before; surface creation and capability queries still check every time.
+5 -1
View File
@@ -49,7 +49,11 @@ tar --use-compress-program=unzstd -xf "$PKG" -C out --strip-components=2 usr/bin
mv out/gamescope out/usr/local/bin/gamescope
chmod 755 out/usr/local/bin/gamescope
strip --strip-unneeded out/usr/local/bin/gamescope || true
NEEDED=$(readelf -d out/usr/local/bin/gamescope | sed -n 's/.*NEEDED.*\[\(.*\)\]/\1/p')
# The WSI layer carries patches too (0117); the runtime's stock copy is replaced.
mkdir -p out/usr/lib
tar --use-compress-program=unzstd -xf "$PKG" -C out usr/lib/libVkLayer_FROG_gamescope_wsi_aarch64.so
strip --strip-unneeded out/usr/lib/libVkLayer_FROG_gamescope_wsi_aarch64.so || true
NEEDED=$(for f in out/usr/local/bin/gamescope out/usr/lib/libVkLayer_FROG_gamescope_wsi_aarch64.so; do readelf -d "$f" | sed -n 's/.*NEEDED.*\[\(.*\)\]/\1/p'; done | sort -u)
echo "NEEDED: $NEEDED"
MISSING=""
for lib in $NEEDED; do grep -qx "$lib" tools/gamescope/runtime-sonames.txt || MISSING="$MISSING $lib"; done
@@ -0,0 +1,55 @@
--- a/layer/VkLayer_FROG_gamescope_wsi.cpp 2026-10-25 07:56:48.179978889 +0000
+++ b/layer/VkLayer_FROG_gamescope_wsi.cpp 2026-10-25 07:56:48.207978889 +0000
@@ -23,6 +23,8 @@
#include <optional>
#include <poll.h>
+#include <time.h>
+#include <cstdlib>
#include <sys/stat.h>
// For limiter file.
#include <time.h>
@@ -476,6 +478,34 @@
// Cached for comparison.
std::optional<VkRect2D> cachedWindowRect;
+ // canBypassXWayland costs several X round trips; at present time it is refreshed at most
+ // every DROIDDECK_WSI_BYPASS_CHECK_MS (default 0 = every present; DroidDeck's Performance mode sets 100).
+ std::optional<bool> presentBypass;
+ bool presentBypassHdr = false;
+ uint64_t presentBypassNs = 0;
+
+ static uint64_t presentBypassIntervalNs() {
+ static const uint64_t interval = [] {
+ const char *v = getenv("DROIDDECK_WSI_BYPASS_CHECK_MS");
+ return uint64_t(v && *v ? strtoull(v, nullptr, 10) : 0) * 1000000ull;
+ }();
+ return interval;
+ }
+
+ bool canBypassXWaylandAtPresent(bool hdrColorspace) {
+ if (isWayland())
+ return true;
+ timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ const uint64_t now = uint64_t(ts.tv_sec) * 1000000000ull + uint64_t(ts.tv_nsec);
+ if (!presentBypass || presentBypassHdr != hdrColorspace || now - presentBypassNs >= presentBypassIntervalNs()) {
+ presentBypass = canBypassXWayland(hdrColorspace);
+ presentBypassHdr = hdrColorspace;
+ presentBypassNs = now;
+ }
+ return *presentBypass;
+ }
+
bool isWayland() const {
// Is native Wayland?
return connection == nullptr;
@@ -1597,7 +1627,7 @@
continue;
}
- const bool canBypass = gamescopeSurface->canBypassXWayland(gamescopeSwapchain->isHdrColorspace);
+ const bool canBypass = gamescopeSurface->canBypassXWaylandAtPresent(gamescopeSwapchain->isHdrColorspace);
if (canBypass != gamescopeSwapchain->isBypassingXWayland) {
if (canBypass) {
if (!(gamescopeSurface->flags & GamescopeLayerClient::Flag::NoSuboptimal))
+2 -2
View File
@@ -1,3 +1,3 @@
GAMESCOPE_REPO=Droid-Deck/DroidDeck-Components
GAMESCOPE_TAG=gamescope-3.16.29-p12
GAMESCOPE_SHA256=07b69944a1ebf2741d4a867afa6327dcc63ec458f432a8f7483089dce2197010
GAMESCOPE_TAG=gamescope-3.16.29-p13
GAMESCOPE_SHA256=93c789dc9e08828496f1caa2849d56acdf205838de723a24b296547a29c0b6af