mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-09 16:10:34 -04:00
Add gpu power profile(s) property management to steamosctl.
Adds get-gpu-power-profiles to list supported profiles get-gpu-power-profile to list current and set-gpu-power-profile to set.
This commit is contained in:
parent
0759ff7077
commit
f30c54c907
2 changed files with 47 additions and 1 deletions
|
@ -11,7 +11,7 @@ use itertools::Itertools;
|
|||
use std::ops::Deref;
|
||||
use steamos_manager::cec::HdmiCecState;
|
||||
use steamos_manager::hardware::FanControlState;
|
||||
use steamos_manager::power::GPUPerformanceLevel;
|
||||
use steamos_manager::power::{GPUPerformanceLevel, GPUPowerProfile};
|
||||
use steamos_manager::proxy::ManagerProxy;
|
||||
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
|
||||
use zbus::fdo::PropertiesProxy;
|
||||
|
@ -45,6 +45,18 @@ enum Commands {
|
|||
/// Get the fan control state
|
||||
GetFanControlState,
|
||||
|
||||
/// Get the GPU power profiles supported on this device
|
||||
GetGPUPowerProfiles,
|
||||
|
||||
/// Get the current GPU power profile
|
||||
GetGPUPowerProfile,
|
||||
|
||||
/// Set the GPU Power profile
|
||||
SetGPUPowerProfile {
|
||||
/// Valid profiles are get-gpu-power-profiles.
|
||||
profile: GPUPowerProfile,
|
||||
},
|
||||
|
||||
/// Set the GPU performance level
|
||||
SetGPUPerformanceLevel {
|
||||
/// Valid levels are auto, low, high, manual, peak_performance
|
||||
|
@ -191,6 +203,30 @@ async fn main() -> Result<()> {
|
|||
Err(_) => println!("Got unknown value {state} from backend"),
|
||||
}
|
||||
}
|
||||
Commands::GetGPUPowerProfiles => {
|
||||
let profiles = proxy.gpu_power_profiles().await?;
|
||||
println!("Profiles:\n");
|
||||
for key in profiles.keys().sorted() {
|
||||
let name = &profiles[key];
|
||||
println!("{key}: {name}");
|
||||
}
|
||||
}
|
||||
Commands::GetGPUPowerProfile => {
|
||||
let profile = proxy.gpu_power_profile().await?;
|
||||
let profile_type = GPUPowerProfile::try_from(profile);
|
||||
match profile_type {
|
||||
Ok(t) => {
|
||||
let name = t.to_string();
|
||||
println!("GPU Power Profile: {profile} {name}");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("Unknown GPU power profile or unable to get type from {profile}")
|
||||
}
|
||||
}
|
||||
}
|
||||
Commands::SetGPUPowerProfile { profile } => {
|
||||
proxy.set_gpu_power_profile(*profile as u32).await?;
|
||||
}
|
||||
Commands::SetGPUPerformanceLevel { level } => {
|
||||
proxy.set_gpu_performance_level(*level as u32).await?;
|
||||
}
|
||||
|
|
10
src/proxy.rs
10
src/proxy.rs
|
@ -62,6 +62,16 @@ trait Manager {
|
|||
#[zbus(property)]
|
||||
fn set_gpu_performance_level(&self, value: u32) -> zbus::Result<()>;
|
||||
|
||||
/// GpuPowerProfile property
|
||||
#[zbus(property)]
|
||||
fn gpu_power_profile(&self) -> zbus::Result<u32>;
|
||||
#[zbus(property)]
|
||||
fn set_gpu_power_profile(&self, value: u32) -> zbus::Result<()>;
|
||||
|
||||
/// GpuPowerProfiles property
|
||||
#[zbus(property)]
|
||||
fn gpu_power_profiles(&self) -> zbus::Result<std::collections::HashMap<u32, String>>;
|
||||
|
||||
/// HardwareCurrentlySupported property
|
||||
#[zbus(property)]
|
||||
fn hardware_currently_supported(&self) -> zbus::Result<u32>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue