Merge branch 'main' into feat/performance-fixes-2

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-01 12:44:00 -04:00
commit 0e1f6f15a1
20 files changed
+716 -80

No files matched your search

@@ -150,6 +150,11 @@ if [ -z "${BL_INSIDE:-}" ]; then
args+=(-r "$BL_REFRESH")
fi
[ "$mode" = steam ] && args+=(-e)
# Touch passes through to the client as touch until the client says otherwise, as SteamOS's
# gamescope-session starts it (TOUCH_MODE=4). The client sets the mode itself (STEAM_TOUCH_CLICK_MODE)
# only once it has a controller; until then gamescope's own default made a finger a left-click
# mouse, so the Steam interface took taps but would not scroll on a phone with no pad attached.
[ "$mode" = steam ] && args+=(--default-touch-mode 4)
# A game that resizes its own window when it loses focus (the Steam menu opening over it) comes
# back smaller, and gamescope draws a window that is not flagged fullscreen at its own size in
# the top-left corner. Forcing every window to the output's size keeps it filling the screen.
@@ -431,6 +436,37 @@ case $mode in
prev=$app
done
) &
# Evidence for touch reports: the touch mode the client asks gamescope for (STEAM_TOUCH_CLICK_MODE,
# set once it has a controller, per focused app) and which app has focus, logged as they change.
# A finger that clicks but won't scroll, or touch that stops once a pad is used, shows here as
# the mode in force at that moment. 4 is touch passed through, 1 a left-click mouse.
[ -z "${BL_DESKTOP:-}" ] && (
# What follows "=" in an xprop line, or $2 for a property that is missing or has no value
# yet ("NAME(CARDINAL) =", which read leaves with nothing after the "=").
xprop_value() {
case $1 in *'not found'*|*=) echo "$2"; return ;; esac
local v=${1#*=}
v=${v# }
echo "${v:-$2}"
}
tmode= app=
xprop -spy -root STEAM_TOUCH_CLICK_MODE GAMESCOPE_FOCUSED_APP 2>/dev/null | while read -r line; do
case $line in
STEAM_TOUCH_CLICK_MODE*)
v=$(xprop_value "$line" unset)
[ "$v" = "$tmode" ] && continue
tmode=$v
echo "== touch mode: $tmode (focused app ${app:-?}) at $(date +%T)"
;;
GAMESCOPE_FOCUSED_APP*)
v=$(xprop_value "$line" none)
[ "$v" = "$app" ] && continue
app=$v
echo "== focused app: $app (touch mode ${tmode:-unset}) at $(date +%T)"
;;
esac
done
) &
# The library beat. Both helpers are whole programs under proot (the compat one a python
# start and a parse of the client's config), and nearly every beat has nothing new for them.
# The seeder marks Proton's prefix template as well as the prefixes, so a new prefix is born
+58
View File
@@ -0,0 +1,58 @@
/*
* Adreno revisions the runtime's Turnip does not know, reported as the revision it does.
*
* Retail SM8850 phones report their A840 as chip_id 0x44050A21 (KGSL gpu_model "Adreno840v2").
* Mesa only lists 0x44050A31, so the runtime's glibc Turnip refuses the device outright
* ("device (chip_id = 44050A21, gpu_id = 6860) is unsupported") and gamescope exits before Steam
* starts. Banners-Turnip fixes its own builds by registering the v2 id on the same A840 GPU info
* (patches/a840v2.py); answering KGSL's device-info query with the known id has the same effect
* on any Turnip in the session, including the one the runtime was built with. A driver that
* already knows the v2 id resolves the rewritten one to the same entry.
*
* Only the KGSL device-info property is touched. Its layout is the kernel's uapi (msm_kgsl.h).
*/
#define _GNU_SOURCE 1
#include <stddef.h>
#include <sys/ioctl.h>
struct kgsl_devinfo {
unsigned int device_id;
unsigned int chip_id;
unsigned int mmu_enabled;
unsigned long gmem_gpubaseaddr;
unsigned int gpu_id;
size_t gmem_sizebytes;
};
struct kgsl_device_getproperty {
unsigned int type;
void *value;
size_t sizebytes;
};
#define KGSL_IOC_TYPE 0x09
#define IOCTL_KGSL_DEVICE_GETPROPERTY _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty)
#define KGSL_PROP_DEVICE_INFO 0x1
static const struct {
unsigned int reported;
unsigned int known;
} CHIP_IDS[] = {
{0x44050A21, 0x44050A31}, /* Adreno 840v2 -> Adreno 840 */
};
void bl_kgsl_chip_id_fixup(unsigned long request, void *arg, int rc) {
if (rc != 0 || request != IOCTL_KGSL_DEVICE_GETPROPERTY || arg == NULL) return;
struct kgsl_device_getproperty *prop = arg;
if (prop->type != KGSL_PROP_DEVICE_INFO || prop->value == NULL
|| prop->sizebytes < sizeof(struct kgsl_devinfo)) {
return;
}
struct kgsl_devinfo *info = prop->value;
for (size_t i = 0; i < sizeof(CHIP_IDS) / sizeof(CHIP_IDS[0]); i++) {
if (info->chip_id == CHIP_IDS[i].reported) {
info->chip_id = CHIP_IDS[i].known;
return;
}
}
}
+3 -2
View File
@@ -349,6 +349,7 @@ static int is_link_query(unsigned long request) {
|| request == SIOCGIFBRDADDR;
}
void bl_kgsl_chip_id_fixup(unsigned long request, void *arg, int rc); /* kgslid.c */
int bl_kgsl_poll(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
void *arg, int *rc) __attribute__((visibility("hidden")));
@@ -364,8 +365,8 @@ int ioctl(int fd, unsigned long request, ...) {
if (real == NULL) real = (ioctl_fn) dlsym(RTLD_NEXT, "ioctl");
int rc;
if (bl_kgsl_poll(real, fd, request, arg, &rc)) return rc;
rc = real(fd, request, arg);
if (!bl_kgsl_poll(real, fd, request, arg, &rc)) rc = real(fd, request, arg);
bl_kgsl_chip_id_fixup(request, arg, rc);
if (arg == NULL || !is_link_query(request)) return rc;
int saved = errno;
if (answer_ifreq(request, (struct ifreq *) arg, rc)) return 0;