If a system does not support setting the platform profile (i.e., does
not have the file /sys/firmware/acpi/platform_profile), then everything
that interacts with it is skipped to prevent errors. This situation is
more common than I expected.[1]
[1] https://github.com/FeralInteractive/gamemode/issues/524
Attribute the contributions made by members of the community, but avoid
unweildy and inconsistent copyright notices at the top of each file.
Existing contributor copyright notices have been left as-is.
This change fixes the format check in GitHub actions ran by `clang-format`.
Dockerfile
```dockerfile
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN set -ex; \
apt-get update; \
apt-get install -y build-essential meson appstream clang clang-format clang-tools libdbus-1-dev libinih-dev libsystemd-dev git
RUN set -ex; \
yes | adduser ci-user
USER ci-user
```
Environment setup
```bash
sudo su -g docker $USER
docker build -t ci .
```
clang-format fix
```bash
docker run -e CI=true --rm -v "$PWD:$PWD" -w "$PWD" --init ci ./scripts/format-check.sh
```
Not all distributions install non-system binaries into /usr/bin. For
example, NixOS installs packages to /nix/store using a unique hash
generated from the inputs used to build it:
/nix/store/jld7jh3ilvbg91zvn1bdyawfc55b9jk8-polkit-0.118-bin/bin/pkexec
Add tests to check this feature
Apply config validation in config for simplicity
Note: if anything messes with the niceness (ie. it starts non-zero, or it's not the expected value during setup, we'll bail out)
If there is no null byte among the first n bytes of the source the
resulting string will not be properly null terminated.
Ensure that all strings that are copied via strncpy are properly
terminated copy "sizeof (dest) - 1" bytes and manually terminate
the string in the cases the array was not initialized.
Example compiler warning:
../daemon/gamemode-tests.c: In function ‘run_cpu_governor_tests’:
../daemon/gamemode-tests.c:326:4: warning: ‘strncpy’ specified bound
256 equals destination size [-Wstringop-truncation]
strncpy(defaultgov, currentgov, CONFIG_VALUE_MAX);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This also fixes the instances in testing where we don't have the nv overclock in use, but we do have the mode set
Solves issues explaining the what the perf_level actually meant, and future proofs for any PR that wants to set individual perf levels
This covers the MVP for now, and simply allows pinning the power level to "high"
Full overclocking set up is somewhat more complicated, and it'll be better to implement that at the same time as the same for Nvidia, where we're currently only really setting the top end power level