Compare commits
43 commits
Author | SHA1 | Date | |
---|---|---|---|
bf7b5617b2 | |||
fadf492aac | |||
921f360e9e | |||
1996eb7e16 | |||
6b7ce73a24 | |||
64dc319223 | |||
5f642a33e3 | |||
3f3241ed45 | |||
b100b1f2f2 | |||
f9e384d50c | |||
d23880bf4d | |||
579ee2ee85 | |||
decc0cd73d | |||
|
3de8a89c9b | ||
|
94e429e448 | ||
a7be114fd3 | |||
2878232ba4 | |||
eb4ec05425 | |||
|
760002f430 | ||
53f8867372 | |||
e27b330577 | |||
15833c82e9 | |||
fad17807e2 | |||
2c1321b544 | |||
2fef0d7dd1 | |||
c12a944316 | |||
74a9b723e6 | |||
68f8bfbc7f | |||
1a5a8ca352 | |||
33cd064667 | |||
4bf548152f | |||
c9557736ef | |||
5a71586095 | |||
23cf76f084 | |||
f879c82f33 | |||
05de36a082 | |||
1ca1148a4c | |||
b731ebddc5 | |||
5b6c5ec268 | |||
ab2eea5fb4 | |||
bfcdbf8742 | |||
0b89ed13ec | |||
f0862ddd73 |
45 changed files with 218 additions and 1354 deletions
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
github: NGnius
|
||||
liberapay: NGnius
|
26
.github/ISSUE_TEMPLATE/bug-report.md
vendored
26
.github/ISSUE_TEMPLATE/bug-report.md
vendored
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Expected Behaviour**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Actual Behaviour**
|
||||
A clear and concise description of what actually happened.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Screenshots, etc.**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
Please include the log (located at `/tmp/powertools.log`) if possible.
|
||||
Note: the log is deleted when the device is restarted.
|
72
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
72
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
name: "Bug Report"
|
||||
description: "Report an issue with PowerTools"
|
||||
labels: "bug"
|
||||
body:
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected Behaviour
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual-behaviour
|
||||
attributes:
|
||||
label: Actual Behaviour
|
||||
description: A clear and concise description of what actually happened.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps To Reproduce
|
||||
description: Steps to reproduce the behaviour.
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '.....'
|
||||
4. See error......
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extras
|
||||
attributes:
|
||||
label: Anything else?
|
||||
description: |
|
||||
Screenshots? Logs? limits_overrides.ron? limits_cache.ron? Anything that will give more context about the problem!
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
Please include the log (located at `/tmp/powertools.log`) if possible.
|
||||
Note: the log is deleted when the device is restarted.
|
||||
|
||||
Tip: You can attach files by clicking this area to highlight it and then dragging them in.
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: What version of PowerTools are you using? This is the version beside `Native` near the bottom of the plugin's UI.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: platform
|
||||
attributes:
|
||||
label: Platform
|
||||
description: What driver is PowerTools using?
|
||||
value: SteamDeck
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: OS
|
||||
description: On which operating system are you running PowerTools?
|
||||
options:
|
||||
- _
|
||||
- SteamOS 3 (Stable)
|
||||
- SteamOS 3 (Preview/Beta)
|
||||
- SteamOS 3 (Main)
|
||||
- HoloISO
|
||||
- Not listed
|
||||
validations:
|
||||
required: true
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: NGnius
|
||||
url: https://git.ngni.us/sys/website/wiki#contact-information
|
||||
about: Repository owner
|
17
.github/ISSUE_TEMPLATE/feature-request.md
vendored
17
.github/ISSUE_TEMPLATE/feature-request.md
vendored
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
name: Feature Request
|
||||
about: Suggest a tool to add
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe what you'd like to be able to do**
|
||||
A clear and concise description of what you want. E.g. I'd like to be able to select how many CPU cores are enabled.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternatives you've considered. E.g. Enabling and disabling CPU cores with another computer connected over SSH.
|
||||
|
||||
**Additional context**
|
||||
Description of how can this be done. E.g. This can be accomplished with `echo {0 or 1} > /sys/devices/system/cpu/cpu{cpu_number}/online`.
|
32
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
32
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Feature Request
|
||||
description: Suggest functionality to add
|
||||
labels: "enhancement"
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Describe what you'd like to be able to do
|
||||
description: A clear and concise description of what you want.
|
||||
placeholder: I'd like to be able to ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Describe alternatives you've considered
|
||||
description: A clear and concise description of any alternatives you've considered.
|
||||
placeholder: This can also be done by ... but ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extras
|
||||
attributes:
|
||||
label: Anything else?
|
||||
description: |
|
||||
Description of how this can be achieved, or other additional context.
|
||||
If this is related to the UI, consider adding a picture.
|
||||
|
||||
Tip: You can attach files by clicking this area to highlight it and then dragging them in.
|
||||
placeholder: This can be accomplished by doing ...
|
||||
validations:
|
||||
required: false
|
23
.github/ISSUE_TEMPLATE/question.yml
vendored
Normal file
23
.github/ISSUE_TEMPLATE/question.yml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
name: "Question"
|
||||
description: "Ask for more information about PowerTools"
|
||||
labels: "question"
|
||||
body:
|
||||
- type: textarea
|
||||
id: question-elaboration
|
||||
attributes:
|
||||
label: Question
|
||||
description: |
|
||||
A clear and concise description of what you'd like to know.
|
||||
Please check the wiki and closed issues to avoid waiting for an answer when you didn't need to.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extras
|
||||
attributes:
|
||||
label: Extra Info
|
||||
description: |
|
||||
Additional context or information which may be helpful when answering your question.
|
||||
|
||||
Tip: You can attach files by clicking this area to highlight it and then dragging them in.
|
||||
validations:
|
||||
required: false
|
13
.github/pull_request_template.md
vendored
Normal file
13
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
## Description
|
||||
|
||||
A short description of what the PR changes.
|
||||
If this is a minor change and the commit message(s) explains it well, feel free to delete this section.
|
||||
|
||||
## Motivation
|
||||
|
||||
Why did you write this PR and/or why should it be accepted.
|
||||
|
||||
## Fixes
|
||||
|
||||
Please indicate issues that this fixes or addresses here.
|
||||
If this is a bugfix with no pre-existing issue, please describe the bug here instead.
|
83
backend/Cargo.lock
generated
83
backend/Cargo.lock
generated
|
@ -201,7 +201,7 @@ version = "0.66.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"lazy_static",
|
||||
|
@ -218,18 +218,6 @@ dependencies = [
|
|||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit_field"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.4.1"
|
||||
|
@ -903,22 +891,22 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "libryzenadj"
|
||||
version = "0.13.0"
|
||||
name = "libryzenadj-alt"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5bccdf07c3234c06c435648a53d8cb369f76d20e03bb8d2f8c24fb2330efc32"
|
||||
checksum = "f0a8cc66a7f77b864c2ef014dd9f9a3b03305d9e7f130202ca4addde9bc71f8b"
|
||||
dependencies = [
|
||||
"errno",
|
||||
"libryzenadj-sys",
|
||||
"libryzenadj-sys-alt",
|
||||
"num_enum",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libryzenadj-sys"
|
||||
version = "0.13.0"
|
||||
name = "libryzenadj-sys-alt"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1de3621be974e892e12d4a07a6a2e32b6a05950759b062d94f5b54f78fabc3a"
|
||||
checksum = "cb9de62ac92216770e51b5fa0628c22246a23c948e006f4ee65f6b96f6e0dd35"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cmake",
|
||||
|
@ -927,7 +915,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "limits_core"
|
||||
version = "3.0.1"
|
||||
version = "3.0.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -1174,13 +1162,6 @@ dependencies = [
|
|||
"universal-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "powerbox"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"sysfuss 0.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
|
@ -1189,24 +1170,23 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|||
|
||||
[[package]]
|
||||
name = "powertools"
|
||||
version = "2.0.3-alpha1"
|
||||
version = "2.0.3"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
"clap",
|
||||
"community_settings_core",
|
||||
"libc",
|
||||
"libryzenadj",
|
||||
"libryzenadj-alt",
|
||||
"limits_core",
|
||||
"log",
|
||||
"procbox",
|
||||
"regex",
|
||||
"ron",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"simplelog",
|
||||
"smokepatio",
|
||||
"sysfuss 0.3.0",
|
||||
"sysfuss",
|
||||
"tokio",
|
||||
"ureq",
|
||||
"usdpl-back",
|
||||
|
@ -1247,15 +1227,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "procbox"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"powerbox",
|
||||
"sysfuss 0.4.0",
|
||||
"x86",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.33"
|
||||
|
@ -1295,15 +1266,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-cpuid"
|
||||
version = "10.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.2"
|
||||
|
@ -1354,7 +1316,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
|
||||
dependencies = [
|
||||
"base64 0.21.5",
|
||||
"bitflags 2.4.1",
|
||||
"bitflags",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1377,7 +1339,7 @@ version = "0.38.28"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
|
@ -1520,6 +1482,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "smokepatio"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3416e8c907d171c4334df3933873c32bff97ca5ad7ae0ee93e6268e04e2041ef"
|
||||
dependencies = [
|
||||
"embedded-io",
|
||||
"log",
|
||||
|
@ -1580,10 +1544,6 @@ version = "0.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f33bae529511a671b5f2ed4cc46ae0b2ccdf8c03ccf7eebe95a5a886ff7914dc"
|
||||
|
||||
[[package]]
|
||||
name = "sysfuss"
|
||||
version = "0.4.0"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
|
@ -2208,17 +2168,6 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x86"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2781db97787217ad2a2845c396a5efe286f87467a5810836db6d74926e94a385"
|
||||
dependencies = [
|
||||
"bit_field",
|
||||
"bitflags 1.3.2",
|
||||
"raw-cpuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.3.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "powertools"
|
||||
version = "2.0.3-alpha1"
|
||||
version = "2.0.3"
|
||||
edition = "2021"
|
||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||
description = "Backend (superuser) functionality for PowerTools"
|
||||
|
@ -17,7 +17,6 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
serde_json = "1.0"
|
||||
ron = "0.8"
|
||||
sysfuss = { version = "0.3", features = ["derive"] }#,path = "../../sysfs-nav"}
|
||||
procbox = { version = "0.1", path = "../../powerbox/crates/procbox" }
|
||||
|
||||
# async
|
||||
tokio = { version = "*", features = ["time"] }
|
||||
|
@ -32,7 +31,7 @@ limits_core = { version = "3", path = "./limits_core" }
|
|||
regex = "1"
|
||||
|
||||
# steam deck libs
|
||||
smokepatio = { version = "0.2", default-features = false, path = "../../smokepatio" }
|
||||
smokepatio = { version = "0.2", default-features = false }
|
||||
libc = "0.2"
|
||||
|
||||
# online settings
|
||||
|
@ -41,7 +40,7 @@ chrono = { version = "0.4", features = [ "serde" ] }
|
|||
|
||||
# hardware enablement
|
||||
#libryzenadj = { version = "0.14", path = "../../libryzenadj-rs-14" }
|
||||
libryzenadj = { version = "0.13" }
|
||||
libryzenadj-alt = { version = "0.14" }
|
||||
|
||||
# ureq's tls feature does not like musl targets
|
||||
ureq = { version = "2", features = ["json", "gzip", "brotli", "charset", "tls"], default-features = false, optional = true }
|
||||
|
|
2
backend/limits_core/Cargo.lock
generated
2
backend/limits_core/Cargo.lock
generated
|
@ -4,7 +4,7 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "limits_core"
|
||||
version = "3.0.1"
|
||||
version = "3.0.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "limits_core"
|
||||
version = "3.0.1"
|
||||
version = "3.0.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -9,8 +9,6 @@ pub enum CpuLimitType {
|
|||
SteamDeck,
|
||||
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
|
||||
SteamDeckOLED,
|
||||
ROGAlly,
|
||||
MSIClaw,
|
||||
Generic,
|
||||
GenericAMD,
|
||||
Unknown,
|
||||
|
|
|
@ -8,8 +8,6 @@ pub enum GpuLimitType {
|
|||
SteamDeck,
|
||||
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
|
||||
SteamDeckOLED,
|
||||
ROGAlly,
|
||||
MSIClaw,
|
||||
Generic,
|
||||
GenericAMD,
|
||||
Unknown,
|
||||
|
@ -85,7 +83,8 @@ impl GenericGpuLimit {
|
|||
experiments: false,
|
||||
quirks: vec![
|
||||
"pp_dpm_fclk-reversed".to_owned(),
|
||||
"pp_dpm_fclk-static".to_owned(),
|
||||
"pp_dpm_fclk-not-updated-on-LCD".to_owned(),
|
||||
//"pp_dpm_fclk-static".to_owned(),
|
||||
].into_iter().collect(),
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +94,6 @@ impl GenericGpuLimit {
|
|||
let mut sd = Self::default_steam_deck();
|
||||
sd.memory_clock_step = Some(200);
|
||||
sd.extras.quirks.insert("clock-autodetect".to_owned());
|
||||
sd.extras.quirks.remove("pp_dpm_fclk-static");
|
||||
//sd.extras.quirks.remove("pp_dpm_fclk-reversed");
|
||||
sd
|
||||
}
|
||||
|
||||
|
|
236
backend/limits_srv/Cargo.lock
generated
236
backend/limits_srv/Cargo.lock
generated
|
@ -32,55 +32,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -120,15 +71,6 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
|
@ -183,51 +125,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.4"
|
||||
|
@ -388,7 +285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"headers-core",
|
||||
"http",
|
||||
|
@ -406,12 +303,6 @@ dependencies = [
|
|||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
|
@ -519,12 +410,6 @@ dependencies = [
|
|||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.8"
|
||||
|
@ -548,19 +433,17 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
|||
|
||||
[[package]]
|
||||
name = "limits_core"
|
||||
version = "3.0.1"
|
||||
version = "3.0.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "limits_srv"
|
||||
version = "3.1.0"
|
||||
version = "3.0.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"limits_core",
|
||||
"ron",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
|
@ -612,7 +495,7 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -759,18 +642,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ron"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
|
||||
dependencies = [
|
||||
"base64 0.21.2",
|
||||
"bitflags 2.6.0",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
|
@ -949,7 +820,7 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1105,12 +976,6 @@ version = "0.7.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
@ -1251,7 +1116,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1260,16 +1125,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1278,29 +1134,13 @@ version = "0.48.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.0",
|
||||
"windows_aarch64_msvc 0.48.0",
|
||||
"windows_i686_gnu 0.48.0",
|
||||
"windows_i686_msvc 0.48.0",
|
||||
"windows_x86_64_gnu 0.48.0",
|
||||
"windows_x86_64_gnullvm 0.48.0",
|
||||
"windows_x86_64_msvc 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1309,86 +1149,38 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "limits_srv"
|
||||
version = "3.1.0"
|
||||
version = "3.0.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -10,7 +10,5 @@ limits_core = { version = "3.0.0", path = "../limits_core" }
|
|||
chrono = { version = "0.4" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
ron = "0.8"
|
||||
warp = { version = "0.3" }
|
||||
tokio = { version = "1.22", features = ["macros", "rt", "rt-multi-thread"] }
|
||||
clap = { version = "4", features = ["derive", "std", "color"], default-features = false }
|
||||
|
|
|
@ -603,7 +603,7 @@
|
|||
"experiments": false,
|
||||
"quirks": [
|
||||
"pp_dpm_fclk-reversed",
|
||||
"pp_dpm_fclk-static"
|
||||
"pp_dpm_fclk-not-updated-on-LCD"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -867,8 +867,9 @@
|
|||
"extras": {
|
||||
"experiments": false,
|
||||
"quirks": [
|
||||
"clock-autodetect",
|
||||
"pp_dpm_fclk-reversed"
|
||||
"pp_dpm_fclk-reversed",
|
||||
"pp_dpm_fclk-not-updated-on-LCD",
|
||||
"clock-autodetect"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
use clap::Parser;
|
||||
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Cli {
|
||||
/// Path to folder containing pt_limits.json and pt_limits_v2.json
|
||||
#[arg(short, long, default_value = "./")]
|
||||
pub limits: std::path::PathBuf,
|
||||
|
||||
/// Server port
|
||||
#[arg(short, long, default_value_t = 8080)]
|
||||
pub port: u16,
|
||||
}
|
||||
|
||||
impl Cli {
|
||||
pub fn get() -> Self {
|
||||
Self::parse()
|
||||
}
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
mod cli;
|
||||
|
||||
use std::sync::atomic::{Ordering, AtomicU64, AtomicI64};
|
||||
use std::sync::{RwLock, Arc};
|
||||
|
||||
|
@ -75,35 +73,26 @@ pub async fn recovery(reject: warp::Rejection) -> Result<impl warp::Reply, warp:
|
|||
#[tokio::main]
|
||||
async fn main() {
|
||||
START_TIME.store(chrono::Utc::now().timestamp(), Ordering::Relaxed);
|
||||
let args = cli::Cli::get();
|
||||
let file = std::fs::File::open(args.limits.join("pt_limits.json")).expect("Failed to read limits file");
|
||||
let file = std::fs::File::open("./pt_limits.json").expect("Failed to read limits file");
|
||||
let limits: limits_core::json::Base = serde_json::from_reader(file).expect("Failed to parse limits file");
|
||||
assert!(limits.refresh.is_some(), "`refresh` cannot be null, since it will brick future refreshes");
|
||||
|
||||
let file = std::fs::File::open(args.limits.join("pt_limits_v2.json")).expect("Failed to read limits_v2 file");
|
||||
let file = std::fs::File::open("./pt_limits_v2.json").expect("Failed to read limits file");
|
||||
let limits_v2: limits_core::json_v2::Base = serde_json::from_reader(file).expect("Failed to parse limits file");
|
||||
assert!(limits_v2.refresh.is_some(), "`refresh` cannot be null, since it will brick future refreshes");
|
||||
|
||||
warp::serve(routes(Arc::new(RwLock::new(limits)), Arc::new(RwLock::new(limits_v2))))
|
||||
.run(([0, 0, 0, 0], args.port))
|
||||
.run(([0, 0, 0, 0], 8080))
|
||||
.await;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
fn ron_pretty_config() -> ron::ser::PrettyConfig {
|
||||
ron::ser::PrettyConfig::default()
|
||||
.struct_names(true)
|
||||
.compact_arrays(true)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generate_default_pt_limits() {
|
||||
let limits = limits_core::json::Base::default();
|
||||
let output_file = std::fs::File::create("./pt_limits.json").unwrap();
|
||||
serde_json::to_writer_pretty(output_file, &limits).unwrap();
|
||||
let output_file = std::fs::File::create("./pt_limits.ron").unwrap();
|
||||
ron::ser::to_writer_pretty(output_file, &limits, ron_pretty_config()).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -111,7 +100,5 @@ mod test {
|
|||
let limits = limits_core::json_v2::Base::default();
|
||||
let output_file = std::fs::File::create("./pt_limits_v2.json").unwrap();
|
||||
serde_json::to_writer_pretty(output_file, &limits).unwrap();
|
||||
let output_file = std::fs::File::create("./pt_limits_v2.ron").unwrap();
|
||||
ron::ser::to_writer_pretty(output_file, &limits, ron_pretty_config()).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,6 @@ pub enum DriverJson {
|
|||
Generic,
|
||||
#[serde(rename = "generic-amd")]
|
||||
GenericAMD,
|
||||
#[serde(rename = "rog-ally")]
|
||||
ROGAlly,
|
||||
#[serde(rename = "msi-claw")]
|
||||
MSIClaw,
|
||||
#[serde(rename = "unknown")]
|
||||
Unknown,
|
||||
#[default]
|
||||
|
|
|
@ -138,20 +138,6 @@ pub fn auto_detect0(
|
|||
)
|
||||
.variant(super::super::steam_deck::Model::OLED),
|
||||
),
|
||||
CpuLimitType::ROGAlly => Box::new(
|
||||
crate::settings::rog_ally::Cpus::from_json_and_limits(
|
||||
settings.cpus.clone(),
|
||||
settings.version,
|
||||
relevant_limits.cpu.limits,
|
||||
)
|
||||
),
|
||||
CpuLimitType::MSIClaw => Box::new(
|
||||
crate::settings::msi_claw::Cpus::from_json_and_limits(
|
||||
settings.cpus.clone(),
|
||||
settings.version,
|
||||
relevant_limits.cpu.limits,
|
||||
)
|
||||
),
|
||||
CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::<
|
||||
crate::settings::generic::Cpu,
|
||||
>::from_json_and_limits(
|
||||
|
@ -199,20 +185,6 @@ pub fn auto_detect0(
|
|||
)
|
||||
.variant(super::super::steam_deck::Model::OLED),
|
||||
),
|
||||
GpuLimitType::ROGAlly => Box::new(
|
||||
crate::settings::rog_ally::Gpu::from_json_and_limits(
|
||||
settings.gpu.clone(),
|
||||
settings.version,
|
||||
relevant_limits.gpu.limits,
|
||||
)
|
||||
),
|
||||
GpuLimitType::MSIClaw => Box::new(
|
||||
crate::settings::msi_claw::Gpu::from_json_and_limits(
|
||||
settings.gpu.clone(),
|
||||
settings.version,
|
||||
relevant_limits.gpu.limits,
|
||||
)
|
||||
),
|
||||
GpuLimitType::Generic => {
|
||||
Box::new(crate::settings::generic::Gpu::from_json_and_limits(
|
||||
settings.gpu.clone(),
|
||||
|
@ -298,12 +270,6 @@ pub fn auto_detect0(
|
|||
crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits)
|
||||
.variant(super::super::steam_deck::Model::OLED),
|
||||
),
|
||||
CpuLimitType::ROGAlly => Box::new(
|
||||
crate::settings::rog_ally::Cpus::from_limits(relevant_limits.cpu.limits)
|
||||
),
|
||||
CpuLimitType::MSIClaw => Box::new(
|
||||
crate::settings::msi_claw::Cpus::from_limits(relevant_limits.cpu.limits)
|
||||
),
|
||||
CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::<
|
||||
crate::settings::generic::Cpu,
|
||||
>::from_limits(
|
||||
|
@ -328,12 +294,6 @@ pub fn auto_detect0(
|
|||
crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits)
|
||||
.variant(super::super::steam_deck::Model::OLED),
|
||||
),
|
||||
GpuLimitType::ROGAlly => Box::new(
|
||||
crate::settings::rog_ally::Gpu::from_limits(relevant_limits.gpu.limits)
|
||||
),
|
||||
GpuLimitType::MSIClaw => Box::new(
|
||||
crate::settings::msi_claw::Gpu::from_limits(relevant_limits.gpu.limits)
|
||||
),
|
||||
GpuLimitType::Generic => Box::new(crate::settings::generic::Gpu::from_limits(
|
||||
relevant_limits.gpu.limits,
|
||||
)),
|
||||
|
|
|
@ -272,11 +272,11 @@ impl TCpu for Cpu {
|
|||
});
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
log::debug!(
|
||||
"dev_mode_Cpu::get_clock_limits(self) -> {:?}",
|
||||
self.clock_limits.as_ref()
|
||||
);
|
||||
self.clock_limits.clone()
|
||||
self.clock_limits.as_ref()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,12 +188,12 @@ impl TGpu for Gpu {
|
|||
});
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
log::debug!(
|
||||
"dev_mode_Gpu::get_clock_limits(self) -> {:?}",
|
||||
self.clock_limits.as_ref()
|
||||
);
|
||||
self.clock_limits.clone()
|
||||
self.clock_limits.as_ref()
|
||||
}
|
||||
|
||||
fn memory_clock(&mut self, speed: Option<u64>) {
|
||||
|
|
|
@ -37,9 +37,7 @@ pub fn maybe_do_button() {
|
|||
match super::auto_detect_provider() {
|
||||
DriverJson::SteamDeck | DriverJson::SteamDeckOLED => {
|
||||
crate::settings::steam_deck::flash_led();
|
||||
},
|
||||
DriverJson::ROGAlly => log::info!("Roggle boggle smoggle flollop"),
|
||||
DriverJson::MSIClaw => log::warn!("My condolences"),
|
||||
}
|
||||
DriverJson::Generic | DriverJson::GenericAMD => {
|
||||
log::warn!("You need to come up with something fun on generic")
|
||||
}
|
||||
|
|
|
@ -441,8 +441,8 @@ impl TCpu for Cpu {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.clock_limits.clone()
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
self.clock_limits.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -303,8 +303,8 @@ impl TGpu for Gpu {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.clock_limits.clone()
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
self.clock_limits.as_ref()
|
||||
}
|
||||
|
||||
fn memory_clock(&mut self, _speed: Option<u64>) {}
|
||||
|
|
|
@ -149,7 +149,7 @@ impl TCpu for Cpu {
|
|||
// TODO: support this
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
self.generic.get_clock_limits()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use libryzenadj::RyzenAdj;
|
||||
use libryzenadj_alt::RyzenAdj;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::persist::GpuJson;
|
||||
|
@ -22,9 +22,9 @@ fn msg_or_err<D: std::fmt::Display, E: std::fmt::Display>(
|
|||
fn log_capabilities(ryzenadj: &RyzenAdj) {
|
||||
log::info!(
|
||||
"RyzenAdj v{}.{}.{}",
|
||||
libryzenadj::libryzenadj_sys::RYZENADJ_REVISION_VER,
|
||||
libryzenadj::libryzenadj_sys::RYZENADJ_MAJOR_VER,
|
||||
libryzenadj::libryzenadj_sys::RYZENADJ_MINIOR_VER
|
||||
libryzenadj_alt::libryzenadj_sys::RYZENADJ_REVISION_VER,
|
||||
libryzenadj_alt::libryzenadj_sys::RYZENADJ_MAJOR_VER,
|
||||
libryzenadj_alt::libryzenadj_sys::RYZENADJ_MINIOR_VER
|
||||
);
|
||||
#[cfg(feature = "experimental")]
|
||||
if let Some(x) = ryzenadj.get_init_table_err() {
|
||||
|
@ -368,7 +368,7 @@ impl TGpu for Gpu {
|
|||
self.generic.clock_limits(limits)
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
self.generic.get_clock_limits()
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ pub mod generic;
|
|||
pub mod generic_amd;
|
||||
pub mod steam_deck;
|
||||
pub mod unknown;
|
||||
pub mod rog_ally;
|
||||
pub mod msi_claw;
|
||||
|
||||
pub use detect::{
|
||||
auto_detect0, auto_detect_provider, get_dev_messages,
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
use crate::persist::CpuJson;
|
||||
use crate::settings::generic::{Cpu as GenericCpu, Cpus as GenericCpus, FromGenericCpuInfo};
|
||||
use crate::settings::MinMax;
|
||||
use crate::settings::{OnResume, OnSet, SettingError};
|
||||
use crate::settings::{ProviderBuilder, TCpu, TCpus};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Cpus {
|
||||
generic: GenericCpus<Cpu>,
|
||||
}
|
||||
|
||||
impl ProviderBuilder<Vec<CpuJson>, limits_core::json_v2::GenericCpusLimit> for Cpus {
|
||||
fn from_limits(limits: limits_core::json_v2::GenericCpusLimit) -> Self {
|
||||
Self {
|
||||
generic: GenericCpus::from_limits(limits),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_json_and_limits(
|
||||
other: Vec<CpuJson>,
|
||||
version: u64,
|
||||
limits: limits_core::json_v2::GenericCpusLimit,
|
||||
) -> Self {
|
||||
Self {
|
||||
generic: GenericCpus::from_json_and_limits(other, version, limits),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OnResume for Cpus {
|
||||
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_resume()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl OnSet for Cpus {
|
||||
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_set()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnPowerEvent for Cpus {}
|
||||
|
||||
impl crate::settings::OnLoad for Cpus {
|
||||
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnUnload for Cpus {
|
||||
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl TCpus for Cpus {
|
||||
fn limits(&self) -> crate::api::CpusLimits {
|
||||
self.generic.limits()
|
||||
}
|
||||
|
||||
fn json(&self) -> Vec<crate::persist::CpuJson> {
|
||||
self.generic.json() // TODO
|
||||
}
|
||||
|
||||
fn cpus(&mut self) -> Vec<&mut dyn TCpu> {
|
||||
self.generic.cpus() // TODO
|
||||
}
|
||||
|
||||
fn len(&self) -> usize {
|
||||
self.generic.len() // TODO
|
||||
}
|
||||
|
||||
fn smt(&mut self) -> &'_ mut bool {
|
||||
self.generic.smt()
|
||||
}
|
||||
|
||||
fn provider(&self) -> crate::persist::DriverJson {
|
||||
crate::persist::DriverJson::GenericAMD
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Cpu {
|
||||
generic: GenericCpu,
|
||||
}
|
||||
|
||||
impl FromGenericCpuInfo for Cpu {
|
||||
fn from_limits(cpu_index: usize, limits: limits_core::json_v2::GenericCpuLimit) -> Self {
|
||||
let gen = GenericCpu::from_limits(cpu_index, limits.clone());
|
||||
Self { generic: gen }
|
||||
}
|
||||
|
||||
fn from_json_and_limits(
|
||||
other: CpuJson,
|
||||
version: u64,
|
||||
cpu_index: usize,
|
||||
limits: limits_core::json_v2::GenericCpuLimit,
|
||||
) -> Self {
|
||||
let gen = GenericCpu::from_json_and_limits(other, version, cpu_index, limits);
|
||||
Self { generic: gen }
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<GenericCpu> for Cpu {
|
||||
fn as_ref(&self) -> &GenericCpu {
|
||||
&self.generic
|
||||
}
|
||||
}
|
||||
|
||||
impl AsMut<GenericCpu> for Cpu {
|
||||
fn as_mut(&mut self) -> &mut GenericCpu {
|
||||
&mut self.generic
|
||||
}
|
||||
}
|
||||
|
||||
impl OnResume for Cpu {
|
||||
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_resume()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl OnSet for Cpu {
|
||||
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_set()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnPowerEvent for Cpu {}
|
||||
|
||||
impl TCpu for Cpu {
|
||||
fn online(&mut self) -> &mut bool {
|
||||
self.generic.online()
|
||||
}
|
||||
|
||||
fn governor(&mut self, governor: String) {
|
||||
self.generic.governor(governor)
|
||||
}
|
||||
|
||||
fn get_governor(&self) -> &'_ str {
|
||||
self.generic.get_governor()
|
||||
}
|
||||
|
||||
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {
|
||||
//self.generic.clock_limits(limits)
|
||||
// TODO: support this
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.generic.get_clock_limits()
|
||||
}
|
||||
}
|
|
@ -1,287 +0,0 @@
|
|||
use limits_core::json_v2::GenericGpuLimit;
|
||||
//use sysfuss::{capability::attributes, BasicEntityPath, SysEntity};
|
||||
//use procbox::gpu::IntelGpu; // TODO
|
||||
|
||||
use crate::api::RangeLimit;
|
||||
use crate::persist::{GpuJson, MinMaxJson};
|
||||
use crate::settings::{min_max_from_json, MinMax};
|
||||
use crate::settings::{OnResume, OnSet, SettingError};
|
||||
use crate::settings::{ProviderBuilder, TGpu};
|
||||
|
||||
//#[derive(Clone)]
|
||||
pub struct Gpu {
|
||||
//gpu_impl: IntelGpu,
|
||||
settings: GpuJson,
|
||||
limits: GenericGpuLimit,
|
||||
}
|
||||
|
||||
impl Gpu {
|
||||
/*fn find_badgpu(root: Option<impl AsRef<std::path::Path>>) -> IntelGpu {
|
||||
let root = crate::settings::util::root_or_default_sysfs(root);
|
||||
let ent_path = match root.class(
|
||||
"drm",
|
||||
attributes(
|
||||
crate::settings::util::CARD_NEEDS
|
||||
.into_iter()
|
||||
.map(|s| s.to_string()),
|
||||
),
|
||||
) {
|
||||
Ok(iter) => {
|
||||
let card = iter
|
||||
.filter(|ent| if let Ok(name) = ent.name() { name.starts_with("card")} else { false })
|
||||
//.filter(|ent| super::util::card_also_has(ent, CARD_EXTENSIONS))
|
||||
.next()
|
||||
.unwrap_or_else(|| {
|
||||
log::error!("Failed to find ROG Ally gpu drm in sysfs (no results), using naive fallback");
|
||||
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
|
||||
});
|
||||
log::info!(
|
||||
"Found ROG Ally gpu drm in sysfs: {}",
|
||||
card.as_ref().display()
|
||||
);
|
||||
card
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Failed to find ROG Ally gpu drm in sysfs ({}), using naive fallback",
|
||||
e
|
||||
);
|
||||
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
|
||||
}
|
||||
};
|
||||
IntelGpu::new(ent_path)
|
||||
}*/
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Gpu {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("msi_claw::Gpu")
|
||||
.field("limits", &self.limits)
|
||||
//.field("settings", &self.settings)
|
||||
//.field("gpu_impl", &self.gpu_impl)
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
|
||||
fn from_json_and_limits(persistent: GpuJson, _version: u64, limits: GenericGpuLimit) -> Self {
|
||||
Self {
|
||||
//gpu_impl: Self::find_badgpu(persistent.root.clone()),
|
||||
settings: persistent,
|
||||
limits,
|
||||
}
|
||||
}
|
||||
|
||||
fn from_limits(limits: GenericGpuLimit) -> Self {
|
||||
Self {
|
||||
//gpu_impl: Self::find_badgpu(None::<&'static str>),
|
||||
settings: GpuJson::default(),
|
||||
limits,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<GpuJson> for Gpu {
|
||||
#[inline]
|
||||
fn into(self) -> GpuJson {
|
||||
self.settings
|
||||
}
|
||||
}
|
||||
|
||||
impl OnSet for Gpu {
|
||||
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
// TODO
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl OnResume for Gpu {
|
||||
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
|
||||
// TODO
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnPowerEvent for Gpu {}
|
||||
|
||||
impl crate::settings::OnLoad for Gpu {
|
||||
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnUnload for Gpu {
|
||||
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl TGpu for Gpu {
|
||||
fn limits(&self) -> crate::api::GpuLimits {
|
||||
crate::api::GpuLimits {
|
||||
fast_ppt_limits: self
|
||||
.limits
|
||||
.fast_ppt
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
|
||||
.map(|mut x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x.min /= ppt_divisor;
|
||||
x.max /= ppt_divisor;
|
||||
x
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
fast_ppt_default: {
|
||||
let def = self
|
||||
.limits
|
||||
.fast_ppt_default
|
||||
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
|
||||
.unwrap_or(15);
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
def / ppt_divisor
|
||||
} else {
|
||||
def
|
||||
}
|
||||
},
|
||||
slow_ppt_limits: self
|
||||
.limits
|
||||
.slow_ppt
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
|
||||
.map(|mut x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x.min /= ppt_divisor;
|
||||
x.max /= ppt_divisor;
|
||||
x
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
slow_ppt_default: {
|
||||
let def = self
|
||||
.limits
|
||||
.slow_ppt_default
|
||||
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
|
||||
.unwrap_or(15);
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
def / ppt_divisor
|
||||
} else {
|
||||
def
|
||||
}
|
||||
},
|
||||
ppt_step: self.limits.ppt_step.unwrap_or(1),
|
||||
tdp_limits: self
|
||||
.limits
|
||||
.tdp
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
|
||||
tdp_boost_limits: self
|
||||
.limits
|
||||
.tdp_boost
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
|
||||
tdp_step: self.limits.tdp_step.unwrap_or(42),
|
||||
clock_min_limits: self
|
||||
.limits
|
||||
.clock_min
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
|
||||
clock_max_limits: self
|
||||
.limits
|
||||
.clock_max
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
|
||||
clock_step: self.limits.clock_step.unwrap_or(100),
|
||||
memory_control: None,
|
||||
memory_step: 100,
|
||||
}
|
||||
}
|
||||
|
||||
fn json(&self) -> crate::persist::GpuJson {
|
||||
self.settings.clone()
|
||||
}
|
||||
|
||||
fn ppt(&mut self, fast: Option<u64>, slow: Option<u64>) {
|
||||
if let Some(fast_lims) = &self.limits.fast_ppt {
|
||||
self.settings.fast_ppt = fast
|
||||
.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x * ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
})
|
||||
.map(|x| {
|
||||
x.clamp(
|
||||
fast_lims.min.unwrap_or(0),
|
||||
fast_lims.max.unwrap_or(u64::MAX),
|
||||
)
|
||||
});
|
||||
}
|
||||
if let Some(slow_lims) = &self.limits.slow_ppt {
|
||||
self.settings.slow_ppt = slow
|
||||
.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x * ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
})
|
||||
.map(|x| {
|
||||
x.clamp(
|
||||
slow_lims.min.unwrap_or(0),
|
||||
slow_lims.max.unwrap_or(u64::MAX),
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn get_ppt(&self) -> (Option<u64>, Option<u64>) {
|
||||
(
|
||||
self.settings.fast_ppt.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x / ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
self.settings.slow_ppt.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x / ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
fn clock_limits(&mut self, limits: Option<MinMax<u64>>) {
|
||||
if let Some(clock_min) = &self.limits.clock_min {
|
||||
if let Some(clock_max) = &self.limits.clock_max {
|
||||
self.settings.clock_limits = limits.map(|x| {
|
||||
MinMaxJson {
|
||||
min: x.min.clamp(clock_min.min, clock_min.max),
|
||||
max: x.max.clamp(clock_max.max, clock_max.max)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.settings.clock_limits.clone().map(|mmj| min_max_from_json(mmj, 1))
|
||||
}
|
||||
|
||||
fn memory_clock(&mut self, _speed: Option<u64>) {}
|
||||
|
||||
fn get_memory_clock(&self) -> Option<u64> {
|
||||
None
|
||||
}
|
||||
|
||||
fn provider(&self) -> crate::persist::DriverJson {
|
||||
crate::persist::DriverJson::Generic
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
mod cpu;
|
||||
mod gpu;
|
||||
mod util;
|
||||
|
||||
pub use cpu::Cpus;
|
||||
pub use gpu::Gpu;
|
|
@ -1,155 +0,0 @@
|
|||
use crate::persist::CpuJson;
|
||||
use crate::settings::generic::{Cpu as GenericCpu, Cpus as GenericCpus, FromGenericCpuInfo};
|
||||
use crate::settings::MinMax;
|
||||
use crate::settings::{OnResume, OnSet, SettingError};
|
||||
use crate::settings::{ProviderBuilder, TCpu, TCpus};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Cpus {
|
||||
generic: GenericCpus<Cpu>,
|
||||
}
|
||||
|
||||
impl ProviderBuilder<Vec<CpuJson>, limits_core::json_v2::GenericCpusLimit> for Cpus {
|
||||
fn from_limits(limits: limits_core::json_v2::GenericCpusLimit) -> Self {
|
||||
Self {
|
||||
generic: GenericCpus::from_limits(limits),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_json_and_limits(
|
||||
other: Vec<CpuJson>,
|
||||
version: u64,
|
||||
limits: limits_core::json_v2::GenericCpusLimit,
|
||||
) -> Self {
|
||||
Self {
|
||||
generic: GenericCpus::from_json_and_limits(other, version, limits),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OnResume for Cpus {
|
||||
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_resume()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl OnSet for Cpus {
|
||||
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_set()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnPowerEvent for Cpus {}
|
||||
|
||||
impl crate::settings::OnLoad for Cpus {
|
||||
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnUnload for Cpus {
|
||||
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl TCpus for Cpus {
|
||||
fn limits(&self) -> crate::api::CpusLimits {
|
||||
self.generic.limits()
|
||||
}
|
||||
|
||||
fn json(&self) -> Vec<crate::persist::CpuJson> {
|
||||
self.generic.json() // TODO
|
||||
}
|
||||
|
||||
fn cpus(&mut self) -> Vec<&mut dyn TCpu> {
|
||||
self.generic.cpus() // TODO
|
||||
}
|
||||
|
||||
fn len(&self) -> usize {
|
||||
self.generic.len() // TODO
|
||||
}
|
||||
|
||||
fn smt(&mut self) -> &'_ mut bool {
|
||||
self.generic.smt()
|
||||
}
|
||||
|
||||
fn provider(&self) -> crate::persist::DriverJson {
|
||||
crate::persist::DriverJson::GenericAMD
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Cpu {
|
||||
generic: GenericCpu,
|
||||
}
|
||||
|
||||
impl FromGenericCpuInfo for Cpu {
|
||||
fn from_limits(cpu_index: usize, limits: limits_core::json_v2::GenericCpuLimit) -> Self {
|
||||
let gen = GenericCpu::from_limits(cpu_index, limits.clone());
|
||||
Self { generic: gen }
|
||||
}
|
||||
|
||||
fn from_json_and_limits(
|
||||
other: CpuJson,
|
||||
version: u64,
|
||||
cpu_index: usize,
|
||||
limits: limits_core::json_v2::GenericCpuLimit,
|
||||
) -> Self {
|
||||
let gen = GenericCpu::from_json_and_limits(other, version, cpu_index, limits);
|
||||
Self { generic: gen }
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<GenericCpu> for Cpu {
|
||||
fn as_ref(&self) -> &GenericCpu {
|
||||
&self.generic
|
||||
}
|
||||
}
|
||||
|
||||
impl AsMut<GenericCpu> for Cpu {
|
||||
fn as_mut(&mut self) -> &mut GenericCpu {
|
||||
&mut self.generic
|
||||
}
|
||||
}
|
||||
|
||||
impl OnResume for Cpu {
|
||||
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_resume()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl OnSet for Cpu {
|
||||
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
self.generic.on_set()
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnPowerEvent for Cpu {}
|
||||
|
||||
impl TCpu for Cpu {
|
||||
fn online(&mut self) -> &mut bool {
|
||||
self.generic.online()
|
||||
}
|
||||
|
||||
fn governor(&mut self, governor: String) {
|
||||
self.generic.governor(governor)
|
||||
}
|
||||
|
||||
fn get_governor(&self) -> &'_ str {
|
||||
self.generic.get_governor()
|
||||
}
|
||||
|
||||
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {
|
||||
//self.generic.clock_limits(limits)
|
||||
// TODO: support this
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.generic.get_clock_limits()
|
||||
}
|
||||
}
|
|
@ -1,286 +0,0 @@
|
|||
use limits_core::json_v2::GenericGpuLimit;
|
||||
use sysfuss::{capability::attributes, BasicEntityPath, SysEntity};
|
||||
use procbox::combo::AmdGpu;
|
||||
|
||||
use crate::api::RangeLimit;
|
||||
use crate::persist::{GpuJson, MinMaxJson};
|
||||
use crate::settings::{min_max_from_json, MinMax};
|
||||
use crate::settings::{OnResume, OnSet, SettingError};
|
||||
use crate::settings::{ProviderBuilder, TGpu};
|
||||
|
||||
//#[derive(Clone)]
|
||||
pub struct Gpu {
|
||||
gpu_impl: AmdGpu,
|
||||
settings: GpuJson,
|
||||
limits: GenericGpuLimit,
|
||||
}
|
||||
|
||||
impl Gpu {
|
||||
fn find_amdgpu(root: Option<impl AsRef<std::path::Path>>) -> AmdGpu {
|
||||
let root = crate::settings::util::root_or_default_sysfs(root);
|
||||
let ent_path = match root.class(
|
||||
"drm",
|
||||
attributes(
|
||||
crate::settings::util::CARD_NEEDS
|
||||
.into_iter()
|
||||
.map(|s| s.to_string()),
|
||||
),
|
||||
) {
|
||||
Ok(iter) => {
|
||||
let card = iter
|
||||
.filter(|ent| if let Ok(name) = ent.name() { name.starts_with("card")} else { false })
|
||||
//.filter(|ent| super::util::card_also_has(ent, CARD_EXTENSIONS))
|
||||
.next()
|
||||
.unwrap_or_else(|| {
|
||||
log::error!("Failed to find ROG Ally gpu drm in sysfs (no results), using naive fallback");
|
||||
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
|
||||
});
|
||||
log::info!(
|
||||
"Found ROG Ally gpu drm in sysfs: {}",
|
||||
card.as_ref().display()
|
||||
);
|
||||
card
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Failed to find ROG Ally gpu drm in sysfs ({}), using naive fallback",
|
||||
e
|
||||
);
|
||||
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
|
||||
}
|
||||
};
|
||||
AmdGpu::new(ent_path)
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for Gpu {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("rog_ally::Gpu")
|
||||
.field("limits", &self.limits)
|
||||
//.field("gpu_impl", &self.gpu_impl)
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
|
||||
fn from_json_and_limits(persistent: GpuJson, _version: u64, limits: GenericGpuLimit) -> Self {
|
||||
Self {
|
||||
gpu_impl: Self::find_amdgpu(persistent.root.clone()),
|
||||
settings: persistent,
|
||||
limits,
|
||||
}
|
||||
}
|
||||
|
||||
fn from_limits(limits: GenericGpuLimit) -> Self {
|
||||
Self {
|
||||
gpu_impl: Self::find_amdgpu(None::<&'static str>),
|
||||
settings: GpuJson::default(),
|
||||
limits,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<GpuJson> for Gpu {
|
||||
#[inline]
|
||||
fn into(self) -> GpuJson {
|
||||
self.settings
|
||||
}
|
||||
}
|
||||
|
||||
impl OnSet for Gpu {
|
||||
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
// TODO
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl OnResume for Gpu {
|
||||
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
|
||||
// TODO
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnPowerEvent for Gpu {}
|
||||
|
||||
impl crate::settings::OnLoad for Gpu {
|
||||
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::settings::OnUnload for Gpu {
|
||||
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl TGpu for Gpu {
|
||||
fn limits(&self) -> crate::api::GpuLimits {
|
||||
crate::api::GpuLimits {
|
||||
fast_ppt_limits: self
|
||||
.limits
|
||||
.fast_ppt
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
|
||||
.map(|mut x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x.min /= ppt_divisor;
|
||||
x.max /= ppt_divisor;
|
||||
x
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
fast_ppt_default: {
|
||||
let def = self
|
||||
.limits
|
||||
.fast_ppt_default
|
||||
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
|
||||
.unwrap_or(15);
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
def / ppt_divisor
|
||||
} else {
|
||||
def
|
||||
}
|
||||
},
|
||||
slow_ppt_limits: self
|
||||
.limits
|
||||
.slow_ppt
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
|
||||
.map(|mut x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x.min /= ppt_divisor;
|
||||
x.max /= ppt_divisor;
|
||||
x
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
slow_ppt_default: {
|
||||
let def = self
|
||||
.limits
|
||||
.slow_ppt_default
|
||||
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
|
||||
.unwrap_or(15);
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
def / ppt_divisor
|
||||
} else {
|
||||
def
|
||||
}
|
||||
},
|
||||
ppt_step: self.limits.ppt_step.unwrap_or(1),
|
||||
tdp_limits: self
|
||||
.limits
|
||||
.tdp
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
|
||||
tdp_boost_limits: self
|
||||
.limits
|
||||
.tdp_boost
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
|
||||
tdp_step: self.limits.tdp_step.unwrap_or(42),
|
||||
clock_min_limits: self
|
||||
.limits
|
||||
.clock_min
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
|
||||
clock_max_limits: self
|
||||
.limits
|
||||
.clock_max
|
||||
.clone()
|
||||
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
|
||||
clock_step: self.limits.clock_step.unwrap_or(100),
|
||||
memory_control: None,
|
||||
memory_step: 100,
|
||||
}
|
||||
}
|
||||
|
||||
fn json(&self) -> crate::persist::GpuJson {
|
||||
self.settings.clone()
|
||||
}
|
||||
|
||||
fn ppt(&mut self, fast: Option<u64>, slow: Option<u64>) {
|
||||
if let Some(fast_lims) = &self.limits.fast_ppt {
|
||||
self.settings.fast_ppt = fast
|
||||
.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x * ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
})
|
||||
.map(|x| {
|
||||
x.clamp(
|
||||
fast_lims.min.unwrap_or(0),
|
||||
fast_lims.max.unwrap_or(u64::MAX),
|
||||
)
|
||||
});
|
||||
}
|
||||
if let Some(slow_lims) = &self.limits.slow_ppt {
|
||||
self.settings.slow_ppt = slow
|
||||
.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x * ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
})
|
||||
.map(|x| {
|
||||
x.clamp(
|
||||
slow_lims.min.unwrap_or(0),
|
||||
slow_lims.max.unwrap_or(u64::MAX),
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn get_ppt(&self) -> (Option<u64>, Option<u64>) {
|
||||
(
|
||||
self.settings.fast_ppt.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x / ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
self.settings.slow_ppt.map(|x| {
|
||||
if let Some(ppt_divisor) = self.limits.ppt_divisor {
|
||||
x / ppt_divisor
|
||||
} else {
|
||||
x
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
fn clock_limits(&mut self, limits: Option<MinMax<u64>>) {
|
||||
if let Some(clock_min) = &self.limits.clock_min {
|
||||
if let Some(clock_max) = &self.limits.clock_max {
|
||||
self.settings.clock_limits = limits.map(|x| {
|
||||
MinMaxJson {
|
||||
min: x.min.clamp(clock_min.min, clock_min.max),
|
||||
max: x.max.clamp(clock_max.max, clock_max.max)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.settings.clock_limits.clone().map(|mmj| min_max_from_json(mmj, 1))
|
||||
}
|
||||
|
||||
fn memory_clock(&mut self, _speed: Option<u64>) {}
|
||||
|
||||
fn get_memory_clock(&self) -> Option<u64> {
|
||||
None
|
||||
}
|
||||
|
||||
fn provider(&self) -> crate::persist::DriverJson {
|
||||
crate::persist::DriverJson::Generic
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
mod cpu;
|
||||
mod gpu;
|
||||
mod util;
|
||||
|
||||
pub use cpu::Cpus;
|
||||
pub use gpu::Gpu;
|
|
@ -723,8 +723,8 @@ impl TCpu for Cpu {
|
|||
self.clock_limits = limits;
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.clock_limits.clone()
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
self.clock_limits.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -717,8 +717,8 @@ impl TGpu for Gpu {
|
|||
self.clock_limits = limits;
|
||||
}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
self.clock_limits.clone()
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
self.clock_limits.as_ref()
|
||||
}
|
||||
|
||||
fn memory_clock(&mut self, speed: Option<u64>) {
|
||||
|
|
|
@ -65,7 +65,7 @@ pub trait TGpu: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Se
|
|||
|
||||
fn clock_limits(&mut self, limits: Option<MinMax<u64>>);
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>>;
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>>;
|
||||
|
||||
fn memory_clock(&mut self, speed: Option<u64>);
|
||||
|
||||
|
@ -101,7 +101,7 @@ pub trait TCpu: Debug + Send {
|
|||
|
||||
fn clock_limits(&mut self, limits: Option<MinMax<u64>>);
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>>;
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>>;
|
||||
}
|
||||
|
||||
pub trait TGeneral: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Send {
|
||||
|
|
|
@ -356,7 +356,7 @@ impl TCpu for Cpu {
|
|||
|
||||
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ impl TGpu for Gpu {
|
|||
|
||||
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {}
|
||||
|
||||
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
|
||||
fn get_clock_limits(&self) -> Option<&MinMax<u64>> {
|
||||
None
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ mod test {
|
|||
online: status,
|
||||
clock_limits: None,
|
||||
governor: "schedutil".to_owned(),
|
||||
root: Some("/".to_owned()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "PowerTools",
|
||||
"version": "2.0.3-alpha1",
|
||||
"version": "2.0.3",
|
||||
"description": "Power tweaks for power users",
|
||||
"scripts": {
|
||||
"build": "shx rm -rf dist && rollup -c",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "PowerTools",
|
||||
"author": "NGnius",
|
||||
"flags": ["root", "_debug", "global-dfl"],
|
||||
"flags": ["root", "global-dfl"],
|
||||
"publish": {
|
||||
"discord_id": "106537989684887552",
|
||||
"description": "Power tweaks for power users",
|
||||
|
|
Loading…
Reference in a new issue