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`.
- clang-formated

Tested on: RTX 5060 ti (driver 575.64.05) on Ubuntu 25.04
This commit is contained in:
mangobiche
2025-08-28 10:54:45 -05:00
parent e5b0a2bf3e
commit 3be7c13f7b
3 changed files with 46 additions and 47 deletions

View File

@@ -177,7 +177,8 @@ int game_mode_apply_gpu(const GameModeGPUInfo *info)
info->vendor == Vendor_NVIDIA ? nv_core : info->amd_performance_level,
info->vendor == Vendor_NVIDIA ? nv_mem : NULL, /* Only use this if Nvidia */
info->vendor == Vendor_NVIDIA ? nv_powermizer_mode : NULL, /* Only use this if Nvidia */
info->vendor == Vendor_NVIDIA ? nv_per_profile_editable : NULL, /* Only use this if Nvidia */
info->vendor == Vendor_NVIDIA ? nv_per_profile_editable : NULL, /* Only use this if Nvidia
*/
NULL,
};
@@ -203,11 +204,7 @@ int game_mode_get_gpu(GameModeGPUInfo *info)
// Set up our command line to pass to gpuclockctl
// This doesn't need pkexec as get does not need elevated perms
const char *const exec_args[] = {
LIBEXECDIR "/gpuclockctl",
device,
"get",
profile_editable, //TODO:refactor
NULL,
LIBEXECDIR "/gpuclockctl", device, "get", profile_editable, NULL,
};
char buffer[EXTERNAL_BUFFER_MAX] = { 0 };

View File

@@ -132,7 +132,9 @@ static long get_gpu_index_id_nv(struct GameModeGPUInfo *info)
}
if (nv_device < 0) {
LOG_ERROR("Could not resolve NVIDIA index for DRM card%ld (no NVIDIA cards found up to that index)\n",
LOG_ERROR(
"Could not resolve NVIDIA index for DRM card%ld (no NVIDIA cards found up to that "
"index)\n",
info->device);
}