This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-13 21:27:42 -04:00
1 parent 4163b31b02
commit 83ec5708ed
852 files changed
+4844 -46144

No files matched your search

+1 -15
View File
@@ -1,26 +1,15 @@
#!/usr/bin/bash
# Runs INSIDE an Arch Linux ARM container (menci/archlinuxarm:base-devel) on an arm64 runner.
# Builds Arch's own gamescope package of the runtime's version with the patches in ./patches
# added, then keeps only the gamescope binary, checks its library needs against the runtime's
# list, and packs it as gamescope.tzst (usr/local/bin/gamescope) for the apk to stage.
set -euxo pipefail
VERSION=${GAMESCOPE_VERSION:-3.16.29}
WORK=/work
cd "$WORK"
# pacman's download sandbox (Landlock + the alpm user) cannot be set up inside the runner's
# container; the packages still come signed from Arch Linux ARM's mirrors.
grep -q '^DisableSandbox' /etc/pacman.conf || sed -i 's/^\[options\]/[options]\nDisableSandbox/' /etc/pacman.conf
# The geo-redirecting mirror answered 500s and connection resets mid-transaction; name a few
# concrete mirrors ahead of it so pacman has somewhere to fall over to.
{ for m in https://ca.us.mirror.archlinuxarm.org https://fl.us.mirror.archlinuxarm.org https://de3.mirror.archlinuxarm.org https://nl.mirror.archlinuxarm.org; do echo "Server = $m/\$arch/\$repo"; done; cat /etc/pacman.d/mirrorlist; } > /etc/pacman.d/mirrorlist.new
mv /etc/pacman.d/mirrorlist.new /etc/pacman.d/mirrorlist
pacman -Syu --noconfirm --needed git sudo zstd binutils
# makepkg refuses root; a builder user with passwordless sudo installs the dependencies.
id builder >/dev/null 2>&1 || useradd -m builder
echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder
rm -rf pkg && mkdir pkg && cp -r tools/gamescope/patches pkg/ && chown -R builder pkg
# Arch's packaging for exactly this version: the tag is <pkgver>-<pkgrel>; the first rel is tried
# first, later ones after it.
sudo -u builder bash -c "
set -euxo pipefail
cd pkg
@@ -31,13 +20,11 @@ test -f arch/PKGBUILD
cd arch
grep -q '^pkgver=${VERSION}$' PKGBUILD
cp ../patches/*.patch .
# Add our patches to the source list and apply them after Arch's own prepare() steps.
PATCHES=\$(ls *.patch | sort)
{ echo; echo 'source+=('; for p in \$PATCHES; do echo \" \$p\"; done; echo ')'; for p in \$PATCHES; do echo \"sha256sums+=('SKIP')\"; done; } >> PKGBUILD
cat >> PKGBUILD <<'PREP'
_droiddeck_prepare() {
# Arch's own prepare() leaves the shell inside the checkout; start from a known place.
cd \"\$srcdir/gamescope\"
for p in \$(ls \"\$srcdir\"/*.patch | sort); do
echo \"applying \$(basename \"\$p\")\"
@@ -51,7 +38,7 @@ else
prepare() { _droiddeck_prepare; }
fi
PREP
makepkg -A -s --noconfirm --skipchecksums --skippgpcheck # -A: the PKGBUILD lists x86_64 only; Arch Linux ARM builds the same file
makepkg -A -s --noconfirm --skipchecksums --skippgpcheck
ls -l *.pkg.tar.*
"
cd "$WORK"
@@ -61,7 +48,6 @@ 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
# Every NEEDED library must be one the runtime ships, or the binary would not load there.
NEEDED=$(readelf -d out/usr/local/bin/gamescope | sed -n 's/.*NEEDED.*\[\(.*\)\]/\1/p')
echo "NEEDED: $NEEDED"
MISSING=""
@@ -22,9 +22,9 @@ index e54194b..4131467 100644
g_ColorMgmt.pending.outputVirtualWhite.x = santitize_float( bit_cast<float>( user_vec[0] ) );
g_ColorMgmt.pending.outputVirtualWhite.y = santitize_float( bit_cast<float>( user_vec[1] ) );
+#if defined(__aarch64__)
+ // The ARM64 Steam client packs the pair as one 64-bit element, so only x arrives;
+ // Steam derives the pair from the CIE daylight locus, so y follows from x.
+ // Drop once the client sends both floats (y arrives non-zero).
+
+
+
+ float x = g_ColorMgmt.pending.outputVirtualWhite.x;
+ if ( x >= 0.25f && x <= 0.55f && g_ColorMgmt.pending.outputVirtualWhite.y <= 0.01f )
+ g_ColorMgmt.pending.outputVirtualWhite.y = -3.0f * x * x + 2.87f * x - 0.275f;
@@ -18,7 +18,7 @@ index 64430a5..f4dcd98 100644
{
- // Use red as a sentinal for a wide-gamut display
- return ( nativeDisplayOutput.primaries.r.x > 0.650f && nativeDisplayOutput.primaries.r.y < 0.320f );
+ // Use red as a sentinal for a wide-gamut display; DCI-P3 red sits exactly on the threshold
+
+ return ( nativeDisplayOutput.primaries.r.x > 0.650f && nativeDisplayOutput.primaries.r.y <= 0.320f );
}
@@ -6,10 +6,10 @@ index 54e4efc..024af02 100644
}
float queuePriorities = 1.0f;
+ // Without CAP_SYS_NICE gamescope never asks for realtime-priority queues. Under proot on
+ // Android there is no capability to have; the fallback below covers a driver that refuses. KGSL
+ // Turnip accepts but ignores it (one submit-queue priority, contexts created alike). Opt in with
+ // GAMESCOPE_FORCE_VULKAN_REALTIME=1. (Armada's --force-vulkan-realtime, as an environment switch.)
+
+
+
+
+ const char *pszForceRealtime = getenv( "GAMESCOPE_FORCE_VULKAN_REALTIME" );
+ const bool useRealtimeVulkanQueue = gamescope::Process::HasCapSysNice() || ( pszForceRealtime && atoi( pszForceRealtime ) != 0 );
+ if ( useRealtimeVulkanQueue && !gamescope::Process::HasCapSysNice() )
@@ -67,8 +67,8 @@ index 10990b8..08afbc4 100644
}
- else
+ m_bConstrained = false;
+ // Nothing to draw (the gamepad UI, most games): the position only feeds focus and zoom, and
+ // wlserver's copy is what stock gamescope uses for those. No round trip to X.
+
+
+ if ( m_imageEmpty )
{
- m_bConstrained = false;
@@ -80,12 +80,12 @@ index 10990b8..08afbc4 100644
}
wlserver_unlock();
+
+ // The gamepad-driven cursor is moved through XTest, which moves the X pointer and nothing
+ // else: wlserver's copy of the position never changes, so the sprite sat frozen while the
+ // pointer moved. Ask X where the pointer is. (Armada 0001, on 3.16.29.) That is a blocking
+ // round trip to Xwayland on the paint thread, which waits while Xwayland is busy drawing the
+ // client's interface: once per vblank only while the sprite is shown, and every 50 ms while
+ // it is hidden for inactivity - enough to bring it back within a few frames of a move.
+
+
+
+
+
+
+ if ( wlserver.bCursorHidden )
+ {
+ const uint64_t now = get_time_in_nanos();
@@ -6,8 +6,8 @@ index d74268b..bf72267 100644
void Wayland_Keyboard_RepeatInfo( wl_keyboard *pKeyboard, int32_t nRate, int32_t nDelay );
static const wl_keyboard_listener s_KeyboardListener;
+ // Touch from the host compositor (DroidDeck): each finger goes to wlserver's touch path,
+ // the one a Steam Deck's touchscreen drives, instead of being dropped.
+
+
+ void Wayland_Touch_Down( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, wl_surface *pSurface, int32_t nId, wl_fixed_t fX, wl_fixed_t fY );
+ void Wayland_Touch_Up( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, int32_t nId );
+ void Wayland_Touch_Motion( wl_touch *pTouch, uint32_t uTime, int32_t nId, wl_fixed_t fX, wl_fixed_t fY );
@@ -58,7 +58,7 @@ index d74268b..bf72267 100644
+ }
+ }
+
+ // Touch
+
+
+ bool CWaylandInputThread::TouchToOutput( wl_surface *pSurface, wl_fixed_t fX, wl_fixed_t fY, double *pflX, double *pflY )
+ {
@@ -75,7 +75,7 @@ index d74268b..bf72267 100644
+ *pflY = ( wl_fixed_to_double( fY ) * uScale / 120.0 + oState->nDestY ) / g_nOutputHeight;
+ return true;
+ }
+ // Touch ids are offset by one: the nested pointer already moves wlserver's touch 0.
+
+ void CWaylandInputThread::Wayland_Touch_Down( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, wl_surface *pSurface, int32_t nId, wl_fixed_t fX, wl_fixed_t fY )
+ {
+ double flX, flY;
@@ -7,9 +7,9 @@ index bf72267..c400978 100644
wlserver_lock();
- wlserver_touchmotion( flX, flY, 0, ++m_uFakeTimestamp );
+ // Always move the real pointer too: in Passthrough (what Steam's Big Picture asks for) a
+ // touch motion for an id that is not down moves nothing, so hover never reached the
+ // client and a click landed wherever the pointer had last been.
+
+
+
+ wlserver_touchmotion( flX, flY, 0, ++m_uFakeTimestamp, true );
wlserver_unlock();
}
@@ -28,11 +28,11 @@ index 08afbc4..372a82c 100644
if ( keyboardFocusWindow && ctx->currentKeyboardFocusWindow && find_win( ctx, ctx->currentKeyboardFocusWindow ) == keyboardFocusWin )
keyboardFocusWindow = ctx->currentKeyboardFocusWindow;
+ // An overlay that takes input (the Steam menu) moves input away without changing the focus window, and a
+ // fullscreen game iconifies itself when it loses input. The focus window never changed, so it is never taken
+ // out of iconic above, and wine will not activate a window it believes iconic: the game stays minimized
+ // (its 160x24 caption in the corner) after Resume. Put it back to NormalState before input returns to it,
+ // then hand focus over again so wine sees the restore first and the activation after it.
+
+
+
+
+
+ if ( inputFocus == ctx->focus.focusWindow && ctx->focus.focusWindow->iconifyRequested )
+ {
+ ctx->focus.focusWindow->iconifyRequested = false;
@@ -59,8 +59,8 @@ index 08afbc4..372a82c 100644
}
+ if ( ev->atom == ctx->atoms.gamescopeRestoreFocusWindow )
+ {
+ // Anything outside (the session's watcher) can ask for the same restore: NormalState on the focus
+ // window and focus handed to it again. Harmless on a window that is not iconic.
+
+
+ if ( ctx->focus.focusWindow && get_prop( ctx, ctx->root, ctx->atoms.gamescopeRestoreFocusWindow, 0 ) )
+ {
+ xwm_log.infof( "restore requested for focus window 0x%lx", ctx->focus.focusWindow->xwayland().id );
@@ -89,7 +89,7 @@ index 66022d7..af93a23 100644
bool isFullscreen = false;
bool isSysTrayIcon = false;
+ // The client asked to be iconified (WM_CHANGE_STATE) and has not been put back to NormalState since.
+
+ bool iconifyRequested = false;
bool sizeHintsSpecified = false;
bool skipTaskbar = false;
@@ -26,7 +26,7 @@ index f00b62c..cb3b9c6 100644
if (w && w->xwayland().id == ev.xmap.window)
+ {
+ // Wine flips override-redirect while unmapped and the flip itself sends no event.
+
+ w->xwayland().a.override_redirect = ev.xmap.override_redirect;
map_win(ctx, ev.xmap.window, ev.xmap.serial);
+ }