Skip to content

Fix nvidia new offset api#547

Merged
afayaz-feral merged 3 commits intoFeralInteractive:masterfrom
mangobiche:fix-nvidia-new-offset-api
Sep 4, 2025
Merged

Fix nvidia new offset api#547
afayaz-feral merged 3 commits intoFeralInteractive:masterfrom
mangobiche:fix-nvidia-new-offset-api

Conversation

@mangobiche
Copy link
Contributor

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

On systems without /sys/class/drm/card0, gamemode fails to detect the
correct NVIDIA GPU index when the GPU device is explicitly set in
gamemode.ini.

This patch adjusts get_gpu_index_id_nv() to skip over non-NVIDIA
devices without prematurely failing, correctly mapping the configured
DRM device index to the NVML index.

Fixes: FeralInteractive#486
Tested on: RTX 3070 (driver 575.64.03) on Ubuntu 25.04, cards 0-2 and some other random numbers were tested
…table` 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
Copy link
Contributor

@afayaz-feral afayaz-feral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run clang-format on the code? Our format check script is failing with your new changes.

…table` 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
@mangobiche
Copy link
Contributor Author

I just clang-formated, sorry I missed completly the pull requirement :). Let me know if you can compile or if further changes are necessary.

@afayaz-feral
Copy link
Contributor

Thanks, could you also run clang-format on #546 ? I'd rather merge the PRs in order, to avoid complications.

@mangobiche
Copy link
Contributor Author

Done! Let me know if it goes ok!

@afayaz-feral afayaz-feral dismissed their stale review September 2, 2025 09:29

clang-format applied

@afayaz-feral afayaz-feral merged commit aac2cf7 into FeralInteractive:master Sep 4, 2025
1 check passed
@mangobiche mangobiche deleted the fix-nvidia-new-offset-api branch September 5, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants