Code Monkey home page Code Monkey logo

gamemode's Introduction

GameMode

GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS and/or a game process.

GameMode was designed primarily as a stop-gap solution to problems with the Intel and AMD CPU powersave or ondemand governors, but is now host to a range of optimisation features and configurations.

Currently GameMode includes support for optimisations including:

  • CPU governor
  • I/O priority
  • Process niceness
  • Kernel scheduler (SCHED_ISO)
  • Screensaver inhibiting
  • GPU performance mode (NVIDIA and AMD), GPU overclocking (NVIDIA)
  • CPU core pinning or parking
  • Custom scripts

GameMode packages are available for Ubuntu, Debian, Solus, Arch, Gentoo, Fedora, OpenSUSE, Mageia and possibly more.

Issues with GameMode should be reported here in the issues section, and not reported to Feral directly.


Requesting GameMode

For games/launchers which integrate GameMode support (see list later on), simply running the game will automatically activate GameMode.

For others, you must manually request GameMode when running the game. This can be done by launching the game through gamemoderun:

gamemoderun ./game

Or edit the Steam launch options:

gamemoderun %command%

Note: for older versions of GameMode (before 1.3) use this string in place of gamemoderun:

LD_PRELOAD="$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0"

Please note the backslash here in \$LIB is required.


Configuration

The daemon is configured with a gamemode.ini file. example/gamemode.ini is an example of what this file would look like, with explanations for all the variables.

Configuration files are loaded and merged from the following directories, from highest to lowest priority:

  1. $PWD ("unsafe" - [gpu] settings take no effect in this file)
  2. $XDG_CONFIG_HOME or $HOME/.config/ ("unsafe" - [gpu] settings take no effect in this file)
  3. /etc/
  4. /usr/share/gamemode/

Note for Hybrid GPU users

It's not possible to integrate commands like optirun automatically inside GameMode, since the GameMode request is made once the game has already started. However it is possible to use a hybrid GPU wrapper like optirun by starting the game with gamemoderun.

You can do this by setting the environment variable GAMEMODERUNEXEC to your wrapper's launch command, so for example GAMEMODERUNEXEC=optirun, GAMEMODERUNEXEC="env DRI_PRIME=1", or GAMEMODERUNEXEC="env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only". This environment variable can be set globally (e.g. in /etc/environment), so that the same prefix command does not have to be duplicated everywhere you want to use gamemoderun.

GameMode will not be injected to the wrapper.


Apps with GameMode integration

Games

The following games are known to integrate GameMode support (meaning they don't require any additional configuration to activate GameMode while running):

  • DiRT 4
  • Rise of the Tomb Raider
  • Shadow of the Tomb Raider
  • Total War Saga: Thrones of Britannia
  • Total War: ROME REMASTERED
  • Total War: Three Kingdoms
  • Total War: WARHAMMER II
  • Total War: WARHAMMER III

Others

Other apps which can integrate with GameMode include:

  • ATLauncher Minecraft launcher
  • Cemu Wii U emulator.
  • GNOME Shell (via extension) - indicates when GameMode is active in the top panel.
  • Lutris - Enables GameMode for all games by default if available (must have both 32- and 64-bit GameMode libraries installed), configurable in preferences.
  • Prism Launcher Minecraft launcher
  • RetroArch - is a frontend for emulators, game engines and media players.
  • Vinegar - Roblox Player/Studio bootstrapper.

Development Build and test

The design of GameMode has a clear-cut abstraction between the host daemon and library (gamemoded and libgamemode), and the client loaders (libgamemodeauto and gamemode_client.h) that allows for safe use without worrying about whether the daemon is installed or running. This design also means that while the host library currently relies on systemd for exchanging messages with the daemon, it's entirely possible to implement other internals that still work with the same clients.

See repository subdirectories for information on each component.

Install Dependencies

GameMode depends on meson for building and systemd for internal communication. This repo contains a bootstrap.sh script to allow for quick install to the user bus, but check meson_options.txt for custom settings.

Ubuntu/Debian (you may also need dbus-user-session)

apt install meson libsystemd-dev pkg-config ninja-build git libdbus-1-dev libinih-dev build-essential

On Ubuntu 18.04, you'll need to install python3 package and install the latest meson version from pip.

python3 -m venv .venv
source .venv/bin/activate
pip install meson

Later you can deactivate the virtual environment and remove it.

deactivate
rm -rf .venv

Arch

pacman -S meson systemd git dbus libinih

Fedora

dnf install meson systemd-devel pkg-config git dbus-devel

Gentoo

Gentoo has an ebuild which builds a stable release from sources. It will also pull in all the dependencies so you can work on the source code.

emerge --ask games-util/gamemode

You can also install using the latest sources from git:

ACCEPT_KEYWORDS="**" emerge --ask ~games-util/gamemode-9999

Build and Install GameMode

Then clone, build and install a release version of GameMode at 1.8.1:

git clone https://github.com/FeralInteractive/gamemode.git
cd gamemode
git checkout 1.8.1 # omit to build the master branch
./bootstrap.sh

To test GameMode installed and will run correctly:

gamemoded -t

To uninstall:

systemctl --user stop gamemoded.service
ninja uninstall -C builddir

Pull Requests

Pull requests must match with the coding style found in the .clang-format file, please run this before committing:

clang-format -i $(find . -name '*.[ch]' -not -path "*subprojects/*")

Maintained by

Feral Interactive

See the contributors section for an extended list of contributors.


License

Copyright © 2017-2023 Feral Interactive

GameMode is available under the terms of the BSD 3-Clause License (Revised)

The "inih" library is distributed under the New BSD license

gamemode's People

Contributors

aejsmith avatar afayaz-feral avatar akien-mga avatar ashuntu avatar bashton-ajenkins avatar begin-theadventure avatar calinou avatar chewi avatar gfxstrand avatar gicmo avatar henrikholst avatar ikeydoherty avatar kakra avatar kira-bruneau avatar mdiluz avatar mgerstner avatar notpeelz avatar ollic avatar patrickpulfer avatar quickstick4 avatar reillybrogan avatar rickandtired avatar rombert avatar samrocketman avatar stephanlachnit avatar suvayu avatar terencode avatar tgurr avatar trial97 avatar vam-jam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gamemode's Issues

Failed to enable unit: Unit file gamemoded.service does not exist.

EDIT : Xubuntu not Ubuntu

Hello, I'm trying to install gamemode but it fails. I did exactly as the readme says.

Xubuntu 18.04, nvidia 396.18 drivers.

`$ ./bootstrap.sh

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    Directory already configured, exiting Meson. Just run your build command
    (e.g. ninja) and Meson will regenerate as necessary. If ninja fails, run ninja
    reconfigure to force Meson to regenerate.

If build failures persist, manually wipe your build directory to clear any
stored system data.

To change option values, run meson configure instead.

  • cd build
  • ninja
    ninja: no work to do.
  • set +x
    Install to /usr? [Yy] y
  • sudo ninja install
    [0/1] Installing files.
    Installing lib/libgamemode.so to /usr/lib/x86_64-linux-gnu/libgamemode.so
    Installing lib/libgamemodeauto.so to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so
    Installing daemon/gamemoded to /usr/bin/gamemoded
    Installing daemon/cpugovctl to /usr/libexec/cpugovctl
    Installing gamemode_client.h to /usr/include/
    Installing /GAMES/gamemode/gamemode-1.0/data/gamemoded.1 to /usr/share/man/man1
    Installing /GAMES/gamemode/gamemode-1.0/build/data/gamemoded.service to /etc/systemd/user
    Installing /GAMES/gamemode/gamemode-1.0/build/data/com.feralinteractive.GameMode.policy to /usr/share/polkit-1/actions
  • set +x
    Enable and run the daemon? [Yy] y
  • systemctl --user daemon-reload
  • systemctl --user enable gamemoded
    Failed to enable unit: Unit file gamemoded.service does not exist.`

Error while compiling and running on Mint 18.2

Got this error after running ./bootstrap.sh

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    The Meson build system
    Version: 0.40.1
    Source dir: /home/alex/Downloads/gamemode
    Build dir: /home/alex/Downloads/gamemode/build
    Build type: native build
    Project name: gamemode
    Native c compiler: cc (gcc 5.4.0)
    Build machine cpu family: x86_64
    Build machine cpu: x86_64
    Found pkg-config: /usr/bin/pkg-config (0.29.1)
    Native dependency libsystemd found: YES 229
    Dependency threads found: YES
    Library dl found: YES
    Configuring config.h using configuration
    Cloning into 'inih'...
    remote: Counting objects: 341, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 341 (delta 0), reused 2 (delta 0), pack-reused 338
    Receiving objects: 100% (341/341), 63.05 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (202/202), done.
    Checking connectivity... done.

Executing subproject inih.

Project name: inih
Native c compiler: cc (gcc 5.4.0)
Build targets in project: 3

Subproject inih finished.
Configuring gamemoded.service using configuration
Configuring com.feralinteractive.GameMode.policy using configuration
Message:

Build configuration:
====================

prefix:                                 /usr
bindir:                                 /usr/bin
datadir:                                /usr/share
libdir:                                 /usr/lib/x86_64-linux-gnu
libexecdir:                             /usr/libexec
includedir:                             /usr/include
systemd user unit directory:            /etc/systemd/user
PolKit Action Directory:                /usr/share/polkit-1/actions

Options:
========

daemon:                                 true
examples:                               true
systemd:                                true

Build targets in project: 7

  • cd build
  • ninja
    [2/20] Compiling c object 'daemon/gamemoded@exe/dbus_messaging.c.o'
    FAILED: daemon/gamemoded@exe/dbus_messaging.c.o
    cc '-Idaemon/gamemoded@exe' '-Idaemon' '-I../daemon' '-I.' '-I../' '-Isubprojects/inih' '-I../subprojects/inih' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=c11' '-O0' '-g' '-fstack-protector' '-Wall' '-pedantic' '-Wstrict-prototypes' '-Wundef' '-fno-common' '-Werror-implicit-function-declaration' '-Wformat' '-Wformat-security' '-Werror=format-security' '-Wconversion' '-Wunused-variable' '-Wunreachable-code' '-W' '-pthread' '-MMD' '-MQ' 'daemon/gamemoded@exe/dbus_messaging.c.o' '-MF' 'daemon/gamemoded@exe/dbus_messaging.c.o.d' -o 'daemon/gamemoded@exe/dbus_messaging.c.o' -c ../daemon/dbus_messaging.c
    In file included from /usr/include/systemd/sd-bus.h:28:0,
    from ../daemon/dbus_messaging.c:40:
    /usr/include/systemd/sd-event.h:72:67: error: unknown type name ‘siginfo_t’
    typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
    ^
    [4/20] Compiling c object 'lib/gamemode@sha/client_impl.c.o'
    FAILED: lib/gamemode@sha/client_impl.c.o
    cc '-Ilib/gamemode@sha' '-Ilib' '-I../lib' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=c11' '-O0' '-g' '-fstack-protector' '-Wall' '-pedantic' '-Wstrict-prototypes' '-Wundef' '-fno-common' '-Werror-implicit-function-declaration' '-Wformat' '-Wformat-security' '-Werror=format-security' '-Wconversion' '-Wunused-variable' '-Wunreachable-code' '-W' '-fPIC' '-MMD' '-MQ' 'lib/gamemode@sha/client_impl.c.o' '-MF' 'lib/gamemode@sha/client_impl.c.o.d' -o 'lib/gamemode@sha/client_impl.c.o' -c ../lib/client_impl.c
    In file included from /usr/include/systemd/sd-bus.h:28:0,
    from ../lib/client_impl.c:36:
    /usr/include/systemd/sd-event.h:72:67: error: unknown type name ‘siginfo_t’
    typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
    ^
    [11/20] Compiling c object 'daemon/gamemoded@exe/daemon_config.c.o'
    ninja: build stopped: subcommand failed.

gamemode does not support 32-bit games

It cannot work with 32-bit games as it uses LD_PRELOAD with a 64-bit library. Maybe having a 32-bit compat library for these use cases could be useful.

Trouble building on Debian

Hi! Nice project, I'm having some trouble building this in debian:

meson.build:86:4: ERROR: Subproject directory 'subprojects/inih' does not exist and cannot be downloaded:
Automatic wrap-based subproject downloading is disabled

I have libinih1, libinih-dev in my build-deps, is it possible to use those instead?

thanks!

Incompatible with SteamOS

This code sounds very good but one thing "IT WON'T INSTALL ON STEAMOS". I would really like to try it ot but no steamos support.

I can't run the daemon

When I execute "sudo ./bootstrap.sh" I have the following error:
Failed to connect to bus: Non hai tal ficheiro ou directorio (in English: There is no such file or directory)

You can see the process in terminal:

sudo ./bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
Trying to run Meson on a build directory that has already been configured.
If you want to build it, just run your build command (e.g. ninja) inside the
build directory. Meson will autodetect any changes in your setup and regenerate
itself as required. Though it shouldn't be necessary, running ninja reconfigure
will force Meson to regenerate the build files.

If you want to change option values, use meson configure instead.
+ cd build
+ ninja
ninja: no work to do.
+ set +x
Install to /usr? [Yy] y
+ sudo ninja install
[0/1] Installing files.
Installing lib/libgamemode.so to /usr/lib/x86_64-linux-gnu/libgamemode.so
Installing lib/libgamemodeauto.so to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so
Installing daemon/gamemoded to /usr/bin/gamemoded
Installing daemon/cpugovctl to /usr/libexec/cpugovctl
Installing gamemode_client.h to /usr/include/
Installing /home/leo/gamemode/data/gamemoded.1 to /usr/share/man/man1
Installing /home/leo/gamemode/build/data/gamemoded.service to /etc/systemd/user
Installing /home/leo/gamemode/build/data/com.feralinteractive.GameMode.policy to /usr/share/polkit-1/actions
+ set +x
Enable and run the daemon? [Yy] y
+ systemctl --user daemon-reload
Failed to connect to bus: Non hai tal ficheiro ou directorio

I use Ubuntu 17.10

Error: gamemode not work in ubuntu 16.04

`bruno@brunobook:~/.gamemode/gamemode$ ./bootstrap.sh

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    Directory already configured, exiting Meson. Just run your build command
    (e.g. ninja) and Meson will regenerate as necessary. If ninja fails, run ninja
    reconfigure to force Meson to regenerate.

If build failures persist, manually wipe your build directory to clear any
stored system data.

To change option values, run meson configure instead.

  • cd build
  • ninja
    ninja: no work to do.
  • set +x
    Install to /usr? [Yy] y
  • sudo ninja install
    [0/1] Installing files.
    Installing lib/libgamemode.so to /usr/lib/x86_64-linux-gnu/libgamemode.so
    Installing lib/libgamemodeauto.so to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so
    Installing daemon/gamemoded to /usr/bin/gamemoded
    Installing daemon/cpugovctl to /usr/libexec/cpugovctl
    Installing gamemode_client.h to /usr/include/
    Installing /home/bruno/.gamemode/gamemode/data/gamemoded.1 to /usr/share/man/man1
    Installing /home/bruno/.gamemode/gamemode/build/data/gamemoded.service to /etc/systemd/user
    Installing /home/bruno/.gamemode/gamemode/build/data/com.feralinteractive.GameMode.policy to /usr/share/polkit-1/actions
  • set +x
    Enable and run the daemon? [Yy] y
  • systemctl --user daemon-reload
  • systemctl --user enable gamemoded
  • systemctl --user start gamemoded
    Failed to start gamemoded.service: Unit dbus.socket is not loaded properly: Invalid argument.
    See user logs and 'systemctl --user status gamemoded.service' for details.

    bruno@brunobook:~/.gamemode/gamemode$ systemctl --user status gamemoded.service
    ● gamemoded.service - gamemoded
    Loaded: loaded (/etc/systemd/user/gamemoded.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Ter 2018-04-10 11:15:17 -03; 1h 6min ago
    Main PID: 1337 (code=exited, status=1/FAILURE)

Abr 10 11:15:17 brunobook systemd[1330]: Starting gamemoded...
Abr 10 11:15:17 brunobook /usr/bin/gamemoded[1337]: Note: No config file found [gamemode.ini] in working directory or in [/usr/share/gamemode/]
Abr 10 11:15:17 brunobook /usr/bin/gamemoded[1337]: governor is set to [performance]
Abr 10 11:15:17 brunobook systemd[1330]: gamemoded.service: Main process exited, code=exited, status=1/FAILURE
Abr 10 11:15:17 brunobook systemd[1330]: Failed to start gamemoded.
Abr 10 11:15:17 brunobook systemd[1330]: gamemoded.service: Unit entered failed state.
Abr 10 11:15:17 brunobook systemd[1330]: gamemoded.service: Failed with result 'exit-code'.
`

gamemodeauto: Could not call method on bus: No route to host

Hello,

When I start a game with:
LD_PRELOAD="/usr/\$LIB/libgamemodeauto.so" ./game

I get the message:
gamemodeauto: Could not call method on bus: No route to host

Is this a typical message? Is this a sign that there was a problem with the installation?

I am running Ubuntu 16.04 LTS. bootstrap.sh was run successfully. systemctl reports that the gamemoded service is running.

Thanks!

cannot open shared object file

Describe the bug
I am facing to error messages telling library not loaded

Launched a new terminal window and created "exec" file that contains "echo ok" on my dektop

havva@havva:~$ bash
havva@havva:~$ /home/havva/Masaüstü/exec
ok!
havva@havva:~$ LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so.0 sh -c "/home/havva/Masaüstü/exec"
ok!
havva@havva:~$ LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so.0 /home/havva/Masaüstü/exec
ok!
havva@havva:~$ exit
exit
havva@havva:~$ bash
havva@havva:~$ LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0 '/home/havva/Masaüstü/exec'
ok!
havva@havva:~$ LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0 sh -c '/home/havva/Masaüstü/exec'
ok!
havva@havva:~$ exit

But when i try to launch it with a game:

havva@havva:~$ bash
havva@havva:~$ sh -c "cd /home/havva/Programlar/BombSquad/BombSquad_Linux_64bit_1.4.137;xrandr --listmonitors | grep HDMI-1 -q; if [ $? = 0 ]; then xrandr --output eDP-1 --off --output HDMI-1 --mode 0x8d; else xrandr --output eDP-1 --mode 0x48; fi; LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0 ./bombsquad; xrandr --output eDP-1 --auto --left-of HDMI-1 --output HDMI-1 --auto"
ERROR: ld.so: object '/usr//libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
BombSquad 1.4.137 build 14336.
>>> AL lib: (EE) alc_cleanup: 1 device not closed
havva@havva:~$ exit
exit
havva@havva:~$ bash
havva@havva:~$ sh -c "cd /home/havva/Programlar/BombSquad/BombSquad_Linux_64bit_1.4.137;xrandr --listmonitors | grep HDMI-1 -q; if [ $? = 0 ]; then xrandr --output eDP-1 --off --output HDMI-1 --mode 0x8d; else xrandr --output eDP-1 --mode 0x48; fi; LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so.0 ./bombsquad; xrandr --output eDP-1 --auto --left-of HDMI-1 --output HDMI-1 --auto"
ERROR: ld.so: object '/usr//libgamemodeauto.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
BombSquad 1.4.137 build 14336.
>>> AL lib: (EE) alc_cleanup: 1 device not closed

I don't understand if gamemode is actually launching or not, i don't know where is the log file too

Expected behavior
A clear and concise description of what you expected to happen.

System Info (please complete the following information):

  • OS and version: Linux Mint 19 "Tara"
  • GameMode Version v1.2-dev

Uninstall documented?

There is no clear instruction that i've seen to disable and/or fully remove this software.

If the code was made available as PPA it could be more easily updated/autoupdated/removed. Adoption of this might increase too perhaps.

Having had issue with my system after install I had hope to cleanly remove this for diagnosing, and have hardware configuration return to default state.

Missing DISPLAY environment variable in systemd user service after first start

Hi,

i have started using the new custom user script functionality to put my Nvidia GPU into performance mode. I am using this config for that:

[custom]
; Custom scripts (executed using the shell) when gamemode starts and ends
start=notify-send "GameMode started"
    nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'

end=notify-send "GameMode ended"
    nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0'

The problem with this is sometimes nvidia-settings fails to run because it needs the DISPLAY enviroment variable (+ XAUTHORITY probably), which is missing when the service first gets started.

I can see with systemctl --user show-environment that the variables are there. But when i look at the actual environment from the gamemoded process with tr '\0' '\n' < /proc/<pid>/environ they are missing. But after a service restart the variables are there. I suspect the problem is that the service is run too early before the X server had time to execute /etc/X11/xinit/xinitrc.d/50-systemd-user.sh (See [1]) which source these variables into systemds user daemon.

By using a small delay with ExecStartPre=/usr/bin/sleep 5 the problem is gone, but there must be a better solution to this. I have this problem on Fedora and Arch Linux so it probably affects all distros.

[1] https://wiki.archlinux.org/index.php/Systemd/User#DISPLAY_and_XAUTHORITY

SELinux hinders mandb to read access gamemoded.1.gz on Fedora

Hi,

i am using gamemoded since yesterday on my Fedora Laptop. Today i got a SELinux warning.
mandb tried to access /usr/share/man/man1/gamemoded.1.gz and got rejected.

I followed the hint to fix the label of gamemoded.1.gz to be man_t by executing
/sbin/restorecon -v /usr/share/man/man1/gamemoded.1.gz.

If you want to fix the label. 
/usr/share/man/man1/gamemoded.1.gz default label should be man_t.
Dannyou can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Ausführen
# /sbin/restorecon -v /usr/share/man/man1/gamemoded.1.gz

Maybe this is something that can the done by the bootstrap.sh installation file?

bootstrap.sh fails on ubuntu 16.04

Hi, I have followed the steps to install and I get to this error:
user@u16:~/gamemode-1.0$ ./bootstrap.sh

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    The Meson build system
    Version: 0.40.1
    Source dir: /home/user/gamemode-1.0
    Build dir: /home/user/gamemode-1.0/build
    Build type: native build
    Project name: gamemode
    Native c compiler: cc (gcc 5.4.0)
    Build machine cpu family: x86_64
    Build machine cpu: x86_64
    Found pkg-config: /usr/bin/pkg-config (0.29.1)
    Native dependency libsystemd found: YES 229
    Dependency threads found: YES
    Library dl found: YES
    Configuring config.h using configuration

Executing subproject inih.

Project name: inih
Native c compiler: cc (gcc 5.4.0)
Build targets in project: 3

Subproject inih finished.
Configuring gamemoded.service using configuration
Configuring com.feralinteractive.GameMode.policy using configuration
Message:

Build configuration:
====================

prefix:                                 /usr
bindir:                                 /usr/bin
datadir:                                /usr/share
libdir:                                 /usr/lib/x86_64-linux-gnu
libexecdir:                             /usr/libexec
includedir:                             /usr/include
systemd user unit directory:            /etc/systemd/user
PolKit Action Directory:                /usr/share/polkit-1/actions

Options:
========

daemon:                                 true
examples:                               true
systemd:                                true

Build targets in project: 7

  • cd build
  • ninja
    [4/20] Compiling c object 'daemon/gamemoded@exe/dbus_messaging.c.o'
    FAILED: daemon/gamemoded@exe/dbus_messaging.c.o
    cc '-Idaemon/gamemoded@exe' '-Idaemon' '-I../daemon' '-I.' '-I../' '-Isubprojects/inih' '-I../subprojects/inih' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=c11' '-O0' '-g' '-fstack-protector' '-Wall' '-pedantic' '-Wstrict-prototypes' '-Wundef' '-fno-common' '-Werror-implicit-function-declaration' '-Wformat' '-Wformat-security' '-Werror=format-security' '-Wconversion' '-Wunused-variable' '-Wunreachable-code' '-W' '-pthread' '-MMD' '-MQ' 'daemon/gamemoded@exe/dbus_messaging.c.o' '-MF' 'daemon/gamemoded@exe/dbus_messaging.c.o.d' -o 'daemon/gamemoded@exe/dbus_messaging.c.o' -c ../daemon/dbus_messaging.c
    In file included from /usr/include/systemd/sd-bus.h:28:0,
    from ../daemon/dbus_messaging.c:40:
    /usr/include/systemd/sd-event.h:72:67: error: unknown type name ‘siginfo_t’
    typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
    ^
    [5/20] Compiling c object 'lib/gamemode@sha/client_impl.c.o'
    FAILED: lib/gamemode@sha/client_impl.c.o
    cc '-Ilib/gamemode@sha' '-Ilib' '-I../lib' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=c11' '-O0' '-g' '-fstack-protector' '-Wall' '-pedantic' '-Wstrict-prototypes' '-Wundef' '-fno-common' '-Werror-implicit-function-declaration' '-Wformat' '-Wformat-security' '-Werror=format-security' '-Wconversion' '-Wunused-variable' '-Wunreachable-code' '-W' '-fPIC' '-MMD' '-MQ' 'lib/gamemode@sha/client_impl.c.o' '-MF' 'lib/gamemode@sha/client_impl.c.o.d' -o 'lib/gamemode@sha/client_impl.c.o' -c ../lib/client_impl.c
    In file included from /usr/include/systemd/sd-bus.h:28:0,
    from ../lib/client_impl.c:36:
    /usr/include/systemd/sd-event.h:72:67: error: unknown type name ‘siginfo_t’
    typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
    ^
    [13/20] Compiling c object 'daemon/daemon-common@sta/governors-query.c.o'
    ninja: build stopped: subcommand failed.

Gamemode with Wine

Hi, sorry if this is the wrong place to ask, i'm new to linux. Is there a way to start gamemode for a game tha runs on steam installed on Wine?

Gamemode no route to host message on Plasma-Wayland

I have installed gamemode on Arch Linux and the service seems to run well:

$ systemctl --user status gamemoded
● gamemoded.service - gamemoded
Loaded: loaded (/usr/lib/systemd/user/gamemoded.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-04-22 12:08:53 CEST; 18s ago
Main PID: 1425 (gamemoded)
CGroup: /user.slice/user-1000.slice/[email protected]/gamemoded.service
└─1425 /usr/bin/gamemoded -l

Apr 22 12:08:53 pc /usr/bin/gamemoded[1425]: Note: No config file found [gamemode.ini] in working directory or in [/usr/share/gamemode/]
Apr 22 12:08:53 pc /usr/bin/gamemoded[1425]: governor is set to [schedutil]
Apr 22 12:08:53 pc /usr/bin/gamemoded[1425]: Successfully initialised bus with name [com.feralinteractive.GameMode]...
Apr 22 12:08:53 pc systemd[1419]: Starting gamemoded...
Apr 22 12:08:53 pc systemd[1419]: Started gamemoded.

However if starting a game on Plasma-Wayland, then I get the following message/error:
$ LD_PRELOAD=/usr/$LIB/libgamemodeauto.so ./game
gamemodeauto: Could not call method on bus: No route to host

Add fedora dependencies

To build in Fedora (tested in fedora 27) I install these dependencies:

dnf install meson pkgconfig systemd-devel

meson has ninja-build as dependency and install it.

Fedora package related issues (lib versioning)

Hi,
I work in Red Hat's Desktop Hardware Enablement team and are currently working on packaging gamemode for Fedora (see fedora-workstation issue 61, review request rhbz#1596293).
After doing the initial packaging I have a couple of questions/issues:

  • Issues:

    • location of the libraries (currently /usr/lib64)
      They are unversioned which normally is a big no-no: "In cases where upstream ships unversioned .so library (so this is not needed for plugins, drivers, etc.), the packager MUST try to convince upstream to start versioning it." (see "Downstream .so name versioning"). Maybe that is ok to not have them versioned, because they are internal, i.e. get dlopen'ed by the inlined functions from the inlined functions in the header, but then we should install them in a private location (i.e. /usr/lib64/gamemode/ like we did for renderdoc). OTOH, umockdev also has a private, ld-preload only library and that is versioned: /usr/lib64/libumockdev-preload.so.0 & libumockdev-preload.so.0.0.0.
  • Questions:

    • location of the gamemoded daemon (currently /usr/bin)
      Any reason why it is not in /usr/libexec/?

    • man page section for gamemoded (1 vs 8)
      It is a daemon, so should be in section 8?

More out of curiosity, why a session daemon and not a system one?

bootstrap.sh fails on Linux Mint 18.3 and Ubuntu 16.04

Hi, I have followed the steps to install and I get to this error:

triodo@led ~/gamemode-1.0 $ ./bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.40.1
Source dir: /home/triodo/gamemode-1.0
Build dir: /home/triodo/gamemode-1.0/build
Build type: native build
Project name: gamemode
Native c compiler: cc (gcc 5.4.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Native dependency libsystemd found: YES 229
Dependency threads found: YES
Library dl found: YES
Configuring config.h using configuration
Clonar en «inih»...
remote: Counting objects: 341, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 341 (delta 0), reused 2 (delta 0), pack-reused 338
Receiving objects: 100% (341/341), 63.05 KiB | 0 bytes/s, done.
Resolving deltas: 100% (202/202), done.
Comprobando la conectividad… hecho.

Executing subproject inih.

Project name: inih
Native c compiler: cc (gcc 5.4.0)
Build targets in project: 3

Subproject inih finished.
Configuring gamemoded.service using configuration
Configuring com.feralinteractive.GameMode.policy using configuration
Message: 


    Build configuration:
    ====================

    prefix:                                 /usr
    bindir:                                 /usr/bin
    datadir:                                /usr/share
    libdir:                                 /usr/lib/x86_64-linux-gnu
    libexecdir:                             /usr/libexec
    includedir:                             /usr/include
    systemd user unit directory:            /etc/systemd/user
    PolKit Action Directory:                /usr/share/polkit-1/actions

    Options:
    ========

    daemon:                                 true
    examples:                               true
    systemd:                                true


Build targets in project: 7
+ cd build
+ ninja
[1/20] Compiling c object 'daemon/gamemoded@exe/dbus_messaging.c.o'
FAILED: daemon/gamemoded@exe/dbus_messaging.c.o 
cc  '-Idaemon/gamemoded@exe' '-Idaemon' '-I../daemon' '-I.' '-I../' '-Isubprojects/inih' '-I../subprojects/inih' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=c11' '-O0' '-g' '-fstack-protector' '-Wall' '-pedantic' '-Wstrict-prototypes' '-Wundef' '-fno-common' '-Werror-implicit-function-declaration' '-Wformat' '-Wformat-security' '-Werror=format-security' '-Wconversion' '-Wunused-variable' '-Wunreachable-code' '-W' '-pthread' '-MMD' '-MQ' 'daemon/gamemoded@exe/dbus_messaging.c.o' '-MF' 'daemon/gamemoded@exe/dbus_messaging.c.o.d' -o 'daemon/gamemoded@exe/dbus_messaging.c.o' -c ../daemon/dbus_messaging.c
In file included from /usr/include/systemd/sd-bus.h:28:0,
                 from ../daemon/dbus_messaging.c:40:
/usr/include/systemd/sd-event.h:72:67: error: unknown type name ‘siginfo_t’
 typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
                                                                   ^
[2/20] Compiling c object 'lib/gamemode@sha/client_impl.c.o'
FAILED: lib/gamemode@sha/client_impl.c.o 
cc  '-Ilib/gamemode@sha' '-Ilib' '-I../lib' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=c11' '-O0' '-g' '-fstack-protector' '-Wall' '-pedantic' '-Wstrict-prototypes' '-Wundef' '-fno-common' '-Werror-implicit-function-declaration' '-Wformat' '-Wformat-security' '-Werror=format-security' '-Wconversion' '-Wunused-variable' '-Wunreachable-code' '-W' '-fPIC' '-MMD' '-MQ' 'lib/gamemode@sha/client_impl.c.o' '-MF' 'lib/gamemode@sha/client_impl.c.o.d' -o 'lib/gamemode@sha/client_impl.c.o' -c ../lib/client_impl.c
In file included from /usr/include/systemd/sd-bus.h:28:0,
                 from ../lib/client_impl.c:36:
/usr/include/systemd/sd-event.h:72:67: error: unknown type name ‘siginfo_t’
 typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
                                                                   ^
[13/20] Compiling c object 'daemon/gamemoded@exe/gamemode.c.o'
ninja: build stopped: subcommand failed.

Doesnt work under steam -- [EDIT] 32bit Lib was required.

I havent been able to get gamemode to work under steam.

I added the LD_Preload arguement to the games steam launch options, but when executed my CPU governor doesnt change to performance. Running steam from the command line I see that when it attempts to load up the library it gives a cannot access warning then ignores.

If I lauch the game directly from the games executable with the LD_preload arguement then gamemode appears to work perfectly normally.

Gamemode was installed manually on my machine and installed via the bootstrap.sh process. I tried via the AUR package but with that the gamemoded service never started and errored when manually attempting.

O/S: Manjaro 4.15 Kernel

Error on Ubuntu 16.04 when daemon try to access glob cpufreq folders

I try to start daemon and get message error " Broken glob implementation (No such file or directory)"

This message appears in file gamemode/daemon/governors-query.c lines 49 - 54, but in my case these folders don't exist.
I have installed cpufrequtils but the folder cpufreq is in another place, see:
image
There is beside cpu* folders instead inside cpu* folders.

Manually enabling gamemode via DBus message

This is a great project which replaces my custom sripts to enable performance tweaks. However I would like to toggle gamemode manually in situations where I am not playing games, but doing other resource intensive tasks, such as compiling programs.

Would it make sense to add a DBus messages to enable and disable gamemode?

Mint 18.3 Failed to start gamemoded.service: Unit dbus.socket not found

Running Mint 18.3 building from 1.0 with this patch applied, I was able to build and install, but it failed with:

Enable and run the daemon? [Yy] y
+ systemctl --user daemon-reload
+ systemctl --user enable gamemoded
Created symlink from /home/user/.config/systemd/user/default.target.wants/gamemoded.service to /etc/systemd/user/gamemoded.service.
+ systemctl --user start gamemoded
Failed to start gamemoded.service: Unit dbus.socket not found.

Odd, because I definitely have dbus installed. So I ran:

$ apt reinstall libdbus-1-3 
The following packages will be REINSTALLED:
  libdbus-1-3 libdbus-1-3:i386 
0 packages upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 2 not upgraded.
Need to get 333 kB of archives. After unpacking 0 B will be used.
Get: 1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libdbus-1-3 amd64 1.10.6-1ubuntu3.3 [161 kB]
Get: 2 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 libdbus-1-3 i386 1.10.6-1ubuntu3.3 [173 kB]
Fetched 333 kB in 0s (342 kB/s)           
(Reading database ... 473359 files and directories currently installed.)
Preparing to unpack .../libdbus-1-3_1.10.6-1ubuntu3.3_amd64.deb ...
Unpacking libdbus-1-3:amd64 (1.10.6-1ubuntu3.3) over (1.10.6-1ubuntu3.3) ...
Preparing to unpack .../libdbus-1-3_1.10.6-1ubuntu3.3_i386.deb ...
Unpacking libdbus-1-3:i386 (1.10.6-1ubuntu3.3) over (1.10.6-1ubuntu3.3) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Setting up libdbus-1-3:amd64 (1.10.6-1ubuntu3.3) ...
Setting up libdbus-1-3:i386 (1.10.6-1ubuntu3.3) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
                                         
$ systemctl --user start gamemoded
Failed to start gamemoded.service: Unit dbus.socket not found.

$ env | grep -e 'DBUS'
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-HJYJ3HCe34,guid=a4506e3b2e309bb15f6ce10c5ae0bf5a

$ systemctl | grep dbus
dbus.service                          loaded active running   D-Bus System Message Bus
dbus.socket                           loaded active running   D-Bus System Message Bus Socket

$ systemctl --user status gamemoded
● gamemoded.service - gamemoded
   Loaded: loaded (/etc/systemd/user/gamemoded.service; enabled; vendor preset: enabled)
   Active: inactive (dead)

$ systemctl --user start gamemoded
Failed to start gamemoded.service: Unit dbus.socket not found.

I've poked and prodded dbus and it seems to be loaded, running, and working fine. Notifications work as expected, service shows as loaded active running, etc. I can't figure it out.

Any ideas?

Enabling Systemd unit makes CPU stay in Performance mode

The title pretty much sums it up, normally my CPU is in powersave, but if I enable the systemd unit my PC is stuck in performance mode all the time I am unsure if this is the intended behavior. Also if I preload libgamemodeauto.so the governor stays in performance mode after I close the program (it keeps gamemoded -l running). Is there any way that I can make gamemode default to powersave, change to performance when I preload the library, then revert back to powersave after?

Also just realized if I load a game that preloads libgamemodeauto.so (which keeps gamemoded -l running) I can't open any other games that preloads libgamemodeauto.so unless I stop the service which results in the terminal hanging and gamemoded staying open, anyways sorry if this is the way it is suppose to function.

Allow setting CPU afinity

Is your feature request related to a problem? Please describe.
When running on Ryzen CPUs certain games benefit from setting the CPU affinity. One such example is Middle Earth - Shadow of Mordor ( GamingOnLinux.com article, Reddit post on my getting from 32 to 40 FPS min frame rate .

Describe the solution you'd like
Launching a game that is known to benefit from setting the CPU affinity on Ryzen platforms should automatically do so.

Describe alternatives you've considered
Manually editing the launch arguments is possible, but

  • it's tedious to do for every game
  • it's not easily discoverable - I don't necessarily know I should enable it for certain games
  • it's not "one size fits all" - different core counts require different arguments ( i.e. taskset 0-5 for R5 {1,2}600{,X}, taskset 0-7 for R7 {1,2}700{,X}, etc )

Additional context
No more context, but thanks for working on this and making it open source :-)

Ubuntu 16.04 build fails

Ubuntu 16.04.4 LTS, followed the instructions and got the following after running ./bootstrap.sh:

[Errno 2] No such file or directory: '/home/bob/Downloads/gamemode/build'

Created the build directory manually and tried again:

Native c compiler: cc (gcc 5.4.0-6ubuntu1)

Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".

FYI: meson version 0.29.0.

Ubuntu 18.04: Failed to connect to bus: No such file or directory

I get the error in the title when installing gamemode:

jamie@jamie-ncase:~$ wget https://github.com/FeralInteractive/gamemode/archive/1.0.tar.gz && tar -xvf 1.0.tar.gz
--2018-05-09 19:51:55--  https://github.com/FeralInteractive/gamemode/archive/1.0.tar.gz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/FeralInteractive/gamemode/tar.gz/1.0 [following]
--2018-05-09 19:51:56--  https://codeload.github.com/FeralInteractive/gamemode/tar.gz/1.0
Resolving codeload.github.com (codeload.github.com)... 192.30.253.120, 192.30.253.121
Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21279 (21K) [application/x-gzip]
Saving to: ‘1.0.tar.gz’

1.0.tar.gz          100%[===================>]  20.78K  --.-KB/s    in 0.1s    

2018-05-09 19:51:56 (208 KB/s) - ‘1.0.tar.gz’ saved [21279/21279]

gamemode-1.0/
gamemode-1.0/.clang-format
gamemode-1.0/.gitignore
gamemode-1.0/CHANGELOG
gamemode-1.0/LICENSE.txt
gamemode-1.0/README.md
gamemode-1.0/bootstrap.sh
gamemode-1.0/daemon/
gamemode-1.0/daemon/cpugovctl.c
gamemode-1.0/daemon/daemon_config.c
gamemode-1.0/daemon/daemon_config.h
gamemode-1.0/daemon/daemonize.c
gamemode-1.0/daemon/daemonize.h
gamemode-1.0/daemon/dbus_messaging.c
gamemode-1.0/daemon/dbus_messaging.h
gamemode-1.0/daemon/gamemode.c
gamemode-1.0/daemon/gamemode.h
gamemode-1.0/daemon/governors-query.c
gamemode-1.0/daemon/governors-query.h
gamemode-1.0/daemon/governors.c
gamemode-1.0/daemon/governors.h
gamemode-1.0/daemon/logging.c
gamemode-1.0/daemon/logging.h
gamemode-1.0/daemon/main.c
gamemode-1.0/daemon/meson.build
gamemode-1.0/data/
gamemode-1.0/data/com.feralinteractive.GameMode.policy.in
gamemode-1.0/data/com.feralinteractive.GameMode.service.in
gamemode-1.0/data/gamemoded.1
gamemode-1.0/data/gamemoded.service.in
gamemode-1.0/data/meson.build
gamemode-1.0/example/
gamemode-1.0/example/archlinux/
gamemode-1.0/example/archlinux/gamemode-git/
gamemode-1.0/example/archlinux/gamemode-git/PKGBUILD
gamemode-1.0/example/archlinux/readme.txt
gamemode-1.0/example/gamemode.ini
gamemode-1.0/example/main.c
gamemode-1.0/example/meson.build
gamemode-1.0/lib/
gamemode-1.0/lib/client_impl.c
gamemode-1.0/lib/client_loader.c
gamemode-1.0/lib/gamemode_client.h
gamemode-1.0/lib/meson.build
gamemode-1.0/meson.build
gamemode-1.0/meson_options.txt
gamemode-1.0/subprojects/
gamemode-1.0/subprojects/inih.wrap
jamie@jamie-ncase:~$ cd gamemode-1.0
jamie@jamie-ncase:~/gamemode-1.0$ sudo ./bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.45.1
Source dir: /home/jamie/gamemode-1.0
Build dir: /home/jamie/gamemode-1.0/build
Build type: native build
Project name: gamemode
Native C compiler: cc (gcc 7.3.0 "cc (Ubuntu 7.3.0-16ubuntu3) 7.3.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Native dependency libsystemd found: YES 237
Dependency threads found: YES
Library dl found: YES
Configuring config.h using configuration
Cloning into 'inih'...
remote: Counting objects: 341, done.
remote: Total 341 (delta 0), reused 0 (delta 0), pack-reused 341
Receiving objects: 100% (341/341), 64.08 KiB | 585.00 KiB/s, done.
Resolving deltas: 100% (203/203), done.

Executing subproject inih.

Project name: inih
Native C compiler: cc (gcc 7.3.0 "cc (Ubuntu 7.3.0-16ubuntu3) 7.3.0")
Build targets in project: 3

Subproject inih finished.
Configuring gamemoded.service using configuration
Configuring com.feralinteractive.GameMode.policy using configuration
Message: 


    Build configuration:
    ====================

    prefix:                                 /usr
    bindir:                                 /usr/bin
    datadir:                                /usr/share
    libdir:                                 /usr/lib/x86_64-linux-gnu
    libexecdir:                             /usr/libexec
    includedir:                             /usr/include
    systemd user unit directory:            /etc/systemd/user
    PolKit Action Directory:                /usr/share/polkit-1/actions

    Options:
    ========

    daemon:                                 true
    examples:                               true
    systemd:                                true


Build targets in project: 7
Found ninja-1.8.2 at /usr/bin/ninja
+ cd build
+ ninja
[20/20] Linking target daemon/gamemoded.
+ set +x
Install to /usr? [Yy] y
+ sudo ninja install
[0/1] Installing files.
Installing lib/libgamemode.so to /usr/lib/x86_64-linux-gnu/libgamemode.so
Installing lib/libgamemodeauto.so to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so
Installing daemon/gamemoded to /usr/bin/gamemoded
Installing daemon/cpugovctl to /usr/libexec/cpugovctl
Installing gamemode_client.h to /usr/include/
Installing /home/jamie/gamemode-1.0/data/gamemoded.1 to /usr/share/man/man1
Installing /home/jamie/gamemode-1.0/build/data/gamemoded.service to /etc/systemd/user
Installing /home/jamie/gamemode-1.0/build/data/com.feralinteractive.GameMode.policy to /usr/share/polkit-1/actions
+ set +x
Enable and run the daemon? [Yy] y
+ systemctl --user daemon-reload
Failed to connect to bus: No such file or directory

Permission denied on sytemctl

I installed arch package from AUR
using
makepkg -si
the installation went fine without error
but when i try to enable/start the service using systemctl --user
it says

Job for gamemoded.service failed because the control process exited with error code.
See "systemctl --user status gamemoded.service" and "journalctl --user -xe" for details.

i check the status it says

Apr 15 17:48:15 A3-laptop systemd[493]: Starting gamemoded...
Apr 15 17:48:15 A3-laptop systemd[2890]: gamemoded.service: Failed to execute command: Permission denied
Apr 15 17:48:15 A3-laptop systemd[2890]: gamemoded.service: Failed at step EXEC spawning /usr/bin/gamemoded: Permission denied
Apr 15 17:48:15 A3-laptop systemd[493]: gamemoded.service: Main process exited, code=exited, status=203/EXEC
Apr 15 17:48:15 A3-laptop systemd[493]: gamemoded.service: Failed with result 'exit-code'.
Apr 15 17:48:15 A3-laptop systemd[493]: Failed to start gamemoded.

is the AUR package maintained here as well ?
or should i ask the in AUR comment section instead.

thankyou.

what is it? Rosa linux

Warning: You are using 'ANSI_X3.4-1968' which is not a Unicode-compatible locale.
You might see errors if you use UTF-8 strings as filenames, as strings, or as file contents.
Please switch to a UTF-8 locale for your platform.

CPU governor does not switch back to powersave

I am on Ubuntu 18.04. In a terminal, I execute that command:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
powersave
powersave
...

Then I start Rise of the Tomb Raider. The window opens and I click on the Quit button at the bottom left.
Then I check the governor again in a terminal:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
...

I would expect gamemode to restore the CPU governor to powersave, as it was before starting Rise of the Tomb Raider.

Here is the output of systemctl --user status gamemoded.service

hadrien@c18:~/code-tiers/gamemode$ systemctl --user status gamemoded.service 
● gamemoded.service - gamemoded
   Loaded: loaded (/etc/systemd/user/gamemoded.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-05-12 15:27:52 CEST; 10min ago
 Main PID: 17612 (gamemoded)
   Status: "GameMode is currently deactivated."
   CGroup: /user.slice/user-1000.slice/[email protected]/gamemoded.service
           └─17612 /usr/bin/gamemoded -l

mai 12 15:38:14 c18 /usr/bin/gamemoded[17612]: Entering Game Mode...
mai 12 15:38:14 c18 /usr/bin/gamemoded[17612]: Requesting update of governor policy to performance
mai 12 15:38:14 c18 pkexec[18378]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
mai 12 15:38:14 c18 gamemoded[17612]: Setting governors to performance
mai 12 15:38:25 c18 /usr/bin/gamemoded[17612]: Removing expired game [18363]...
mai 12 15:38:25 c18 /usr/bin/gamemoded[17612]: Removing game: 18363 [/opt/steam_games/steamapps/common/Rise of the 
mai 12 15:38:25 c18 /usr/bin/gamemoded[17612]: Leaving Game Mode...
mai 12 15:38:25 c18 /usr/bin/gamemoded[17612]: Requesting update of governor policy to performance
mai 12 15:38:25 c18 pkexec[18454]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
mai 12 15:38:25 c18 gamemoded[17612]: Setting governors to performance

X support

I think gamemode needs some X awareness before we can implement nice features such as:

  1. DVC toggling (or equivalent for Intel/AMD - "saturation" knobs)
  2. GPU overclocking (X required for nvidia)
  3. Implicit game state tracking (for stuff like disabing game-mode out of focus)
    • Daemon should have awareness of X client (WM_CLASS)
    • It needs listen to X Event loop

When I first seen this, I was kinda excited, hoping that sexy Feral Launcher stuff (display selection) would make it into daemon, but this isn't the case (at least not at the moment).

I could probably fork this and write some PoC nvidia implementation of these over the weekend, but I think I would have to touch whole bunch of core code to make this happen and it would likely get rejected (I don't think including nvidia-settings as gitsubmodule would be a problem, but I haven't looked into licensing issue yet).

Job for gamemoded.service failed because the control process exited with error code.

Ubuntu 16.04.4 LTS
AMD FX-6300
NVIDIA GeForce GTX 650 Ti

Cloned from latest master branch.

All dependencies are installed (including dbus-user-session).

alex@alex-MS-1674[±|master ✓]:~/Code/gamemode $ ./bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
Directory already configured, exiting Meson. Just run your build command
(e.g. ninja) and Meson will regenerate as necessary. If ninja fails, run ninja
reconfigure to force Meson to regenerate.

If build failures persist, manually wipe your build directory to clear any
stored system data.

To change option values, run meson configure instead.
+ cd build
+ ninja
ninja: no work to do.
+ set +x
Install to /usr? [Yy] y
+ sudo ninja install
[sudo] password for alex:         
[0/1] Installing files.
Installing lib/libgamemode.so to /usr/lib/x86_64-linux-gnu/libgamemode.so
Installing lib/libgamemodeauto.so to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so
Installing daemon/gamemoded to /usr/bin/gamemoded
Installing daemon/cpugovctl to /usr/libexec/cpugovctl
Installing gamemode_client.h to /usr/include/
Installing /home/alex/Code/gamemode/data/gamemoded.1 to /usr/share/man/man1
Installing /home/alex/Code/gamemode/build/data/gamemoded.service to /etc/systemd/user
Installing /home/alex/Code/gamemode/build/data/com.feralinteractive.GameMode.policy to /usr/share/polkit-1/actions
+ set +x
Enable and run the daemon? [Yy] y
+ systemctl --user daemon-reload
+ systemctl --user enable gamemoded
+ systemctl --user start gamemoded
Job for gamemoded.service failed because the control process exited with error code. See "systemctl --user status gamemoded.service" and "journalctl -xe" for details.
alex@alex-MS-1674[±|master ✓]:~/Code/gamemode $ systemctl --user status gamemoded.service
● gamemoded.service - gamemoded
   Loaded: loaded (/etc/systemd/user/gamemoded.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-04-29 20:33:13 CDT; 10min ago
  Process: 12523 ExecStart=/usr/bin/gamemoded -l (code=exited, status=1/FAILURE)
 Main PID: 12523 (code=exited, status=1/FAILURE)

Apr 29 20:33:13 alex-MS-1674 systemd[2644]: Starting gamemoded...
Apr 29 20:33:13 alex-MS-1674 /usr/bin/gamemoded[12523]: Note: No config file found [gamemode.ini] in working directory or in [/usr/share/gamemode/]
Apr 29 20:33:13 alex-MS-1674 systemd[2644]: gamemoded.service: Main process exited, code=exited, status=1/FAILURE
Apr 29 20:33:13 alex-MS-1674 systemd[2644]: Failed to start gamemoded.
Apr 29 20:33:13 alex-MS-1674 systemd[2644]: gamemoded.service: Unit entered failed state.
Apr 29 20:33:13 alex-MS-1674 systemd[2644]: gamemoded.service: Failed with result 'exit-code'.

No join_paths function on Xubuntu (Meson < 0.36.0)

gustavo@gustavo-Lenovo-G400s:~/gamemode$ ./bootstrap.sh

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    Error during basic setup:

[Errno 2] No such file or directory: '/home/gustavo/gamemode/build'

So, I created the "build" folder and then

gustavo@gustavo-Lenovo-G400s:~/gamemode$ ./bootstrap.sh

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    The Meson build system
    Version: 0.29.0
    Source dir: /home/gustavo/gamemode
    Build dir: /home/gustavo/gamemode/build
    Build type: native build
    Build machine cpu family: x86_64
    Build machine cpu: x86_64
    Project name: gamemode
    Native c compiler: cc (gcc 5.4.0-6ubuntu1)

Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".

Any tips?

Build with with-systemd=false fails

Hello,

I've found that building with with-systemd build flag disabled fails, as it still declares dependency on libsystemd library:

$ meson --prefix=/usr build -Dwith-systemd=false
The Meson build system
Version: 0.45.1
Source dir: /tmp/gamemode/src/gamemode-1.0
Build dir: /tmp/gamemode/src/gamemode-1.0/build
Build type: native build
Project name: gamemode
Native C compiler: cc (gcc 7.3.1 "cc (GCC) 7.3.1 20180312")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.2)

meson.build:39:0: ERROR: Native dependency 'libsystemd' not found

Easier installation in Ubuntu

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I would love to see a way to get this going easier in Ubuntu.

Describe the solution you'd like
A clear and concise description of what you want to happen.

PPA repository, .deb package, snap, flatpak, AppImage, anything would do.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Compiling... not fun.

Additional context
Add any other context or screenshots about the feature request here.

How to compile for 32 bit in 64 bit?

Hey,

I am looking forward to compile the library for 32 bit mod in 64 bit system in order to use it with some old demanding games. Is there any make CC="gcc -m32" equivalent for the code? Thank you!

Regards.

Failed to build on Linux mint 18.3

  • meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
    The Meson build system
    Version: 0.40.1
    Source dir: /home/john/gamemode
    Build dir: /home/john/gamemode/build
    Build type: native build
    Project name: gamemode
    Native c compiler: cc (gcc 5.4.0)
    Build machine cpu family: x86_64
    Build machine cpu: x86_64
    Found pkg-config: /usr/bin/pkg-config (0.29.1)
    Native dependency libsystemd found: YES 229
    Dependency threads found: YES
    Library dl found: YES
    Configuring config.h using configuration
    error: could not lock config file .git/config: Permission denied
    Failed to register url for submodule path 'inih'

Meson encountered an error in file meson.build, line 86, column 4:
Subproject directory 'subprojects/inih' does not exist and cannot be downloaded:
No inih.wrap found for 'subprojects/inih'

Not sure if this is the same issue as the others related to mint.

Service file in wrong place for debian

The .service file was placed in /etc/systemd/user but for debian (buster, testing) it must be placed in /lib/systemd/user. Maybe this is also what makes installation on SteamOS fail (#17) as afaik it is based on debian.

Allow scripts to receive data about game being started/stopped

Is your feature request related to a problem? Please describe.
Scripting currently allows running scripts when starting and stopping a client, but they have no idea who that client is. If they knew, they would be able to make more informed decisions on a per-game basis.

One example is setting the CPU affinity ( see #55 ) based on a whitelist of games.

Describe the solution you'd like
There are multiple possible solutions, I guess one would be setting environment variables such as GAMEMODE_EXEC_NAME and GAMEMODE_EXEC_ID before running the script. Another would be setting CLI arguments, but I guess that gets messy once the user also sets CLI arguments as there is no way of knowing the position of the gamemode-provided arguments.

Describe alternatives you've considered
An obvious alternative is to spawn a shell script and keep polling for known games, but that's less convenient than having the handling in gamemode.

Additional context

MIssing inih.wrap from 1.1 release

The 1.1 release tar.gz is missing subprojects/inih.wrap file I believe. I get the following error when running "meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user"

When doing the following it works:

git clone https://github.com/FeralInteractive/gamemode.git
cd gamemode
git checkout 1.1

The Meson build system
Version: 0.46.0
Source dir: /home/erik/temp/dfd/gamemode-1.1
Build dir: /home/erik/temp/dfd/gamemode-1.1/build
Build type: native build
Project name: gamemode
Native C compiler: cc (gcc 8.1.0 "gcc (Gentoo 8.1.0-r2 p1.2) 8.1.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Native dependency libsystemd found: YES 238
Dependency threads found: YES
Library dl found: YES
Configuring config.h using configuration

Dependency inih not found but it is available in a sub-subproject.
To use it in the current project, promote it by going in the project source
root and issuing the following command.

meson wrap promote subprojects/inih

meson.build:86:4: ERROR: Subproject directory 'subprojects/inih' does not exist and cannot be downloaded:
No inih.wrap found for 'subprojects/inih'

A full log can be found at /home/erik/temp/dfd/gamemode-1.1/build/meson-logs/meson-log.txt

Feature: disable Redshift

Redshift:

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

It would be nice if gamemode could disable Redshift while active.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.