Skip to content

Commit

Permalink
fix(SteamDeck): add Steam Deck OLED limits
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Apr 4, 2024
1 parent 8fa9fa1 commit e897e83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ use std::{error::Error, future::pending};
use zbus::Connection;

use crate::constants::{BUS_NAME, CPU_PATH, GPU_PATH};
use crate::performance::cpu::cpu;
use crate::performance::gpu::dbus;
use crate::dbus::gpu::GPUBus;
use crate::dbus::gpu::get_connectors;
use crate::dbus::gpu::get_gpus;
use crate::dbus::gpu::GPUBus;
use crate::performance::cpu::cpu;
use crate::performance::gpu::dbus;

mod constants;
mod performance;

#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
async fn main() -> Result<(), Box<dyn Error>> {
SimpleLogger::new().init().unwrap();
log::info!("Starting PowerStation");
const VERSION: &str = env!("CARGO_PKG_VERSION");
log::info!("Starting PowerStation v{}", VERSION);

// Discover all CPUs
let cpu = cpu::CPU::new();
Expand Down
6 changes: 5 additions & 1 deletion src/performance/gpu/amd/tdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::performance::gpu::tdp::{TDPDevice, TDPError, TDPResult};

/// Steam Deck GPU ID
const DEV_ID_VANGOGH: &str = "163f";
const DEV_ID_SEPHIROTH: &str = "1435";

/// Implementation of TDP control for AMD GPUs
pub struct TDP {
Expand All @@ -27,14 +28,17 @@ impl TDP {
// Set fake TDP limits for GPUs that don't support ryzenadj monitoring (e.g. Steam Deck)
let unsupported_stapm_limit: f32 = match device_id.as_str() {
DEV_ID_VANGOGH => 12.0,
DEV_ID_SEPHIROTH => 12.0,
_ => 10.0,
};
let unsupported_ppt_limit_fast: f32 = match device_id.as_str() {
DEV_ID_VANGOGH => 15.0,
DEV_ID_SEPHIROTH => 15.0,
_ => 10.0,
};
let unsupported_thm_limit: f32 = match device_id.as_str() {
DEV_ID_VANGOGH => 95.0,
DEV_ID_SEPHIROTH => 95.0,
_ => 95.0,
};

Expand All @@ -50,7 +54,7 @@ impl TDP {

/// Returns true if ryzenadj cannot read values from the given GPU
fn is_unsupported_gpu(&self) -> bool {
self.device_id == DEV_ID_VANGOGH
matches!(self.device_id.as_str(), DEV_ID_VANGOGH | DEV_ID_SEPHIROTH)
}

/// Set the current Slow PPT limit using ryzenadj
Expand Down

0 comments on commit e897e83

Please sign in to comment.