mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-13 20:35:40 +02:00
Patched gamescope: one build per CPU level (znver4/v4/v3/generic), smoke test after install, pin 3.16.31-3
Sync git.upriser.nl mirror / sync (push) Skipped
Sync git.upriser.nl mirror / sync (push) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkpbsMw4rQyBsxDG6ebHK2
This commit is contained in:
1 parent
59e941e8e4
commit
f1cdf313ad
2 files changed
+57
-26
No files matched your search
+55
-24
@@ -20,8 +20,14 @@ GSN_PKG=steamify-gamescope-nvidia
|
|||||||
GSN_RELEASES="${GSN_RELEASES:-https://github.com/theupriser/steamify-gamescope-nvidia/releases}"
|
GSN_RELEASES="${GSN_RELEASES:-https://github.com/theupriser/steamify-gamescope-nvidia/releases}"
|
||||||
# The package this Steamify release was tested with (patches/gamescope-nvidia.PKGBUILD names the same version): the
|
# The package this Steamify release was tested with (patches/gamescope-nvidia.PKGBUILD names the same version): the
|
||||||
# fallback. A new pin: the release's tag, the package's sha256, and the PKGBUILD's pkgver/pkgrel.
|
# fallback. A new pin: the release's tag, the package's sha256, and the PKGBUILD's pkgver/pkgrel.
|
||||||
GSN_VERSION=3.16.31-2
|
GSN_VERSION=3.16.31-3
|
||||||
GSN_SHA256=3b981bed4dfdac383d22b8c22feaef191c2f2863bccf5676d1ec959c2c5ee3a3
|
# One build per CPU level, like CachyOS's repositories: generic is the one every x86-64 PC can run.
|
||||||
|
declare -A GSN_SHA256=(
|
||||||
|
[generic]=4c7995694d2726c356785d9aec12a11c98419b4d2e139617f03bb46c758ced56
|
||||||
|
[v3]=43c6928ca9fa67c063c4e1b993b686145e94e68de1bd46645782d3186779fa2d
|
||||||
|
[v4]=b6d4621e4b98d9aa5c600fe9a5a1cae164fef6bbf93d259fb8a6af666b098f9f
|
||||||
|
[znver4]=60f45da74a0b96d776219f6e6aa22c5d23e48b08233b3fa12b6c4d7aa6812dd9
|
||||||
|
)
|
||||||
# Where the ISO leaves a copy of the pinned package, for installs without GitHub.
|
# Where the ISO leaves a copy of the pinned package, for installs without GitHub.
|
||||||
GSN_BACKUP_DIR="${GSN_BACKUP_DIR:-/usr/local/share/steamify/gamescope}"
|
GSN_BACKUP_DIR="${GSN_BACKUP_DIR:-/usr/local/share/steamify/gamescope}"
|
||||||
# How long a look at GitHub for a newer release counts (seconds), so opening the menu doesn't ask every time.
|
# How long a look at GitHub for a newer release counts (seconds), so opening the menu doesn't ask every time.
|
||||||
@@ -68,20 +74,30 @@ gsn_update_pending() {
|
|||||||
[[ -n "$latest" ]] && gsn_newer "$latest" "$(gsn_installed_version)"
|
[[ -n "$latest" ]] && gsn_newer "$latest" "$(gsn_installed_version)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gsn_cpu_variant() {
|
||||||
|
# The best build this CPU can run: znver4 (Ryzen 7000/9000: AMD with AVX-512 BF16), v4, v3, else generic. The
|
||||||
|
# dynamic loader knows the CPU level best ("x86-64-v4 (supported, searched)").
|
||||||
|
local help; help="$(/lib64/ld-linux-x86-64.so.2 --help 2>/dev/null)"
|
||||||
|
if grep -q 'x86-64-v4 (supported' <<< "$help"; then
|
||||||
|
if grep -q AuthenticAMD /proc/cpuinfo && grep -qw avx512_bf16 /proc/cpuinfo; then echo znver4; else echo v4; fi
|
||||||
|
elif grep -q 'x86-64-v3 (supported' <<< "$help"; then echo v3
|
||||||
|
else echo generic; fi
|
||||||
|
}
|
||||||
|
|
||||||
gsn_sha_of() {
|
gsn_sha_of() {
|
||||||
# The hash a release file is expected to have: the pinned one for the pinned version, else the .sha256 next to the
|
# The hash a release file is expected to have: the pinned one for the pinned version, else the .sha256 next to the
|
||||||
# package in the same release (it shows the download wasn't damaged, not who made it).
|
# package in the same release (it shows the download wasn't damaged, not who made it). gsn_sha_of <tag> <file> <variant>
|
||||||
local tag="$1" file="$2"
|
local tag="$1" file="$2" variant="$3"
|
||||||
if [[ "$tag" == "$GSN_VERSION" ]]; then echo "$GSN_SHA256"; return 0; fi
|
if [[ "$tag" == "$GSN_VERSION" ]]; then echo "${GSN_SHA256[$variant]}"; return 0; fi
|
||||||
curl -fsL --connect-timeout 10 --max-time 30 "$GSN_RELEASES/download/$tag/$file.sha256" 2>/dev/null | awk 'NR==1 {print $1}'
|
curl -fsL --connect-timeout 10 --max-time 30 "$GSN_RELEASES/download/$tag/$file.sha256" 2>/dev/null | awk 'NR==1 {print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
gsn_download() {
|
gsn_download() {
|
||||||
# gsn_download <tag>: the release's package, verified, in the cache; prints its path.
|
# gsn_download <tag> <variant>: the release's package, verified, in the cache; prints its path.
|
||||||
local tag="$1" cache="${XDG_CACHE_HOME:-$HOME/.cache}/steamify" file want got
|
local tag="$1" variant="$2" cache="${XDG_CACHE_HOME:-$HOME/.cache}/steamify" file want got
|
||||||
file="$GSN_PKG-$tag-x86_64.pkg.tar.zst"
|
file="$GSN_PKG-$tag-$variant.pkg.tar.zst"
|
||||||
mkdir -p "$cache" || return 1
|
mkdir -p "$cache" || return 1
|
||||||
want="$(gsn_sha_of "$tag" "$file")"
|
want="$(gsn_sha_of "$tag" "$file" "$variant")"
|
||||||
[[ "$want" =~ ^[0-9a-f]{64}$ ]] || return 1
|
[[ "$want" =~ ^[0-9a-f]{64}$ ]] || return 1
|
||||||
if [[ -f "$cache/$file" ]] && [[ "$(sha256sum "$cache/$file" | awk '{print $1}')" == "$want" ]]; then echo "$cache/$file"; return 0; fi
|
if [[ -f "$cache/$file" ]] && [[ "$(sha256sum "$cache/$file" | awk '{print $1}')" == "$want" ]]; then echo "$cache/$file"; return 0; fi
|
||||||
curl -fsL --retry 2 --connect-timeout 15 --max-time 300 -o "$cache/$file.part" "$GSN_RELEASES/download/$tag/$file" || { rm -f "$cache/$file.part"; return 1; }
|
curl -fsL --retry 2 --connect-timeout 15 --max-time 300 -o "$cache/$file.part" "$GSN_RELEASES/download/$tag/$file" || { rm -f "$cache/$file.part"; return 1; }
|
||||||
@@ -92,27 +108,37 @@ gsn_download() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gsn_fetch_package() {
|
gsn_fetch_package() {
|
||||||
# The package to install, as a path, newest first: the newest release on GitHub (not older than the pinned one), else
|
# The package to install, as a path: the build for this CPU, then the generic one, each from the newest release on
|
||||||
# the pinned package (GitHub, the cache, or the copy that came with the ISO). Only files with the expected sha256 count.
|
# GitHub (not older than the pinned one), else the pinned release (GitHub, the cache, or the copy that came with the
|
||||||
local tag pkg cache="${XDG_CACHE_HOME:-$HOME/.cache}/steamify" file="$GSN_PKG-$GSN_VERSION-x86_64.pkg.tar.zst" copy
|
# ISO). Only files with the expected sha256 count. gsn_fetch_package [variant]
|
||||||
|
local tag pkg v cache="${XDG_CACHE_HOME:-$HOME/.cache}/steamify" file copy
|
||||||
|
local -a variants=("${1:-$(gsn_cpu_variant)}"); [[ "${variants[0]}" == generic ]] || variants+=(generic)
|
||||||
tag="$(gsn_latest_tag)" || tag=""
|
tag="$(gsn_latest_tag)" || tag=""
|
||||||
if [[ -n "$tag" && "$tag" != "$GSN_VERSION" ]] && gsn_newer "$tag" "$GSN_VERSION"; then
|
for v in "${variants[@]}"; do
|
||||||
info "Downloading the newest patched gamescope ($tag)..." >&2
|
if [[ -n "$tag" && "$tag" != "$GSN_VERSION" ]] && gsn_newer "$tag" "$GSN_VERSION"; then
|
||||||
if pkg="$(gsn_download "$tag")"; then echo "$pkg"; return 0; fi
|
info "Downloading the newest patched gamescope ($tag, $v)..." >&2
|
||||||
warn "Downloading the newest patched gamescope ($tag) failed: using the version this Steamify was tested with ($GSN_VERSION)." >&2
|
if pkg="$(gsn_download "$tag" "$v")"; then echo "$pkg"; return 0; fi
|
||||||
fi
|
warn "Downloading the newest patched gamescope ($tag, $v) failed: trying the version this Steamify was tested with ($GSN_VERSION)." >&2
|
||||||
info "Downloading the patched gamescope ($GSN_VERSION)..." >&2
|
|
||||||
if pkg="$(gsn_download "$GSN_VERSION")"; then echo "$pkg"; return 0; fi
|
|
||||||
warn "Downloading the patched gamescope failed (or its checksum didn't match)." >&2
|
|
||||||
for copy in "$GSN_BACKUP_DIR/$file" "$cache/$file"; do
|
|
||||||
if [[ -f "$copy" ]] && [[ "$(sha256sum "$copy" | awk '{print $1}')" == "$GSN_SHA256" ]]; then
|
|
||||||
info "Using the copy that came with Steamify: $copy" >&2
|
|
||||||
echo "$copy"; return 0
|
|
||||||
fi
|
fi
|
||||||
|
info "Downloading the patched gamescope ($GSN_VERSION, $v)..." >&2
|
||||||
|
if pkg="$(gsn_download "$GSN_VERSION" "$v")"; then echo "$pkg"; return 0; fi
|
||||||
|
file="$GSN_PKG-$GSN_VERSION-$v.pkg.tar.zst"
|
||||||
|
for copy in "$GSN_BACKUP_DIR/$file" "$cache/$file"; do
|
||||||
|
if [[ -f "$copy" ]] && [[ "$(sha256sum "$copy" | awk '{print $1}')" == "${GSN_SHA256[$v]}" ]]; then
|
||||||
|
info "Using the copy that came with Steamify: $copy" >&2
|
||||||
|
echo "$copy"; return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
warn "Downloading the patched gamescope failed (or its checksum didn't match)." >&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gsn_smoke_test() {
|
||||||
|
# The installed gamescope must start (headless, no screen needed): a build that crashes would leave gaming mode in a loop.
|
||||||
|
timeout 25 gamescope --backend headless -W 640 -H 360 -r 60 -- true >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
gsn_build_package() {
|
gsn_build_package() {
|
||||||
# Last resort: builds the pinned package from the recipe and patch Steamify carries (patches/), as the user. It
|
# Last resort: builds the pinned package from the recipe and patch Steamify carries (patches/), as the user. It
|
||||||
# downloads gamescope's sources (Valve's repository at the PKGBUILD's pkgver, and its submodules) and compiles them: a
|
# downloads gamescope's sources (Valve's repository at the PKGBUILD's pkgver, and its submodules) and compiles them: a
|
||||||
@@ -154,6 +180,11 @@ gsn_install_package() {
|
|||||||
if [[ -z "$latest" ]] && ! gsn_newer "$GSN_VERSION" "$have"; then return 0; fi
|
if [[ -z "$latest" ]] && ! gsn_newer "$GSN_VERSION" "$have"; then return 0; fi
|
||||||
fi
|
fi
|
||||||
if pkg="$(gsn_fetch_package)" && sudo pacman -U --noconfirm --ask 4 "$pkg"; then
|
if pkg="$(gsn_fetch_package)" && sudo pacman -U --noconfirm --ask 4 "$pkg"; then
|
||||||
|
if ! gsn_smoke_test; then
|
||||||
|
warn "The patched gamescope for this CPU doesn't start: installing the generic build instead."
|
||||||
|
pkg="$(gsn_fetch_package generic)" && sudo pacman -U --noconfirm --ask 4 "$pkg" && gsn_smoke_test ||
|
||||||
|
{ err "The patched gamescope doesn't start on this PC."; return 1; }
|
||||||
|
fi
|
||||||
ok "Patched gamescope installed."
|
ok "Patched gamescope installed."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
# gamescope with GBM-allocated scan-out buffers for NVIDIA (opt-in: gamescope_drm_gbm_scanout=1).
|
# gamescope with GBM-allocated scan-out buffers for NVIDIA (opt-in: gamescope_drm_gbm_scanout=1).
|
||||||
# The patches are gamescope-gbm-scanout.patch and gamescope-ui-native.patch (next to this file, applied in this order); see the
|
# The patches are gamescope-gbm-scanout.patch and gamescope-ui-native.patch (next to this file, applied in this order); see the
|
||||||
# README for where they come from.
|
# README for where they come from.
|
||||||
# UPSTREAM_VERSION (next to this file) names the gamescope tag the patch is made for.
|
# UPSTREAM_VERSION (next to this file) names the gamescope tag the patches are made for.
|
||||||
|
|
||||||
pkgname=steamify-gamescope-nvidia
|
pkgname=steamify-gamescope-nvidia
|
||||||
_srcname=gamescope
|
_srcname=gamescope
|
||||||
pkgver=3.16.31
|
pkgver=3.16.31
|
||||||
pkgrel=2
|
pkgrel=3
|
||||||
pkgdesc='SteamOS session compositing window manager, with GBM scan-out for NVIDIA (opt-in: gamescope_drm_gbm_scanout=1)'
|
pkgdesc='SteamOS session compositing window manager, with GBM scan-out for NVIDIA (opt-in: gamescope_drm_gbm_scanout=1)'
|
||||||
arch=(x86_64)
|
arch=(x86_64)
|
||||||
url=https://github.com/theupriser/steamify-gamescope-nvidia
|
url=https://github.com/theupriser/steamify-gamescope-nvidia
|
||||||
|
|||||||
Reference in new issue
Block a user