Merge pull request 'perf: cut the image 38% and turn GPU acceleration back on' (#112) from perf/gpu-acceleration into dev
Reviewed-on: #112
This commit is contained in:
commit
92a82712da
5 changed files with 388 additions and 22 deletions
60
flake.nix
60
flake.nix
|
|
@ -53,6 +53,55 @@
|
|||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
|
||||
# Kiosk launcher. The GPU-related Electron flags sit in a shell variable
|
||||
# rather than being baked into ExecStart, so they can be changed on a
|
||||
# running machine by editing /var/lib/bitspire/.env and restarting the
|
||||
# unit. No rebuild, no reboot, and a bad value is one edit away from
|
||||
# being undone — which matters on a box whose screen nobody can see.
|
||||
#
|
||||
# THE DEFAULT IS NOW HARDWARE ACCELERATION.
|
||||
#
|
||||
# From the first ISO commit (19d43c2) until today the kiosk launched with
|
||||
# --disable-gpu AND --disable-software-rasterizer, which turns off GPU
|
||||
# compositing and the SwiftShader fallback together and leaves Chromium
|
||||
# rasterising every pixel on the CPU. Nothing in git ever justified the
|
||||
# pair: no comment, no issue, no commit message. Meanwhile the
|
||||
# descriptive config at /etc/bitspire/config.env claimed
|
||||
# ELECTRON_DISABLE_GPU=false, contradicting the actual command line.
|
||||
#
|
||||
# Tested on sintra 2026-09-24. With the flags removed the GPU process is
|
||||
# stable (zero crashes, zero service restarts) and genuinely on hardware
|
||||
# — /proc/<gpu-pid>/maps shows libgallium, libGLX_mesa and dri_gbm, with
|
||||
# no swrast and no SwiftShader — rendering through crocus on Braswell.
|
||||
# Confirmed by eye on the panel.
|
||||
#
|
||||
# DOURO IS EXEMPT. It keeps the old flags. Bay Trail carries three
|
||||
# separate display workarounds already — a 5.15 kernel pin for an i915
|
||||
# eDP regression, i915.enable_psr=0, and vt.handoff=7 to preserve the
|
||||
# BIOS display init — so it is the most plausible machine for the
|
||||
# original flags to have been a real fix rather than scaffolding. It is
|
||||
# also down pending a reflash, so it cannot be tested. Drop this
|
||||
# exemption once douro is back and accelerates cleanly.
|
||||
#
|
||||
# To override per machine, in /var/lib/bitspire/.env:
|
||||
# BITSPIRE_ELECTRON_GPU_FLAGS= acceleration
|
||||
# BITSPIRE_ELECTRON_GPU_FLAGS=--disable-gpu no GPU
|
||||
# BITSPIRE_ELECTRON_GPU_FLAGS=--use-gl=egl force EGL
|
||||
# (line absent) model default
|
||||
#
|
||||
# Note `-` and not `:-`: an explicitly EMPTY value means "no GPU flags at
|
||||
# all", and must not fall back to the default. Unquoted on purpose so the
|
||||
# value word-splits into argv.
|
||||
mkKioskLauncher = machineModel: atm-app: pkgs.writeShellScript "bitspire-kiosk" ''
|
||||
default_gpu_flags="${
|
||||
if machineModel == "douro" then "--disable-gpu --disable-software-rasterizer" else ""
|
||||
}"
|
||||
exec ${pkgs-unstable.electron}/bin/electron \
|
||||
--no-sandbox --disable-gpu-sandbox --enable-logging \
|
||||
''${BITSPIRE_ELECTRON_GPU_FLAGS-$default_gpu_flags} \
|
||||
${atm-app}
|
||||
'';
|
||||
|
||||
# Pure ATM app builder (no --impure needed)
|
||||
mkAtmApp = import ./nix/mkAtmApp.nix {
|
||||
inherit pkgs pkgs-unstable;
|
||||
|
|
@ -109,6 +158,7 @@
|
|||
inherit system;
|
||||
specialArgs = {
|
||||
inherit pkgs-unstable nixpkgs machineModel atm-app;
|
||||
kioskLauncher = mkKioskLauncher machineModel atm-app;
|
||||
};
|
||||
modules = [
|
||||
./deploy/nixos/live.nix
|
||||
|
|
@ -239,6 +289,14 @@
|
|||
VITE_SPIRE_SEED=
|
||||
ELECTRON_FORCE_PROD=1
|
||||
DISPLAY=:0
|
||||
# Uncomment to change Electron's GPU flags without a
|
||||
# rebuild, then `systemctl restart bitspire`. An empty
|
||||
# value means full GPU acceleration; the line being absent
|
||||
# means the shipped default (GPU and software rasterizer
|
||||
# both off). Commented rather than set, because a present
|
||||
# -but-empty value here would silently enable the GPU on
|
||||
# every machine that regenerates its .env.
|
||||
# BITSPIRE_ELECTRON_GPU_FLAGS=
|
||||
'' + pkgs.lib.optionalString (config.services.bitspire.relayUrl != "") ''
|
||||
VITE_RELAY_URL=${config.services.bitspire.relayUrl}
|
||||
'' + pkgs.lib.optionalString (config.services.bitspire.lnbitsServerPubkey != "") ''
|
||||
|
|
@ -254,7 +312,7 @@
|
|||
serviceConfig = {
|
||||
EnvironmentFile = lib.mkForce "/var/lib/bitspire/.env";
|
||||
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
||||
ExecStart = lib.mkForce "${pkgs-unstable.electron}/bin/electron --no-sandbox --disable-gpu-sandbox --disable-gpu --disable-software-rasterizer --enable-logging ${atm-app}";
|
||||
ExecStart = lib.mkForce "${mkKioskLauncher machineModel atm-app}";
|
||||
MemoryMax = lib.mkForce "1G";
|
||||
NoNewPrivileges = lib.mkForce false;
|
||||
ProtectSystem = lib.mkForce false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue