forked from unom/punktfunk
Patch 0008: honor GAMESCOPE_NO_FOCUS in steamcompmgr's focus selection. hhd (Handheld Daemon) sets the atom once at init on its hhd-ui overlay window and never clears it; MangoHud sets it too; show/hide for these clients runs over the STEAM_OVERLAY protocol. NOTHING consumed the atom — not upstream gamescope, not Bazzite's fork (checked ba148 by strings) — so a mapped-but-unpainted hhd-ui window (it crash-loops under a headless punktfunk takeover and remaps on every respawn, stamping Steam's appid 769) was an ordinary focus candidate, and steamcompmgr picked it over Big Picture. The composite, and the stream fed from it, went black while every health signal stayed green: on .41 the client sat decoding 60 fps at 0.1 Mb/s of black, GAMESCOPE_FOCUSED_WINDOW named the hhd-ui window with GAMESCOPE_NO_FOCUS(CARDINAL)=1 on it, and killing hhd-ui brought the picture back the same second. The patch wires the atom exactly like GAMESCOPE_EXTERNAL_OVERLAY — read at map, PropertyNotify-tracked with MakeFocusDirty, skipped by both focus-candidate collectors (X11 and XDG) — and touches neither compositing nor appID, so a NO_FOCUS window still paints if the baselayer protocol brings it into view; it is only barred from being CHOSEN. Applies cleanly on the full 0001..0008 series from the bare 5fb8dce4 pin (verified with git am). Banner +pfhdr5 → +pfhdr6, PKGBUILD 3.16.25.pfhdr6-1; README gains the 0008 row, the missing +pfhdr5 ledger row, and the reconciled bump rule (a bugfix bumps the level only when field triage must read the difference off a box's banner — 0007's crash-loop, 0008's lost composite).
108 lines
6.3 KiB
Bash
108 lines
6.3 KiB
Bash
# Maintainer: unom <packages@unom.io>
|
|
#
|
|
# gamescope + punktfunk's `pipewire-hdr` patches, installed as `punktfunk-gamescope`.
|
|
#
|
|
# Standalone on purpose (its own pkgbase, not part of ../arch/PKGBUILD): it is an OPTIONAL
|
|
# companion — punktfunk works without it, just SDR on the gamescope backend — and it is a C++
|
|
# meson build with a completely different dependency set from the Rust workspace. Installing it
|
|
# does not touch the distro's own `gamescope`; the host resolves `PUNKTFUNK_GAMESCOPE_BIN` >
|
|
# `punktfunk-gamescope` > `gamescope`, so the mere presence of this package is what enables HDR.
|
|
#
|
|
# makepkg -si
|
|
#
|
|
# See ../README.md (packaging/gamescope/README.md) for what the patches do and why.
|
|
pkgname=punktfunk-gamescope
|
|
# `_gsver` is the upstream gamescope this is built from; `pkgrel` moves when only our patches do.
|
|
# `_gsrev` MUST name the same commit as GAMESCOPE_REV in build-punktfunk-gamescope.sh — makepkg
|
|
# needs it statically here, so it is the one thing that cannot be shared; build() asserts it.
|
|
# The `.pfhdrN` suffix is the patch-set revision the binary stamps into its banner (see README.md);
|
|
# bump it with the marker so pacman sees a new version when only our patches moved.
|
|
_gsver=3.16.25
|
|
_gsrev=5fb8dce4a09d0a68d097b9faf9513782106bc843
|
|
pkgver="${_gsver}.pfhdr6"
|
|
# 2: patch 0006 (never destroy the Vulkan device/output at exit). No capability moved, so the
|
|
# `.pfhdrN` level deliberately stays put — see README.md.
|
|
# 3: pin moved 8c676c39 -> 5fb8dce4 (3.16.25-1 -> 3.16.25-11), which brings upstream's own
|
|
# `vulkan_get_rgb10_capture_format()` — the XBGR2101010 fallback for devices with no linear-tiled
|
|
# A2R10G10B10 storage (every NVIDIA). That fixes the NV12/P010 capture intermediate and AVIF
|
|
# screenshots, which are upstream's paths, not ours. Patch 0001 additionally now offers
|
|
# `xBGR_210LE` BEFORE `xRGB_210LE` so a third-party consumer cannot pick the one NVIDIA fills
|
|
# byte-reversed. Still no capability the host probes for, so `.pfhdrN` stays at 4.
|
|
#
|
|
# pfhdr5 / rel 1: patch 0007 fixes the PipeWire `pw_buffer->user_data` use-after-free that aborted
|
|
# a session on every capture renegotiation — i.e. on every client connect, since the host sets the
|
|
# session to the client's mode. This one DOES move `.pfhdrN`, even though it adds no capability:
|
|
# every deployed pfhdr4 binary crash-loops, so an operator has to be able to tell them apart.
|
|
#
|
|
# pfhdr6 / rel 1: patch 0008 honors GAMESCOPE_NO_FOCUS — a mapped-but-unpainted window carrying it
|
|
# (Bazzite's hhd-ui crash-looping under a headless takeover) used to WIN focus selection and turn
|
|
# the composite (and the stream) black while every health signal stayed green. No capability the
|
|
# host probes for, but a field box's banner has to distinguish a build that can lose its composite
|
|
# this way from one that cannot.
|
|
pkgrel=1
|
|
pkgdesc="gamescope with 10-bit BT.2020/PQ PipeWire capture, for punktfunk HDR streaming"
|
|
arch=('x86_64' 'aarch64')
|
|
url="https://git.unom.io/unom/punktfunk"
|
|
license=('BSD-2-Clause')
|
|
# NOT a `provides`/`conflicts` of gamescope: this ships a differently-named binary and is meant to
|
|
# sit BESIDE the distro package (a Steam Deck's gaming session keeps using its own gamescope).
|
|
optdepends=('punktfunk-host: the streaming host that uses it')
|
|
# Mirrors Arch's own `gamescope` package. Keep in step with it when that one moves — this builds
|
|
# the same tree, so a dependency it grows is one this needs too.
|
|
depends=('glslang' 'libcap' 'libdrm' 'libinput' 'libx11' 'libxcomposite' 'libxdamage'
|
|
'libxext' 'libxkbcommon' 'libxmu' 'libxrender' 'libxres' 'libxtst' 'libxxf86vm'
|
|
'libavif' 'libdecor' 'hwdata' 'luajit' 'pipewire' 'seatd' 'sdl2-compat'
|
|
'vulkan-icd-loader' 'wayland' 'xcb-util-errors' 'xcb-util-wm' 'xorg-xwayland')
|
|
makedepends=('git' 'meson' 'ninja' 'cmake' 'glm' 'vulkan-headers' 'wayland-protocols'
|
|
'benchmark' 'libxcursor')
|
|
# Only the upstream tree is a `source=`. The patches are NOT listed: they are applied by the shared
|
|
# build script out of `patches/` beside this file, which is what keeps this package from drifting
|
|
# from the sysext / by-hand builds (a stale filename here used to mean a silently different binary).
|
|
# The submodules are pinned by the rev, so the git source is reproducible; `#commit=` makes makepkg
|
|
# check it out and `--recurse-submodules` pulls wlroots/vkroots/libliftoff/… with it.
|
|
source=("git+https://github.com/ValveSoftware/gamescope.git#commit=${_gsrev}")
|
|
# SKIP: the commit hash above IS the integrity check.
|
|
sha256sums=('SKIP')
|
|
options=('!lto' '!debug')
|
|
install="${pkgname}.install"
|
|
|
|
prepare() {
|
|
cd gamescope
|
|
git submodule update --init --recursive --depth 1
|
|
}
|
|
|
|
build() {
|
|
# ONE recipe. The patch set, the meson options and — load-bearing for a package — the
|
|
# `force_fallback_for` that keeps wlroots STATIC all live in the shared script. Arch has
|
|
# `wlroots` in its repos, so a plain `arch-meson` here would link it shared and ship a
|
|
# punktfunk-gamescope that dies with `libwlroots-0.19.so: cannot open shared object file` on
|
|
# every machine that installs the package but not that dev library.
|
|
#
|
|
# `$startdir` is this file's directory: the package is built from the punktfunk checkout
|
|
# (`makepkg -si` in packaging/gamescope), which is the only documented way to build it.
|
|
grep -q "^GAMESCOPE_REV=\"${_gsrev}\"" "${startdir}/build-punktfunk-gamescope.sh" || {
|
|
echo "PKGBUILD _gsrev drifted from GAMESCOPE_REV in build-punktfunk-gamescope.sh" >&2
|
|
return 1
|
|
}
|
|
bash "${startdir}/build-punktfunk-gamescope.sh" \
|
|
--srcdir "${srcdir}/gamescope" \
|
|
--destdir "${srcdir}/stage" \
|
|
--prefix /usr \
|
|
--jobs "$(nproc)"
|
|
# The marker is the host's whole HDR detection (`gamescope_patch_level`) — a build that lost the
|
|
# stamp would install a package that promises nothing and says so nowhere.
|
|
"${srcdir}/stage/usr/bin/punktfunk-gamescope" --version 2>&1 | grep -q '+pfhdr' || {
|
|
echo "built binary carries no +pfhdr marker" >&2
|
|
return 1
|
|
}
|
|
}
|
|
|
|
package() {
|
|
# ONLY the compositor, under our own name: a full `meson install` would also lay down
|
|
# gamescopectl / gamescopereaper / gamescopestream and the WSI layer, colliding file-for-file
|
|
# with the distro's `gamescope` package. The host only ever execs the compositor.
|
|
install -Dm755 "${srcdir}/stage/usr/bin/punktfunk-gamescope" \
|
|
"${pkgdir}/usr/bin/punktfunk-gamescope"
|
|
install -Dm644 gamescope/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
|
}
|