27 Commits

Author SHA1 Message Date
Henrik Holst
4997adef8d build gamemode-cpu
Added build info for gamemade-cpu.c to meson
2023-12-04 14:18:38 +00:00
Stephan Lachnit
d8337aeb05 various variable naming improvements
This makes it more clear that libgamemode and libgamemodeauto are indeed libraries. Also, the misleading name `libgamemode_dep` has been renamed to `gamemode_dep`, which now also includes the dependency on libdl. The misleading `libgamemode_includes` variable name has also been changed.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-06-23 09:18:14 +01:00
Stephan Lachnit
ce6485ef97 combine no-daemon, elogind and systemd option
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-05-19 16:27:51 +01:00
Stephan Lachnit
953792b4a5 Add option to use elogind
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-05-19 16:27:51 +01:00
Stephan Lachnit
c36019a9aa travis: run gamemoded -v as meson test
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-05-12 19:25:57 +01:00
Christian Kellner
35fb7f5baf meson: include dir in daemon_common dependency
Specify the include directory in the link_daemon_common dependency
and thus everything that includes that as a dependency will get
the proper include directory automatically.
2019-10-18 13:19:30 +02:00
Marc Di Luzio
1b78d0dcf7 Restructure files and libraries
Rename a bunch of files to make the consistent
	Create two new subdirectories for common code, and utilities
2019-06-01 10:54:22 +01:00
Marc Di Luzio
81e38d02e6 Move daemonise code to main file, simplifying files 2019-06-01 10:54:22 +01:00
Christian Kellner
0c778200ae helpers: add helpers to automatically close fds
Add a inline helper function and a helper macro to be able to
automatically close file descriptors. Does nothing if the argument
is NULL or the pointed to integer is < 0.
2019-05-02 11:29:03 +02:00
Marc Di Luzio
873d0a224b Remove passing the vendor to gpuclockctl 2019-03-10 15:19:34 +00:00
Marc Di Luzio
f5e7fa3222 Set up overclocking calls on NVidia
These require the coolbits plugin to be activated on nvidia-xsettings
2019-02-12 08:55:23 +00:00
Marc Di Luzio
53428356a5 Move control code back into the helper 2019-02-12 08:55:23 +00:00
Marc Di Luzio
01dbe4e2b0 Rename gpu-query to gpu-control to better describe it's functions 2019-02-12 08:55:23 +00:00
Marc Di Luzio
a395caeb48 Refactor the governor request into an external process helper function 2019-02-12 08:55:23 +00:00
Marc Di Luzio
8d4e9ac54e Add gpuclockctl to allow privilaged control of GPU parameters 2019-02-12 08:55:23 +00:00
Marc Di Luzio
aeaef7377d Preliminary (empty) implementation of GPU optimisations 2019-02-12 08:55:23 +00:00
Marc Di Luzio
94cfa2de54 Add game_mode_run_tests function to trigger tests 2019-01-28 16:36:08 +00:00
Kai Krakow
f4cd01f989 refactor: Break wine API functions out of the main daemon source
Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-10-09 00:33:46 +02:00
Kai Krakow
403ce122f6 refactor: Break ioprio API functions out of the main daemon source
Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-10-09 00:33:46 +02:00
Kai Krakow
edf9257de4 refactor: Break sched API functions out of the main daemon source
Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-10-09 00:33:46 +02:00
Kai Krakow
92967b135b refactor: Break env API functions out of the main daemon source
Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-10-09 00:33:46 +02:00
Kai Krakow
748808be7e refactor: Break proc API functions out of the main daemon source
Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-10-09 00:33:46 +02:00
Marc Di Luzio
9359a8551c Build fix for meson 0.40.1 as seen in issue #32 2018-04-27 08:58:55 +01:00
Marc Di Luzio
966c207a33 Teach gamemoded the '-r' option
This allows for easy requesting of gamemode and pausing for any signal

	Primarily useful for simple tests, but also functionally to allow enterning and exiting gamemode manually
2018-04-25 14:46:20 +01:00
Marc Di Luzio
759cbc3c40 Add config file parsing
Checks for a gamemode.ini in /usr/share/gamemode/ (or in the cwd for debugging)

	Currently allows for blacklisting and whitelisting clients based on rudimentary needle-haystack executable name checks

	See the example/gamemode.ini file for expected syntax

	Using the BSD licensed inih library (with additional meson.build file)
2018-03-23 16:59:15 +00:00
Ikey Doherty
68e326de60 Transform into a full D-BUS service with Polkit support
Primarily we convert the service into a thread safe one that isn't reliant
on signaling for control flow, eliminating data race conditions. We also
enable interleaving by separating game mode pivoting from explicit client
registration.

The static pid list is now converted into a dynamic list that is OOM safe
to store all registered clients (with a reasonable upper limit of 256 clients)
to better handle cases where LD_PRELOAD is used for a large process group.
Additionally we begin storing some metadata on the connected clients such
as their executable path, which will enable us to perform some basic
whitelisting in future.

The cpugovctl binary is now moved into the libexecdir as an explicit helper
of the D-BUS service, using the shared library to merge some code back into
the daemon. This saves having to execute a process to query the state of the
governors, as we don't need a privileged client to do this.

In order to sanely set the governors, we require that the binary is running
as euid 0, and execute this using `pkexec`. A PolKit policy definition is
provided which allows active/logged in users to execute this helper through
a path whitelist. As such we can convert the daemon into user-mode only, with
the privileged helper being dispatched exclusively via polkit. This removes
the need for a setuid helper or having a system mode daemon.

Lastly we clean up the codebase a bit to be consistent with modern C code
conventions, using pragmas where available. The library component still uses
the older ifdef approach to support older compilers, but the daemon portion
uses the directive to simplify intent and speed up compilation. Additionally
we move all comments to C style comments for consistency, instead of mixing
in C++ style single line comments, in order to establish a formal coding
style.

The net result is a more robust service which can be D-BUS activated when
clients need it, that can perform scaling automatically without harassing
the user with authentication popups.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2018-03-05 17:32:25 +00:00
Ikey Doherty
1328e07f86 Split meson up to be more modular
This also explicitly constructs reusable library components to make it
easier to extend the project over time. Notably we make less assumptions
about the host system and use pkgconfig where appropriate to give us
system details, such as the systemd system unit directory for packaging.
This can be overriden with the meson option.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2018-03-05 17:32:01 +00:00