Files
RetroArch/samples/frontend/gamemode/Makefile
LibretroAdmin 7e6deceb07 Linux: implement Game Mode natively, drop deps/feralgamemode
Game Mode no longer dlopens Feral's libgamemode and asks gamemoded to
act for us. Of what gamemoded does with its stock configuration, two
things matter to RetroArch, and both can be done from inside the
process without root:

- I/O priority best-effort level 0 on every thread (gamemoded's
  ioprio=0 default). ioprio_set() acts on one thread, so every thread
  in /proc/self/task gets it; threads created later inherit it. The
  previous priority is put back on leaving.

- The CPU in its performance mode (gamemoded's governor and platform
  profile). This is now a "performance" HoldProfile on
  power-profiles-daemon (or tuned-ppd, same interface) over the system
  bus, which desktop polkit policy grants an active session without a
  password; the pre-0.20 net.hadess name is tried as a fallback. ppd
  drops the hold by itself when our connection goes away, so a crash
  never leaves the machine stuck in performance mode.

Screensaver inhibit, gamemoded's other default, RetroArch already does
with Suspend Screensaver. The rest of gamemoded (GPU clocks, split-lock
sysctl, X3D mode, core parking, renice, custom scripts) is opt-in there
or needs root, so it is not carried over.

The D-Bus exchange runs on a short-lived detached helper through the
existing libdbus run-time loader, so entering and leaving return at
once. Hand-over between helpers is one atomic word (want + busy, CAS
only), no locks. On exit only the I/O priority is restored and no
helper is started: the hold goes with the process's bus connection.

The code is plain C89, so C89 builds now get Game Mode too
(C89_GAMEMODE=no is gone). --disable-gamemode still turns it off.

samples/frontend/gamemode is rewritten: it builds gamemode_linux.c on
its own, runs a private dbus-daemon as the system bus with a fake ppd,
and checks the hold/release, the legacy name, a refusal, no daemon at
all, the I/O priority on existing and new threads, and that the exit
path sends nothing.
2026-10-28 19:25:36 +01:00

10 lines
128 B
Makefile

all: check
check:
@sh ./run.sh
# run.sh builds into a temporary directory it removes itself.
clean:
.PHONY: all check clean