Commit graph

189 commits

Author SHA1 Message Date
Bastien Nocera
42b3341b29 main: Follow pylint recommendation and use "with"
src/powerprofilesctl:185:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

Closes: #35
2021-08-05 15:58:24 +02:00
Bastien Nocera
417c830355 README: Mention degraded mode for testing 2021-08-05 15:11:40 +02:00
Bastien Nocera
c7b05fa240 README: Simplify testing section by using powerprofilesctl 2021-08-05 15:11:36 +02:00
Bastien Nocera
6dab356723 README: Remove extra backticks
We already surrounded the command with triple-backticks.
2021-08-05 15:06:52 +02:00
Bastien Nocera
eee63cba70 README: Simplify debug commands
Use -r and -v so we don't have to stop existing instances manually.
2021-07-27 13:07:12 +02:00
Bastien Nocera
20a2d7f7b8 tests: Add tests for quiet profile support 2021-07-24 23:03:25 +02:00
Bastien Nocera
c9b646025d platform-profile: Add support for 'quiet' profile 2021-07-24 23:03:25 +02:00
Bastien Nocera
30d85f1e9e 0.9.0 2021-07-20 15:26:16 +02:00
Bastien Nocera
58cc0ef02b main: Implement profile persistence
Save the current user-selected profile in
/var/lib/power-profiles-daemon/state.ini

Closes: #23
2021-07-19 20:21:29 +02:00
Bastien Nocera
2a87e4be3c tests: Add another platform_profile helper 2021-07-19 20:21:29 +02:00
Bastien Nocera
12a6d18d99 main: Remove restoring profile from kernel
Remove restoring the problem from the on-disk kernel file, as was done
for the platform_profile, as we want to implement actual persistence
across reboots.

We need to be the ones saving that data, as the kernel doesn't know
whether the profile changes are temporary, or permanent, and whether the
user was the one initiating that change.
2021-07-19 20:21:29 +02:00
Bastien Nocera
bca6f4da50 main: Document that the Profiles property is sorted
It was always the case, as visible in the first, 0.1, release:
dfeeebc929/src/power-profiles-daemon.c (L109-134)
2021-07-19 20:13:48 +02:00
James
23157c2aa4 tests: Fix running test under Python 3.6
See https://docs.python.org/3/library/subprocess.html#subprocess.run :
Changed in version 3.7: [...] Added the capture_output parameter.

Closes: #33
2021-07-16 17:35:58 +02:00
Bastien Nocera
8944e16894 tests: Add test for launch command in cli tool 2021-07-16 12:39:27 +02:00
Bastien Nocera
64711bcf7b main: Add list-holds and launch commands 2021-07-16 12:39:27 +02:00
David Redondo
0d293373ed tests: Add test for Hold/ReleaseProfile
Tests holding and relasing of profiles and priority of holds of
different profiles.
2021-07-16 12:39:27 +02:00
David Redondo
58da7f5307 main: Implement Hold/ReleaseProfile
Make it possible for programmes to temporarily change the current
power profile, and "hold" that profile while they're performing a
task or waiting for an event to clear. This would be useful for:
- programmes with a finite workload to finish faster by investing more
  energy resources (eg. compiling software or transcoding media)
- programmes with near constantly high workloads to avoid the costs of
  transitioning between hardware profiles and causing stutters such
  as games or 3D modelling programmes
- OS components to force power-saver mode while battery energy is
  at a premium

Closes: #11

Co-Authored-By: Bastien Nocera <hadess@hadess.net>
2021-07-16 12:39:27 +02:00
Bastien Nocera
08f39e151e main: Remove unused inhibition switch reason 2021-07-05 11:04:33 +02:00
Bastien Nocera
99740ead2d main: Obsolete "Inhibited" property and add Degraded
The PerformanceInhibited property was there to convey that the
performance profile was unavailable, and that the daemon should switch
to a lower profile to avoid using the performance profile.

But it was difficult to communicate whether the daemon should switch
back to the performance profile when the inhibition disappeared, or
whether it should keep the same profile (the latter was what was
implemented).

There was also the problem that depending on the backend, the
performance profile might be able to provide a behaviour that wouldn't
match either of the unhampered performance profile, or the balanced
profile, but somewhere in between.

The PerformanceInhibited property is kept for compatibility reasons with
the existing consumer, GNOME 40. It will be removed in the future and
should not be relied on.

Closes: #24
2021-07-05 11:03:48 +02:00
Bastien Nocera
9ff59f0d1e placeholder: Ignore placeholder driver in the docs
Fixes a gtk-doc warning.
2021-07-05 10:59:56 +02:00
Bastien Nocera
73cbda3756 main: Fix PpdProfileActivationReason API docs
power-profiles-daemon/src/ppd-driver.h:37: warning: Value descriptions for PpdProfileActivationReason are missing in source code comment block.
2021-07-05 10:57:13 +02:00
Luca Stefani
ff0d147b76 platform-profile: Add debug on choices_path error case 2021-04-15 14:59:10 +02:00
Luca Stefani
3b0f72989b platform-profile: Fix crash if kernel built w/o platform_profile
If the kernel is built with platform_profile support,
g_file_get_contents() will fail, and we'll likely crash trying to
access ->message in the struct.

Don't forget to pass the error to g_file_get_contents().
2021-04-15 14:57:19 +02:00
Luca Stefani
24755fec0a build: Start using common_cflags
- Remove -Wall it's implied by warning_level=1
- Remove -std as it's implied by c_std
- Remove -fvisibility=hidden, we aren't a library
2021-04-15 13:20:56 +02:00
Bastien Nocera
bc05738c1d fake: Fix toggling inhibition after driver restart 2021-04-02 14:21:55 +02:00
Bastien Nocera
c483794592 0.8.1 2021-04-01 10:31:54 +02:00
Bastien Nocera
cea4e1a249 build: Add check-news.sh script 2021-04-01 10:30:39 +02:00
Bastien Nocera
915320e3cf intel-pstate: Disable on-battery behaviour
Because of the way gnome-shell's animation framework is built, setting
energy_performance_preference to balance_power has a visible impact
on the smoothness of animations, as the CPU will clock down too quickly
between frames, leading to the appearance of a performance regression.

Disable the on-battery behaviour until gnome-shell is fixed to avoid
being accused of slowing systems down.

See https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/28#note_862766
2021-04-01 10:14:18 +02:00
Bastien Nocera
510951ab6c 0.8 2021-03-22 11:45:05 +01:00
Bastien Nocera
d00d02c951 ci: Export dist'ed tarballs too 2021-03-22 11:45:05 +01:00
Bastien Nocera
1883a773a1 fake: Print debug when fake driver profile is activated 2021-03-19 17:31:14 +01:00
Bastien Nocera
c318eacbb0 main: Move activation reason helper to PpdDriver 2021-03-19 17:31:14 +01:00
Bastien Nocera
a53fa663c9 ci: Don't install unused build dependencies 2021-03-19 17:26:42 +01:00
Bastien Nocera
62a8116989 main: Pass reason for profile change
When activating a new profile.
2021-03-19 14:22:16 +01:00
Bastien Nocera
334e64ea64 main: Add PpdProfileActivationReason enum 2021-03-19 14:22:16 +01:00
Bastien Nocera
2fbf57b9bd tests: Simplify reading platform_profile value
Which allows us to ignore trailing spaces in the sysfs attribute, as
power-profiles-daemon writes those mock files without a linefeed, but
the real kernel (or some of our setup functions) would always append
a linefeed.
2021-03-19 13:18:43 +01:00
Bastien Nocera
d650d2e6b9 tests: Add helper which strips trailing newlines from sysfs attributes
This will come in handy.
2021-03-19 13:18:43 +01:00
Bastien Nocera
4fc05c84d6 main: Don't throw an error if we select the same profile twice
Just say it worked if we've already selected this profile.
2021-03-19 13:03:16 +01:00
Bastien Nocera
f35453ad2d placeholder: More indentation
Every couple of days, indentation gets broken, and we fix it, like a
rake evening out the stones in our meditation garden.
2021-03-19 13:03:16 +01:00
Bastien Nocera
67be161793 main: Remove early setting of active_profile
The active profile setting might fail, and we already set it in the
function we call 2 lines below. This avoids the debug function in
activate_target_profile() saying the profile we activate is already the
current one.
2021-03-19 13:03:16 +01:00
Bastien Nocera
c7fb31632b main: Use a single driver for all the profiles
Of all the drivers that we've implemented, not a single one needed to
have different drivers to handle its different profiles, so simplify
things by having all the profiles be handled by a unique driver.

We still have separate drivers for separate types of hardware.
2021-03-19 11:06:37 +01:00
Martin Pitt
225d6e51d5 tests: Close leaked "unclosed file"
Fixes warning:
/usr/lib64/python3.9/unittest/case.py:550: ResourceWarning: unclosed file <_io.BufferedReader name=10>
  method()

See https://github.com/martinpitt/python-dbusmock/issues/67#issuecomment-800979091
2021-03-17 14:10:18 +01:00
Bastien Nocera
4c86f30cda tests: Add HP WMI test 2021-03-17 13:25:30 +01:00
Bastien Nocera
2095f03c8c platform-profile: Handle "cool" platform_profile
Handle "cool" platform_profile the same way we do "low-power". This
fixes the platform_profile driver not being probed successfully with the
new HP WMI driver.

See https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=4296f679ca50f97c4973715f1e9e72357d2eb251

Closes: #20
2021-03-17 13:25:30 +01:00
Bastien Nocera
d3b84091a8 platform-profile: Save the available profile choices
Save the available profile choices so that we can make sure to only try
to set ones that are available.
2021-03-17 13:21:49 +01:00
Bastien Nocera
a12820ab4f platform-profile: Restore existing profile on start 2021-03-16 17:11:37 +01:00
Bastien Nocera
d99a0f774a platform-profile: Split off reading active platform_profile
To make it easier to re-use.
2021-03-16 17:08:33 +01:00
Bastien Nocera
57ee7a9e50 main: Restore profile from kernel configuration
When possible, try to restore the previous profile from the kernel
configuration. This makes it easier to force a profile in a startup
script, or pick up in the same configuration if power-profiles-daemon
was restarted for some reason.

Note that this does not save the active profile across reboots (a
systemd unit could be used for that if necessary), and that it will
likely apply the wrong profile if the daemon crashed when an inhibition
or a profile hold were in place.

Closes: #5
2021-03-16 16:59:26 +01:00
Bastien Nocera
c06f53cadc tests: Add missing trailing linefeeds to platform_profile tests 2021-03-16 16:50:37 +01:00
Bastien Nocera
59c5bc1749 tests: Add missing trailing linefeeds to intel-pstate tests 2021-03-16 16:50:37 +01:00