mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-08 07:30:36 -04:00
manager/user: Make GPU interfaces optional
This commit is contained in:
parent
53754680c1
commit
f2cf6d87fe
2 changed files with 50 additions and 10 deletions
|
@ -587,11 +587,29 @@ pub(crate) async fn create_interfaces(
|
||||||
object_server.at(MANAGER_PATH, cpu_scaling).await?;
|
object_server.at(MANAGER_PATH, cpu_scaling).await?;
|
||||||
object_server.at(MANAGER_PATH, factory_reset).await?;
|
object_server.at(MANAGER_PATH, factory_reset).await?;
|
||||||
object_server.at(MANAGER_PATH, fan_control).await?;
|
object_server.at(MANAGER_PATH, fan_control).await?;
|
||||||
object_server
|
|
||||||
.at(MANAGER_PATH, gpu_performance_level)
|
if !get_available_gpu_performance_levels()
|
||||||
.await?;
|
.await
|
||||||
object_server.at(MANAGER_PATH, gpu_power_profile).await?;
|
.unwrap_or_default()
|
||||||
object_server.at(MANAGER_PATH, gpu_tdp_limit).await?;
|
.is_empty()
|
||||||
|
{
|
||||||
|
object_server
|
||||||
|
.at(MANAGER_PATH, gpu_performance_level)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if !get_available_gpu_power_profiles()
|
||||||
|
.await
|
||||||
|
.unwrap_or_default()
|
||||||
|
.is_empty()
|
||||||
|
{
|
||||||
|
object_server.at(MANAGER_PATH, gpu_power_profile).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if get_tdp_limit().await.is_ok() {
|
||||||
|
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?;
|
||||||
|
@ -612,7 +630,7 @@ mod test {
|
||||||
use crate::daemon::user::UserContext;
|
use crate::daemon::user::UserContext;
|
||||||
use crate::hardware::test::fake_model;
|
use crate::hardware::test::fake_model;
|
||||||
use crate::hardware::HardwareVariant;
|
use crate::hardware::HardwareVariant;
|
||||||
use crate::testing;
|
use crate::{power, testing};
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::sync::mpsc::unbounded_channel;
|
use tokio::sync::mpsc::unbounded_channel;
|
||||||
|
@ -630,6 +648,7 @@ mod test {
|
||||||
let (tx_job, _rx_job) = unbounded_channel::<JobManagerCommand>();
|
let (tx_job, _rx_job) = unbounded_channel::<JobManagerCommand>();
|
||||||
let connection = handle.new_dbus().await?;
|
let connection = handle.new_dbus().await?;
|
||||||
fake_model(HardwareVariant::Jupiter).await?;
|
fake_model(HardwareVariant::Jupiter).await?;
|
||||||
|
power::test::create_nodes().await?;
|
||||||
create_interfaces(connection.clone(), connection.clone(), tx_ctx, tx_job).await?;
|
create_interfaces(connection.clone(), connection.clone(), tx_ctx, tx_job).await?;
|
||||||
|
|
||||||
sleep(Duration::from_millis(1)).await;
|
sleep(Duration::from_millis(1)).await;
|
||||||
|
|
29
src/power.rs
29
src/power.rs
|
@ -422,11 +422,32 @@ pub(crate) mod test {
|
||||||
let base = path(GPU_HWMON_PREFIX).join("hwmon5");
|
let base = path(GPU_HWMON_PREFIX).join("hwmon5");
|
||||||
let filename = base.join(GPU_PERFORMANCE_LEVEL_SUFFIX);
|
let filename = base.join(GPU_PERFORMANCE_LEVEL_SUFFIX);
|
||||||
// Creates hwmon path, including device subpath
|
// Creates hwmon path, including device subpath
|
||||||
create_dir_all(filename.parent().unwrap())
|
create_dir_all(filename.parent().unwrap()).await?;
|
||||||
.await?;
|
|
||||||
// Writes name file as addgpu so find_hwmon() will find it.
|
// Writes name file as addgpu so find_hwmon() will find it.
|
||||||
write_synced(base.join("name"), GPU_HWMON_NAME.as_bytes())
|
write_synced(base.join("name"), GPU_HWMON_NAME.as_bytes()).await?;
|
||||||
.await?;
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn create_nodes() -> Result<()> {
|
||||||
|
setup().await?;
|
||||||
|
let base = find_hwmon().await?;
|
||||||
|
|
||||||
|
let filename = base.join(GPU_PERFORMANCE_LEVEL_SUFFIX);
|
||||||
|
write(filename.as_path(), "auto\n").await?;
|
||||||
|
|
||||||
|
let filename = base.join(GPU_POWER_PROFILE_SUFFIX);
|
||||||
|
let contents = " 1 3D_FULL_SCREEN
|
||||||
|
3 VIDEO*
|
||||||
|
4 VR
|
||||||
|
5 COMPUTE
|
||||||
|
6 CUSTOM
|
||||||
|
8 CAPPED
|
||||||
|
9 UNCAPPED";
|
||||||
|
write(filename.as_path(), contents).await?;
|
||||||
|
|
||||||
|
let filename = base.join(TDP_LIMIT1);
|
||||||
|
write(filename.as_path(), "15000000\n").await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue