Userspace API to enter VR power profile
Describe the problem
In virtual reality applications, it is necessary to get predictable GPU times in order to submit and reproject frames on time while maintaining low latency.
amdgpu driver exposes /sys/class/drm/card0/device/pp_power_profile_mode
to select a VR
power profile that satisfies the condition.
This has a few limitations:
- requires elevated privileges to edit
- is automatically changed by kernel in some cases
- may not be set back to previous value in case of crash
I have found prior work on this topic: https://lists.freedesktop.org/archives/amd-gfx/2022-September/084792.html but progress appears to have halted.
Describe the new feature behavior
The new feature should allow userspace to list available modes and select a preferred one. This could require a capability like high priority queues already do. The kernel would aggregate all modes and select the most performant one.
Describe the target user/application
The target applications would mainly be VR runtimes such as Monado, WiVRn or SteamVR. They would either interact directly, or this could be exposed through a new Vulkan extension.
How do you plan to validate this feature
Manually checking /sys/class/drm/card0/device/pp_power_profile_mode
while the VR session is active.
Monado logs warning messages in case frame times are not achieved, with this feature they would become very rare.
Business case
This makes it possible for VR to work correctly without additional software such as corectrl.
The same use case may exist for other power profiles, but I do not know of any current issues.
Draft of the userspace API
I am not very friendly with existing libdrm APIs, a rough draft of functions:
- list power profiles per GPU
- request power profile
- stop power profile request, used if the program is still running but no longer needs the specific profile. For instance if headset is removed.