feat(gamemode): Add support for new GPU cards via nv_per_profile_editable in gamemode.ini

- Added a new configuration variable `nv_per_profile_editable` to the `gamemode.ini` file.
  - If set to 1 (default behavior), the code will use per-profile offset behavior.
  - If set to 0, the code will use the AllPerformanceLevels API, which is compatible with newer cards like the GTX5060ti.

- Updated the `gpuclockctl` utility to accept the `nv_per_profile_editable` parameter.
  - If the parameter is not provided, it defaults to 1 and uses the previous API for backward compatibility.

This change allows `gamemode` to support a wider range of GPU cards by providing flexibility in how GPU performance levels are managed.

**Notes:**
- Ensure that the `gamemode.ini` file includes the new `nv_per_profile_editable` setting.
- Verify that the updated `gpuclockctl` utility functions as expected with both default and specified values for `nv_per_profile_editable`.

Tested on: RTX 5060 ti (driver 575.64.05) on Ubuntu 25.04
This commit is contained in:
mangobiche
2025-08-27 16:39:44 -05:00
parent 47d73cbb3f
commit e5b0a2bf3e
6 changed files with 188 additions and 77 deletions

View File

@@ -110,6 +110,7 @@ struct GameModeConfig {
long nv_core_clock_mhz_offset;
long nv_mem_clock_mhz_offset;
long nv_powermizer_mode;
long nv_per_profile_editable;
char amd_performance_level[CONFIG_VALUE_MAX];
char cpu_park_cores[CONFIG_VALUE_MAX];
@@ -308,6 +309,8 @@ static int inih_handler(void *user, const char *section, const char *name, const
valid = get_long_value(name, value, &self->values.nv_mem_clock_mhz_offset);
} else if (strcmp(name, "nv_powermizer_mode") == 0) {
valid = get_long_value(name, value, &self->values.nv_powermizer_mode);
} else if (strcmp(name, "nv_per_profile_editable") == 0) {
valid = get_long_value(name, value, &self->values.nv_per_profile_editable);
} else if (strcmp(name, "amd_performance_level") == 0) {
valid = get_string_value(value, self->values.amd_performance_level);
}
@@ -387,6 +390,7 @@ static void load_config_files(GameModeConfig *self)
self->values.reaper_frequency = DEFAULT_REAPER_FREQ;
self->values.gpu_device = 0;
self->values.nv_powermizer_mode = -1;
self->values.nv_per_profile_editable = 1; /* Defaults to editable profiles */
self->values.nv_core_clock_mhz_offset = -1;
self->values.nv_mem_clock_mhz_offset = -1;
self->values.script_timeout = 10; /* Default to 10 seconds for scripts */
@@ -479,7 +483,7 @@ GameModeConfig *config_create(void)
}
/*
* Initialise the config
* Initialize the config
*/
void config_init(GameModeConfig *self)
{
@@ -827,6 +831,7 @@ DEFINE_CONFIG_GET(gpu_device)
DEFINE_CONFIG_GET(nv_core_clock_mhz_offset)
DEFINE_CONFIG_GET(nv_mem_clock_mhz_offset)
DEFINE_CONFIG_GET(nv_powermizer_mode)
DEFINE_CONFIG_GET(nv_per_profile_editable)
void config_get_amd_performance_level(GameModeConfig *self, char value[CONFIG_VALUE_MAX])
{