diff --git a/daemon/gamemode-context.c b/daemon/gamemode-context.c index feba2b1..21f4f63 100644 --- a/daemon/gamemode-context.c +++ b/daemon/gamemode-context.c @@ -85,6 +85,8 @@ struct GameModeContext { struct GameModeGPUInfo *stored_gpu; /**config, &self->stored_gpu); game_mode_initialise_gpu(self->config, &self->target_gpu); + /* Initialise the current CPU info */ + game_mode_initialise_cpu(self->config, &self->cpu); + pthread_rwlock_init(&self->rwlock, NULL); /* Get the reaper thread going */ @@ -188,6 +193,9 @@ void game_mode_context_destroy(GameModeContext *self) game_mode_free_gpu(&self->stored_gpu); game_mode_free_gpu(&self->target_gpu); + /* Destroy the cpu object */ + game_mode_free_cpu(&self->cpu); + /* Destroy the config object */ config_destroy(self->config); @@ -365,6 +373,8 @@ static void game_mode_context_enter(GameModeContext *self) game_mode_get_gpu(self->stored_gpu); game_mode_apply_gpu(self->target_gpu); + game_mode_park_cpu(self->cpu); + /* Run custom scripts last - ensures the above are applied first and these scripts can react to * them if needed */ char scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX]; @@ -388,6 +398,8 @@ static void game_mode_context_leave(GameModeContext *self) /* Remove GPU optimisations */ game_mode_apply_gpu(self->stored_gpu); + game_mode_unpark_cpu(self->cpu); + /* UnInhibit the screensaver */ if (config_get_inhibit_screensaver(self->config)) game_mode_inhibit_screensaver(false); @@ -522,6 +534,9 @@ static int game_mode_apply_client_optimisations(GameModeContext *self, pid_t cli /* Apply scheduler policies */ game_mode_apply_scheduling(self, client); + /* Apply core pinning */ + game_mode_apply_core_pinning(self->cpu, client); + return 0; }