From 9dfd71880789e38ae37c2c420723982e0bd1dd83 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Thu, 24 May 2018 22:31:57 +0200 Subject: [PATCH] config: Introduce new setting "softrealtime" This adds support for a new configuration option "softrealtime" to be read from the general section. This commit alone does nothing, the following commit adds actually making use of the value. Signed-off-by: Kai Krakow --- daemon/daemon_config.c | 12 ++++++++++++ daemon/daemon_config.h | 5 +++++ data/gamemoded.1 | 4 ++++ example/gamemode.ini | 4 ++++ 4 files changed, 25 insertions(+) diff --git a/daemon/daemon_config.c b/daemon/daemon_config.c index 9fdd4ca..1afa2b7 100644 --- a/daemon/daemon_config.c +++ b/daemon/daemon_config.c @@ -67,6 +67,8 @@ struct GameModeConfig { char defaultgov[CONFIG_VALUE_MAX]; char desiredgov[CONFIG_VALUE_MAX]; + char softrealtime[CONFIG_VALUE_MAX]; + long reaper_frequency; }; @@ -157,6 +159,8 @@ static int inih_handler(void *user, const char *section, const char *name, const valid = get_string_value(value, self->defaultgov); } else if (strcmp(name, "desiredgov") == 0) { valid = get_string_value(value, self->desiredgov); + } else if (strcmp(name, "softrealtime") == 0) { + valid = get_string_value(value, self->softrealtime); } } else if (strcmp(section, "custom") == 0) { /* Custom subsection */ @@ -401,3 +405,11 @@ void config_get_desired_governor(GameModeConfig *self, char governor[CONFIG_VALU { memcpy_locked_config(self, governor, self->desiredgov, sizeof(self->desiredgov)); } + +/* + * Get the chosen soft realtime behavior + */ +void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VALUE_MAX]) +{ + memcpy_locked_config(self, softrealtime, self->softrealtime, sizeof(self->softrealtime)); +} diff --git a/daemon/daemon_config.h b/daemon/daemon_config.h index 1be1940..59e90c9 100644 --- a/daemon/daemon_config.h +++ b/daemon/daemon_config.h @@ -103,3 +103,8 @@ void config_get_default_governor(GameModeConfig *self, char governor[CONFIG_VALU * Get the chosen desired governor */ void config_get_desired_governor(GameModeConfig *self, char governor[CONFIG_VALUE_MAX]); + +/* + * Get the chosen soft realtime behavior + */ +void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VALUE_MAX]); diff --git a/data/gamemoded.1 b/data/gamemoded.1 index 8c50b38..518a24e 100644 --- a/data/gamemoded.1 +++ b/data/gamemoded.1 @@ -102,6 +102,10 @@ desiredgov=performance ; The default governer is used when leaving GameMode instead of restoring the original value defaultgov=powersave +; By default, GameMode changes the scheduler policy to SCHED_ISO with 4 or more CPU cores, +; force enable or disable with "on" or "off" +softrealtime=auto + [filter] ; If "whitelist" entry has a value(s) ; gamemode will reject anything not in the whitelist diff --git a/example/gamemode.ini b/example/gamemode.ini index 9c04fb2..e4a95e1 100644 --- a/example/gamemode.ini +++ b/example/gamemode.ini @@ -7,6 +7,10 @@ desiredgov=performance ; The default governer is used when leaving GameMode instead of restoring the original value defaultgov=powersave +; By default, GameMode changes the scheduler policy to SCHED_ISO with 4 or more CPU cores, +; force enable or disable with "on" or "off" +softrealtime=auto + [filter] ; If "whitelist" entry has a value(s) ; gamemode will reject anything not in the whitelist