mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 23:57:22 +02:00
Convert "apply_gpu_optimisations" to a string with a special key
This commit is contained in:
parent
7bdbc1adc5
commit
6b268e8349
@ -76,7 +76,7 @@ struct GameModeConfig {
|
|||||||
|
|
||||||
long reaper_frequency;
|
long reaper_frequency;
|
||||||
|
|
||||||
long apply_gpu_optimisations;
|
char apply_gpu_optimisations[CONFIG_VALUE_MAX];
|
||||||
long gpu_vendor;
|
long gpu_vendor;
|
||||||
long gpu_device;
|
long gpu_device;
|
||||||
long nv_core_clock_mhz_offset;
|
long nv_core_clock_mhz_offset;
|
||||||
@ -204,7 +204,7 @@ static int inih_handler(void *user, const char *section, const char *name, const
|
|||||||
} else if (strcmp(section, "gpu") == 0) {
|
} else if (strcmp(section, "gpu") == 0) {
|
||||||
/* GPU subsection */
|
/* GPU subsection */
|
||||||
if (strcmp(name, "apply_gpu_optimisations") == 0) {
|
if (strcmp(name, "apply_gpu_optimisations") == 0) {
|
||||||
valid = get_long_value(name, value, &self->apply_gpu_optimisations);
|
valid = get_string_value(value, self->apply_gpu_optimisations);
|
||||||
} else if (strcmp(name, "gpu_vendor") == 0) {
|
} else if (strcmp(name, "gpu_vendor") == 0) {
|
||||||
valid = get_long_value_hex(name, value, &self->gpu_vendor);
|
valid = get_long_value_hex(name, value, &self->gpu_vendor);
|
||||||
} else if (strcmp(name, "gpu_device") == 0) {
|
} else if (strcmp(name, "gpu_device") == 0) {
|
||||||
@ -276,10 +276,10 @@ static void load_config_files(GameModeConfig *self)
|
|||||||
memset(self->defaultgov, 0, sizeof(self->defaultgov));
|
memset(self->defaultgov, 0, sizeof(self->defaultgov));
|
||||||
memset(self->desiredgov, 0, sizeof(self->desiredgov));
|
memset(self->desiredgov, 0, sizeof(self->desiredgov));
|
||||||
memset(self->softrealtime, 0, sizeof(self->softrealtime));
|
memset(self->softrealtime, 0, sizeof(self->softrealtime));
|
||||||
|
memset(self->apply_gpu_optimisations, 0, sizeof(self->apply_gpu_optimisations));
|
||||||
|
self->inhibit_screensaver = 1; /* Defaults to on */
|
||||||
self->renice = 4; /* default value of 4 */
|
self->renice = 4; /* default value of 4 */
|
||||||
self->reaper_frequency = DEFAULT_REAPER_FREQ;
|
self->reaper_frequency = DEFAULT_REAPER_FREQ;
|
||||||
self->inhibit_screensaver = 1; /* Defaults to on */
|
|
||||||
self->apply_gpu_optimisations = 0;
|
|
||||||
self->gpu_vendor = 0;
|
self->gpu_vendor = 0;
|
||||||
self->gpu_device = -1; /* 0 is a valid device ID so use -1 to indicate no value */
|
self->gpu_device = -1; /* 0 is a valid device ID so use -1 to indicate no value */
|
||||||
self->nv_core_clock_mhz_offset = 0;
|
self->nv_core_clock_mhz_offset = 0;
|
||||||
@ -517,9 +517,12 @@ void config_get_ioprio_value(GameModeConfig *self, int *value)
|
|||||||
/*
|
/*
|
||||||
* Get various config info for gpu optimisations
|
* Get various config info for gpu optimisations
|
||||||
*/
|
*/
|
||||||
void config_get_apply_gpu_optimisations(GameModeConfig *self, long *value)
|
void config_get_apply_gpu_optimisations(GameModeConfig *self, char value[CONFIG_VALUE_MAX])
|
||||||
{
|
{
|
||||||
memcpy_locked_config(self, value, &self->apply_gpu_optimisations, sizeof(long));
|
memcpy_locked_config(self,
|
||||||
|
value,
|
||||||
|
&self->apply_gpu_optimisations,
|
||||||
|
sizeof(self->apply_gpu_optimisations));
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_get_gpu_vendor(GameModeConfig *self, long *value)
|
void config_get_gpu_vendor(GameModeConfig *self, long *value)
|
||||||
|
@ -133,7 +133,7 @@ void config_get_ioprio_value(GameModeConfig *self, int *value);
|
|||||||
/*
|
/*
|
||||||
* Get various config info for gpu optimisations
|
* Get various config info for gpu optimisations
|
||||||
*/
|
*/
|
||||||
void config_get_apply_gpu_optimisations(GameModeConfig *self, long *value);
|
void config_get_apply_gpu_optimisations(GameModeConfig *self, char value[CONFIG_VALUE_MAX]);
|
||||||
void config_get_gpu_vendor(GameModeConfig *self, long *value);
|
void config_get_gpu_vendor(GameModeConfig *self, long *value);
|
||||||
void config_get_gpu_device(GameModeConfig *self, long *value);
|
void config_get_gpu_device(GameModeConfig *self, long *value);
|
||||||
void config_get_nv_core_clock_mhz_offset(GameModeConfig *self, long *value);
|
void config_get_nv_core_clock_mhz_offset(GameModeConfig *self, long *value);
|
||||||
|
@ -58,10 +58,17 @@ int game_mode_initialise_gpu(GameModeConfig *config, GameModeGPUInfo **info)
|
|||||||
FATAL_ERROR("Invalid GameModeGPUInfo passed to %s", __func__);
|
FATAL_ERROR("Invalid GameModeGPUInfo passed to %s", __func__);
|
||||||
|
|
||||||
/* Early out if we have this feature turned off */
|
/* Early out if we have this feature turned off */
|
||||||
long apply = 0;
|
char apply[CONFIG_VALUE_MAX];
|
||||||
config_get_apply_gpu_optimisations(config, &apply);
|
config_get_apply_gpu_optimisations(config, apply);
|
||||||
if (apply == 0)
|
if (strlen(apply) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (strncmp(apply, "accept-responsibility", CONFIG_VALUE_MAX) != 0) {
|
||||||
|
LOG_ERROR(
|
||||||
|
"apply_gpu_optimisations set to value other than \"accept-responsibility\" (%s), will "
|
||||||
|
"not apply GPU optimisations!\n",
|
||||||
|
apply);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the context */
|
/* Create the context */
|
||||||
GameModeGPUInfo *new_info = malloc(sizeof(GameModeGPUInfo));
|
GameModeGPUInfo *new_info = malloc(sizeof(GameModeGPUInfo));
|
||||||
|
@ -40,7 +40,7 @@ inhibit_screensaver=1
|
|||||||
; Any damage to hardware incurred due to this feature is your responsibility and yours alone
|
; Any damage to hardware incurred due to this feature is your responsibility and yours alone
|
||||||
; It is also highly recommended you try these settings out first manually to find the sweet spots
|
; It is also highly recommended you try these settings out first manually to find the sweet spots
|
||||||
|
|
||||||
; Setting this to 1 will allow gamemode to attempt to apply GPU optimisations such as overclocks
|
; Setting this to the keyphrase "accept-responsibility" will allow gamemode to apply GPU optimisations such as overclocks
|
||||||
;apply_gpu_optimisations=0
|
;apply_gpu_optimisations=0
|
||||||
|
|
||||||
; Set these to specify which vendor and device ID you want apply optimisations to
|
; Set these to specify which vendor and device ID you want apply optimisations to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user