From f9f261e82015eba9d107a4060439a53897a43dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Tue, 19 Sep 2017 23:03:41 +0200 Subject: [PATCH] plugin_video: Prefix DPM states with 'dpm-' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prefix DPM states with 'dpm-' to prevent future name collisions. Also, change the state in powersave profiles to 'battery' - there's no such DPM state as powersave. Signed-off-by: Ondřej Lysoněk --- profiles/balanced/tuned.conf | 2 +- profiles/desktop-powersave/tuned.conf | 2 +- profiles/powersave/tuned.conf | 2 +- tuned/plugins/plugin_video.py | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/profiles/balanced/tuned.conf b/profiles/balanced/tuned.conf index c4906cb..2f9983a 100644 --- a/profiles/balanced/tuned.conf +++ b/profiles/balanced/tuned.conf @@ -13,7 +13,7 @@ energy_perf_bias=normal timeout=10 [video] -radeon_powersave=balanced, auto +radeon_powersave=dpm-balanced, auto [disk] # Comma separated list of devices, all devices if commented out. diff --git a/profiles/desktop-powersave/tuned.conf b/profiles/desktop-powersave/tuned.conf index cbe854a..3c3044a 100644 --- a/profiles/desktop-powersave/tuned.conf +++ b/profiles/desktop-powersave/tuned.conf @@ -7,7 +7,7 @@ summary=Optmize for the desktop use-case with power saving include=server-powersave [video] -radeon_powersave=powersave, auto +radeon_powersave=dpm-battery, auto [net] # Comma separated list of devices, all devices if commented out. diff --git a/profiles/powersave/tuned.conf b/profiles/powersave/tuned.conf index e6d9a6d..2ae7a5b 100644 --- a/profiles/powersave/tuned.conf +++ b/profiles/powersave/tuned.conf @@ -17,7 +17,7 @@ energy_perf_bias=powersave timeout=10 [video] -radeon_powersave=powersave, auto +radeon_powersave=dpm-battery, auto [disk] # Comma separated list of devices, all devices if commented out. diff --git a/tuned/plugins/plugin_video.py b/tuned/plugins/plugin_video.py index a446e54..4d5f071 100644 --- a/tuned/plugins/plugin_video.py +++ b/tuned/plugins/plugin_video.py @@ -65,10 +65,11 @@ class VideoPlugin(base.Plugin): if (self._cmd.write_to_file(sys_files["method"], "dynpm")): return "dynpm" # new DPM profiles, recommended to use if supported - elif v in ["battery", "balanced", "performance"]: + elif v in ["dpm-battery", "dpm-balanced", "dpm-performance"]: if not sim: + state = v[len("dpm-"):] if (self._cmd.write_to_file(sys_files["method"], "dpm") and - self._cmd.write_to_file(sys_files["dpm_state"], v)): + self._cmd.write_to_file(sys_files["dpm_state"], state)): return v else: if not sim: @@ -85,6 +86,6 @@ class VideoPlugin(base.Plugin): elif method == "dynpm": return method elif method == "dpm": - return self._cmd.read_file(sys_files["dpm_state"]).strip() + return "dpm-" + self._cmd.read_file(sys_files["dpm_state"]).strip() else: return None