diff --git a/Cargo.toml b/Cargo.toml index f4e65bc..3e5ab25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amdgpu-sysfs" -version = "0.17.4" +version = "0.17.5" authors = ["Ilya Zlobintsev "] edition = "2021" license = "GPL-3.0" diff --git a/src/gpu_handle/power_profile_mode.rs b/src/gpu_handle/power_profile_mode.rs index 1f64162..003c9ee 100644 --- a/src/gpu_handle/power_profile_mode.rs +++ b/src/gpu_handle/power_profile_mode.rs @@ -315,18 +315,22 @@ impl PowerProfileModesTable { for (profile_i, raw_value) in split.enumerate() { let value = raw_value.parse()?; - let component = PowerProfileComponent { - clock_type: None, - values: vec![Some(value)], - }; + let profile = modes.get_mut(&(profile_i as u16)).ok_or_else(|| { + Error::basic_parse_error("Could not get profile from header by index") + })?; - modes - .get_mut(&(profile_i as u16)) - .ok_or_else(|| { - Error::basic_parse_error("Could not get profile from header by index") - })? - .components - .push(component); + match profile.components.first_mut() { + Some(component) => { + component.values.push(Some(value)); + } + None => { + let component = PowerProfileComponent { + clock_type: None, + values: vec![Some(value)], + }; + profile.components.push(component); + } + } } } diff --git a/src/gpu_handle/snapshots/amdgpu_sysfs__gpu_handle__power_profile_mode__tests__parse_full_rx7700s.snap b/src/gpu_handle/snapshots/amdgpu_sysfs__gpu_handle__power_profile_mode__tests__parse_full_rx7700s.snap index 8887e2f..a3f33a0 100644 --- a/src/gpu_handle/snapshots/amdgpu_sysfs__gpu_handle__power_profile_mode__tests__parse_full_rx7700s.snap +++ b/src/gpu_handle/snapshots/amdgpu_sysfs__gpu_handle__power_profile_mode__tests__parse_full_rx7700s.snap @@ -9,44 +9,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 800 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 3 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 1: name: 3D_FULL_SCREEN @@ -54,44 +28,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 2 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 650 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 2: name: POWER_SAVING @@ -99,44 +47,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 3 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 3: name: VIDEO @@ -144,44 +66,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 4: name: VR @@ -189,44 +85,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1000 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 5: name: COMPUTE @@ -234,44 +104,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1000 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 6: name: CUSTOM @@ -279,44 +123,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 800 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 3 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 7: name: WINDOW_3D @@ -324,44 +142,18 @@ modes: - clock_type: ~ values: - 0 - - clock_type: ~ - values: - 2 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 4 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 650 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 3 - - clock_type: ~ - values: - 1 - - clock_type: ~ - values: - 0 - - clock_type: ~ - values: - 0 value_names: - Gfx_ActiveHystLimit