fix: update amdgpu-sysfs with iGPU fixes, add steam deck quirk (#407)

* feat: van gogh support

* fix: device id

* fix
This commit is contained in:
Ilya Zlobintsev 2024-11-10 21:13:19 +02:00 committed by GitHub
parent 8084247d24
commit 27d3402d08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 6 deletions

4
Cargo.lock generated
View File

@ -53,9 +53,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]]
name = "amdgpu-sysfs"
version = "0.17.0"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2175fc4ea95f486dfe93f657b3447cb58caed82d7d5fd3bcfdffdf6888ffce15"
checksum = "01631a1d520df9737660f26b0c64c5ea9d74667bf4cbb1c1559a6ddb8478c4ef"
dependencies = [
"enum_dispatch",
"serde",

View File

@ -46,6 +46,8 @@ use {
const GPU_CLOCKDOWN_TIMEOUT_SECS: u64 = 3;
const MAX_PSTATE_READ_ATTEMPTS: u32 = 5;
const VENDOR_AMD: &str = "1002";
const STEAM_DECK_IDS: [&str; 2] = ["163F", "1435"];
pub struct AmdGpuController {
handle: GpuHandle,
@ -518,6 +520,13 @@ impl AmdGpuController {
None
}
fn is_steam_deck(&self) -> bool {
self.pci_info.as_ref().is_some_and(|info| {
info.device_pci_info.vendor_id == VENDOR_AMD
&& STEAM_DECK_IDS.contains(&info.device_pci_info.model_id.as_str())
})
}
}
impl GpuController for AmdGpuController {
@ -774,10 +783,17 @@ impl GpuController for AmdGpuController {
// Reset the clocks table in case the settings get reverted back to not having a clocks value configured
self.handle.reset_clocks_table().ok();
// Reset performance level to work around some GPU quirks (found to be an issue on RDNA2)
self.handle
.set_power_force_performance_level(PerformanceLevel::Auto)
.ok();
if self.is_steam_deck() {
// Van Gogh/Sephiroth only allow clock settings to be used with manual performance mode
self.handle
.set_power_force_performance_level(PerformanceLevel::Manual)
.ok();
} else {
// Reset performance level to work around some GPU quirks (found to be an issue on RDNA2)
self.handle
.set_power_force_performance_level(PerformanceLevel::Auto)
.ok();
}
if config.is_core_clocks_used() {
let original_table = self