mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-05 14:10:34 -04:00
manager/user: Move relevant methods to GpuTdpLimit1, update as specified
This commit is contained in:
parent
576135cd7a
commit
5e828efdfa
4 changed files with 54 additions and 55 deletions
|
@ -31,36 +31,15 @@
|
||||||
-->
|
-->
|
||||||
<property name="Version" type="u" access="read"/>
|
<property name="Version" type="u" access="read"/>
|
||||||
|
|
||||||
<!--
|
|
||||||
TdpLimit:
|
|
||||||
|
|
||||||
Controls the GPU TDP limit.
|
|
||||||
|
|
||||||
Valid states: In range of [ TdpLimitMin, TdpLimitMax ]
|
|
||||||
|
|
||||||
Since: 7
|
|
||||||
-->
|
|
||||||
<property name="TdpLimit" type="u" access="readwrite"/>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
TdpLimitMin:
|
TdpLimitMin:
|
||||||
|
|
||||||
Minimum allowed TDP Limit.
|
This is a dummy function. Use the GpuTdpLimit1 interface instead.
|
||||||
|
|
||||||
Since: 7
|
Since: 7
|
||||||
-->
|
-->
|
||||||
<property name="TdpLimitMin" type="u" access="read"/>
|
<property name="TdpLimitMin" type="u" access="read"/>
|
||||||
|
|
||||||
<!--
|
|
||||||
TdpLimitMax:
|
|
||||||
|
|
||||||
Maximum allowed TDP Limit.
|
|
||||||
|
|
||||||
Since: 7
|
|
||||||
-->
|
|
||||||
<property name="TdpLimitMax" type="u" access="read"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
WifiDebugModeState:
|
WifiDebugModeState:
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,9 @@ use steamos_manager::hardware::FanControlState;
|
||||||
use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerProfile};
|
use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerProfile};
|
||||||
use steamos_manager::proxy::{
|
use steamos_manager::proxy::{
|
||||||
AmbientLightSensor1Proxy, CpuScaling1Proxy, FactoryReset1Proxy, FanControl1Proxy,
|
AmbientLightSensor1Proxy, CpuScaling1Proxy, FactoryReset1Proxy, FanControl1Proxy,
|
||||||
GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, HdmiCec1Proxy, Manager2Proxy, ManagerProxy,
|
GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, GpuTdpLimit1Proxy, HdmiCec1Proxy,
|
||||||
Storage1Proxy, UpdateBios1Proxy, UpdateDock1Proxy, WifiDebug1Proxy, WifiPowerManagement1Proxy,
|
Manager2Proxy, ManagerProxy, Storage1Proxy, UpdateBios1Proxy, UpdateDock1Proxy,
|
||||||
|
WifiDebug1Proxy, WifiPowerManagement1Proxy,
|
||||||
};
|
};
|
||||||
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
|
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
|
||||||
use zbus::fdo::PropertiesProxy;
|
use zbus::fdo::PropertiesProxy;
|
||||||
|
@ -312,17 +313,21 @@ async fn main() -> Result<()> {
|
||||||
println!("Manual GPU Clock Min: {value}");
|
println!("Manual GPU Clock Min: {value}");
|
||||||
}
|
}
|
||||||
Commands::SetTDPLimit { limit } => {
|
Commands::SetTDPLimit { limit } => {
|
||||||
|
let proxy = GpuTdpLimit1Proxy::new(&conn).await?;
|
||||||
proxy.set_tdp_limit(*limit).await?;
|
proxy.set_tdp_limit(*limit).await?;
|
||||||
}
|
}
|
||||||
Commands::GetTDPLimit => {
|
Commands::GetTDPLimit => {
|
||||||
|
let proxy = GpuTdpLimit1Proxy::new(&conn).await?;
|
||||||
let limit = proxy.tdp_limit().await?;
|
let limit = proxy.tdp_limit().await?;
|
||||||
println!("TDP limit: {limit}");
|
println!("TDP limit: {limit}");
|
||||||
}
|
}
|
||||||
Commands::GetTDPLimitMax => {
|
Commands::GetTDPLimitMax => {
|
||||||
|
let proxy = GpuTdpLimit1Proxy::new(&conn).await?;
|
||||||
let value = proxy.tdp_limit_max().await?;
|
let value = proxy.tdp_limit_max().await?;
|
||||||
println!("TDP limit max: {value}");
|
println!("TDP limit max: {value}");
|
||||||
}
|
}
|
||||||
Commands::GetTDPLimitMin => {
|
Commands::GetTDPLimitMin => {
|
||||||
|
let proxy = GpuTdpLimit1Proxy::new(&conn).await?;
|
||||||
let value = proxy.tdp_limit_min().await?;
|
let value = proxy.tdp_limit_min().await?;
|
||||||
println!("TDP limit min: {value}");
|
println!("TDP limit min: {value}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,10 @@ struct GpuPowerProfile1 {
|
||||||
proxy: Proxy<'static>,
|
proxy: Proxy<'static>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct GpuTdpLimit1 {
|
||||||
|
proxy: Proxy<'static>,
|
||||||
|
}
|
||||||
|
|
||||||
struct HdmiCec1 {
|
struct HdmiCec1 {
|
||||||
hdmi_cec: HdmiCecControl<'static>,
|
hdmi_cec: HdmiCecControl<'static>,
|
||||||
}
|
}
|
||||||
|
@ -169,29 +173,9 @@ impl SteamOSManager {
|
||||||
API_VERSION
|
API_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
|
||||||
async fn tdp_limit(&self) -> fdo::Result<u32> {
|
|
||||||
get_tdp_limit().await.map_err(to_zbus_fdo_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[zbus(property)]
|
|
||||||
async fn set_tdp_limit(&self, limit: u32) -> zbus::Result<()> {
|
|
||||||
self.proxy
|
|
||||||
.call("SetTdpLimit", &(limit))
|
|
||||||
.await
|
|
||||||
.map_err(to_zbus_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn tdp_limit_min(&self) -> u32 {
|
async fn tdp_limit_min(&self) -> u32 {
|
||||||
// TODO: Can this be queried from somewhere?
|
0
|
||||||
3
|
|
||||||
}
|
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
|
||||||
async fn tdp_limit_max(&self) -> u32 {
|
|
||||||
// TODO: Can this be queried from somewhere?
|
|
||||||
15
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
|
@ -386,6 +370,34 @@ impl GpuPowerProfile1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[interface(name = "com.steampowered.SteamOSManager1.GpuTdpLimit1")]
|
||||||
|
impl GpuTdpLimit1 {
|
||||||
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
|
async fn tdp_limit(&self) -> fdo::Result<u32> {
|
||||||
|
get_tdp_limit().await.map_err(to_zbus_fdo_error)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property)]
|
||||||
|
async fn set_tdp_limit(&self, limit: u32) -> zbus::Result<()> {
|
||||||
|
self.proxy
|
||||||
|
.call("SetTdpLimit", &(limit))
|
||||||
|
.await
|
||||||
|
.map_err(to_zbus_error)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
|
async fn tdp_limit_min(&self) -> u32 {
|
||||||
|
// TODO: Can this be queried from somewhere?
|
||||||
|
3
|
||||||
|
}
|
||||||
|
|
||||||
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
|
async fn tdp_limit_max(&self) -> u32 {
|
||||||
|
// TODO: Can this be queried from somewhere?
|
||||||
|
15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HdmiCec1 {
|
impl HdmiCec1 {
|
||||||
async fn new(connection: &Connection) -> Result<HdmiCec1> {
|
async fn new(connection: &Connection) -> Result<HdmiCec1> {
|
||||||
let hdmi_cec = HdmiCecControl::new(connection).await?;
|
let hdmi_cec = HdmiCecControl::new(connection).await?;
|
||||||
|
@ -557,6 +569,9 @@ pub(crate) async fn create_interfaces(
|
||||||
let gpu_power_profile = GpuPowerProfile1 {
|
let gpu_power_profile = GpuPowerProfile1 {
|
||||||
proxy: proxy.clone(),
|
proxy: proxy.clone(),
|
||||||
};
|
};
|
||||||
|
let gpu_tdp_limit = GpuTdpLimit1 {
|
||||||
|
proxy: proxy.clone(),
|
||||||
|
};
|
||||||
let hdmi_cec = HdmiCec1::new(&session).await?;
|
let hdmi_cec = HdmiCec1::new(&session).await?;
|
||||||
let manager2 = Manager2 {
|
let manager2 = Manager2 {
|
||||||
proxy: proxy.clone(),
|
proxy: proxy.clone(),
|
||||||
|
@ -591,6 +606,7 @@ pub(crate) async fn create_interfaces(
|
||||||
.at(MANAGER_PATH, gpu_performance_level)
|
.at(MANAGER_PATH, gpu_performance_level)
|
||||||
.await?;
|
.await?;
|
||||||
object_server.at(MANAGER_PATH, gpu_power_profile).await?;
|
object_server.at(MANAGER_PATH, gpu_power_profile).await?;
|
||||||
|
object_server.at(MANAGER_PATH, gpu_tdp_limit).await?;
|
||||||
object_server.at(MANAGER_PATH, hdmi_cec).await?;
|
object_server.at(MANAGER_PATH, hdmi_cec).await?;
|
||||||
object_server.at(MANAGER_PATH, manager2).await?;
|
object_server.at(MANAGER_PATH, manager2).await?;
|
||||||
object_server.at(MANAGER_PATH, storage).await?;
|
object_server.at(MANAGER_PATH, storage).await?;
|
||||||
|
@ -724,6 +740,15 @@ mod test {
|
||||||
.unwrap());
|
.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn interface_matches_gpu_tdp_limit1() {
|
||||||
|
let test = start().await.expect("start");
|
||||||
|
|
||||||
|
assert!(test_interface_matches::<GpuTdpLimit1>(&test.connection)
|
||||||
|
.await
|
||||||
|
.unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn interface_matches_hdmi_cec1() {
|
async fn interface_matches_hdmi_cec1() {
|
||||||
let test = start().await.expect("start");
|
let test = start().await.expect("start");
|
||||||
|
|
|
@ -22,16 +22,6 @@ trait Manager {
|
||||||
/// SetWifiDebugMode method
|
/// SetWifiDebugMode method
|
||||||
fn set_wifi_debug_mode(&self, mode: u32, buffer_size: u32) -> zbus::Result<()>;
|
fn set_wifi_debug_mode(&self, mode: u32, buffer_size: u32) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// TdpLimit property
|
|
||||||
#[zbus(property)]
|
|
||||||
fn tdp_limit(&self) -> zbus::Result<u32>;
|
|
||||||
#[zbus(property)]
|
|
||||||
fn set_tdp_limit(&self, value: u32) -> zbus::Result<()>;
|
|
||||||
|
|
||||||
/// TdpLimitMax property
|
|
||||||
#[zbus(property)]
|
|
||||||
fn tdp_limit_max(&self) -> zbus::Result<u32>;
|
|
||||||
|
|
||||||
/// TdpLimitMin property
|
/// TdpLimitMin property
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn tdp_limit_min(&self) -> zbus::Result<u32>;
|
fn tdp_limit_min(&self) -> zbus::Result<u32>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue