Previously we had two diferent lookup functions for finding the GPU in
/sys/class/drm/card* and /sys/class/hwmon/hwmon*, but for the former we only
used paths under it in device/. In both these cases, the device/ directory is a
symbolic link to the same directory, so in the case of one AMD GPU in a
machine, these operations were equivalent.
This MR removes the /sys/class/drm version as well as refactoring some of the
utility code to reduce code duplication.
Add a new enumeration for cpu scheduler governors.
Adds a property to get the available governors as a map of
value to strings similar to how we expose GPU Power Profiles.
Adds another property to get and set the current governor which
is applied to all cpus when set.
Add profiles property to give back available
profiles on this device.
Add profile property to get and set current gpu
power profile.
Filter possible properties when on deck.
Get current profile based on position of * character.
Get card0 path based on which cardX has vendor 0x1002
Add some basic tests.
TODO:
Possibly cache available properties instead of fetching repeatedly.
Instead of always using /sys/class/drm/card0 based paths, use
/sys/class/hwmon looking for amdgpu name file to determine where
to look.
Fixes reading TDPLimit, GPUPerformanceLevel and ManualGPUClock
in cases where sysfs uses card1 or other paths.
NOTE: Using wrong cardX path is a bug and will be fixed, but
this makes steamos-manager a bit more resilient to those bugs.