Compare commits

...

10 Commits

7 changed files with 196 additions and 30 deletions

View File

@ -49,3 +49,4 @@ List of other pages in this repo
- [Main Issues](docs/Main-issues.md)
- [Quirks](docs/Quirks.md)
- [Scripts](scripts/)
- [eGPU](docs/eGPU.md)

View File

@ -66,7 +66,14 @@ sudo modprobe -r goodix
sudo modprobe goodix
```
The touchscreen then starts working, it keeps working after sleep/suspend as well. But you will need to run these commands after every reboot.
The touchscreen then starts working, it keeps working after sleep/suspend as well.
This can be automated using a file in `/etc/modprobe.d` that performs this automatically. (Thanks [rj_b](https://www.reddit.com/user/rj_b/))
To automate, create the file `/etc/modprobe.d/win3-goodix.conf` with the following content:
```
install goodix /sbin/modprobe --ignore-install goodix ; /sbin/modprobe -r --ignore-install goodix ; /sbin/modprobe --ignore-install goodix
```
# Rotate GDM (Sign-in screen)

View File

@ -17,3 +17,16 @@ The vast majority of software can handle you unplugging your gamepad and pluggin
## Startup / Shutdown takes a while
For some reason the GPD Win 3 takes almost a minute to shut down or start up. Not sure if it's because Ubuntu hangs at some step or similar. Haven't cared too much since suspending and waking from sleep is still relatively fast.
## Speaker often "pops" when starting audio playback
This is a hardware "issue". The speakers in the Win 3 simply make a pop when they receive a new signal and get activated.
I only encountered this issue on Arch Linux for some reason, not on Ubuntu.
To workaround this, edit `/etc/pulse/default.pa` and comment out the following line:
```
load-module module-suspend-on-idle
```
When you comment out that line, Pulseaudio should no longer put the sound card into standby when no audio has been played for a while, and instead keeps it active. This might cause a slight increase in power consumption but should get rid of the pops when starting/stopping playback.

133
docs/eGPU.md Normal file
View File

@ -0,0 +1,133 @@
# eGPU
Tested with a Razer Core X Mercury and an AMD RX 580 4GB and RX 6700 XT 12GB.
eGPUs are mostly plug and play. Plug them in and use DRI_PRIME=1 to offload graphics to the eGPU, maybe a reboot is needed.
However, to optimize performance, especially over a Thunderbolt link there's two things you'll want to fix:
1. Run your X server directly on the eGPU to minimize the amount of data passed back and forth
2. Ensure your AMD eGPU is running at its peak speed (All AMD eGPU readers should check this part)
## X configuration
To make the X server run on the eGPU, you will need to put a little snippet in /etc/X11/xorg.conf.d telling it which GPU to use.
First you will need the PCI-E address of your eGPU. You can find this by running `sudo lspci` in a terminal (sudo not always needed).
My GPU shows up as this line:
```
06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 (rev c5)
```
This means `06:00.0` is its PCI-E address. Be aware that lspci displays in hexadecimal, while you need decimal, so you might need to convert. For example if lspci shows `0a:00.0` that would be converted to `10:00.0`. The [Arch wiki](https://wiki.archlinux.org/title/External_GPU) is a great resource for further details on setting up eGPUs.
You will now need to create the file `/etc/X11/xorg.conf.d/11-egpu.conf` and add the following content for an AMD GPU:
```
Section "Device"
Identifier "Device0"
Driver "amdgpu"
BusID "PCI:06:00:0" # Replace with your PCI-E id
EndSection
Section "Module"
Load "modesetting"
EndSection
```
And the following for an Nvidia GPU:
```
Section "Device"
Identifier "Device0"
Driver "nvidia"
BusID "PCI:06:00:0" # Replace with your PCI-E id
Option "AllowExternalGpus" "True"
EndSection
Section "Module"
Load "modesetting"
EndSection
```
When you start X, it will run exclusively on the eGPU for max performance. X will only start with the eGPU present, to use it handheld you will need to remove or comment out this config file. Unfortunately I do not have a script for this currently, but there are plenty of others online. Alternatively do what I do, only use X when connected to the eGPU, and use Wayland otherwise. In the case of both KDE and Gnome, this can be selected at their login screen.
The eGPU can typically be used under Wayland with no extra configuration by adding `DRI_PRIME=1` before the application you're running. But I've found no way to make Wayland (Gnome/KDE) run entirely on the eGPU
## Ensuring your AMD eGPU runs at its peak speed
eGPUs might seem to work well enough out of the box (except for X reconfiguratoion). But some keen eyed users might notice that their GPU could be running at PCI-E 1.1 speeds instead of PCI-E 3.0 speeds.
The easiest way to check is by running `sudo lspci -vv` and finding your eGPU enclosure (or eGPU itself) in the huge list. Then check the `LnkSta` field to see the speed it is currently running at. For example, here is my eGPU enclosure:
```
03:01.0 PCI bridge: Intel Corporation JHL6340 Thunderbolt 3 Bridge (C step) [Alpine Ridge 2C 2016] (rev 02) (prog-if 00 [Normal decode])
[Shortened]
LnkCap: Port #1, Speed 8GT/s, Width x4, ASPM L0s L1, Exit Latency L0s <2us, L1 <4us
ClockPM- Surprise- LLActRep+ BwNot+ ASPMOptComp+
LnkCtl: ASPM L1 Enabled; Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s (downgraded), Width x4 (ok)
TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
[Shortened]
```
As you can see, `LnkSta` lists a speed of `2.5 GT/s`, followed by a "(downgraded)". This value should say 8 GT/s.
2.5 GT/s = PCI-E 1.x
5 GT/s = PCI-E 2.x
8 GT/s = PCI-E 3.x
This seems to be an [issue](https://gitlab.freedesktop.org/drm/amd/-/issues/1447) with the amdgpu driver and how it detects Thunderbolt links.
Whether or not this matters, depends on the games you play. Some games barely seem to care. Others exhibit weird or extreme performance issues, often console ports which do a lot of communication between CPU and GPU (Because consoles typically have shared memory for their CPU and GPU). AC: Valhalla and Horizon Zero Dawn are examples of games which tend to perform unbelievably bad on eGPUs, and this does not help. In my case, fixing this brought HZD from a 5fps catastrophe to an almost playable 20fps, and AC: Valhalla from a very stuttery and bad 20fps, to a far less stuttery and rather playable 30fps. Meanwhile I saw absolutely zero difference in games like Scarlet Nexus or Valheim.
To fix this, create a file named `/etc/modprobe.d/amd-pcie-fix.conf` with the following content:
```
options amdgpu pcie_gen_cap=0x40000
```
`pcie_gen_cap=0x40000` will forcibly tell the amdgpu driver that it should be capable of running at PCI-E 3.0 speeds. Other values are listed [here](https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/amd/include/amd_pcie.h). You might have to use another one depending on your setup and what it's really capable of. For example, to force PCI-E 2.0 speeds, use `0x20000`.
You can now re-run the lspci command and check it's output:
```
03:01.0 PCI bridge: Intel Corporation JHL6340 Thunderbolt 3 Bridge (C step) [Alpine Ridge 2C 2016] (rev 02) (prog-if 00 [Normal decode])
[Shortened]
LnkCap: Port #1, Speed 8GT/s, Width x4, ASPM L0s L1, Exit Latency L0s <2us, L1 <4us
ClockPM- Surprise- LLActRep+ BwNot+ ASPMOptComp+
LnkCtl: ASPM L1 Enabled; Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 8GT/s (ok), Width x4 (ok)
TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
[Shortened]
```
If it reports PCI-E 3.0 speeds. You are now good to go, and you should hopefully see at least a slight performance improvement in games that don't collaborate well with eGPUs.
Since this is a driver issue, it might be specific to certain GPU models, and I am unsure if similar issues can happen to Nvidia GPUs, as I only have AMD GPUs to test with.
Thank you to [raimu](https://miniwa.moe/users/raimu) for helping with finding a more permanent fix for this.
Previously I had to do a bunch of tricks and hacks on every boot, which I will list here for legacy purposes:
1. Make sure the device is off, and the eGPU unplugged.
2. Boot the device
3. On the GRUB menu, tell it to enter UEFI firmware settings, the device will reboot and enter BIOS/UEFI
4. Hit Save changes and Exit without actually changing anything.
5. Now boot normally to GDM
6. Start a Wayland session
7. Plug in eGPU
8. Display will break and go black
9. Hit Ctrl+Alt+Del to sign out "blind" from Gnome
10. When GDM reappears it should only show on the device's screen
11. Ctrl+Alt+F<something> to change to a tty
12. sudo systemctl restart gdm
13. GDM should restart and show on both displays
14. Start an Xorg session with an X config making use of the eGPU
15. The eGPU now runs at PCI-E 3.0 speeds and x4 until the next reboot
It's unclear why this works. Maybe because it makes the amdgpu driver bug out, because Gnome initilizes the GPU, or entering UEFI offloads something to hardware rather than software. Perhaps all of the above.

View File

@ -133,3 +133,13 @@ To use it, open your `~/.bashrc` file and add the following line:
```
source gpd-prompt
```
### Disabling sudo password
If you use your GPD Win 3 as only a gaming device, and security isn't a huge concern. Disabling the password requirement for sudo might be an idea. To do this, run the command `sudo visudo` and ensure the following line is in the file:
```
username ALL=(ALL) NOPASSWD:ALL
```
Replacing `username` with your own username. This will allow sudo commands (including the ones used by scripts) to run without asking for a password.

View File

@ -1,2 +1,2 @@
#!/bin/bash
zenity --password --title="sudo Authentication"
zenity --password --title="GPD sudo elevation"

View File

@ -8,6 +8,8 @@ pl2_path="${rapl_path}/constraint_1_power_limit_uw"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
gui_name="GPD TDP Manager"
gui_options=""
tdp_min=5
tdp_max=35
# Set up help text
help_text="${command_name}: GDP Win 3 TDP management script
@ -171,9 +173,9 @@ check_tdp () {
local pl1=$(uw_to_w $(get_pl 1))
local pl2=$(uw_to_w $(get_pl 2))
echo "PL1 is ${pl1}W" # Placeholder
echo "PL1 is ${pl1}W"
if ( is_detailed $@ ); then
echo "PL2 is ${pl2}W" # Placeholder
echo "PL2 is ${pl2}W"
fi
elif ( is_help $@ ); then
@ -198,9 +200,9 @@ set_tdp () {
exit
fi
if [ $1 -lt 5 ] || [ $1 -gt 30 ]; then
echo "TDP too high or low, should be between 5W and 30W"
echo "This is a sanity limit to prevent you from throttling to a near unusable state"
if [ $1 -lt $tdp_min ] || [ $1 -gt $tdp_max ]; then
echo "TDP too high or low, should be between ${tdp_min}W and ${tdp_max}W"
echo "This is mostly a sanity limit to prevent you from throttling to a near unusable state"
else
#PL1
local watts=$1
@ -235,7 +237,7 @@ gui_handler() {
# Clear variables
gui_tdp=""
# Contains some ugly hacks to "widen" the entries for the small GPD screen, might tweak later
gui_action=$(zenity --list --title="${gui_name}" --width=400 --height=350 $gui_options --text="Chose action to perform:" --hide-column=1 --column="" --column="Action"\
gui_action=$(zenity --list --title="${gui_name}" --width=400 --height=350 $gui_options --text="Choose action to perform:" --hide-column=1 --column="" --column="Action"\
check "`printf "\n Check current TDP\n "`" \
preset "`printf "\n Change TDP (Will ask for password)\n "`" \
set "`printf "\n Set custom TDP (Will ask for password)\n "`" \
@ -244,35 +246,35 @@ gui_handler() {
case $gui_action in
"check")
gui_msg "$($command_name check --detail)"
gui_msg "$($command_name check --detail)"
;;
"preset")
gui_tdp=$(
zenity --list --title "${gui_name}" --width=400 --height=350 $gui_options --text="Chose TDP to set:" --hide-column=1 --column="" --column="Wattage" \
8 "`printf "\n 8W (Ultra-low, for simple 2D games)\n "`" \
12 "`printf "\n 12W (Low power)\n "`" \
15 "`printf "\n 15W (Balanced)\n "`" \
20 "`printf "\n 20W (High power)\n "`" \
28 "`printf "\n 28W (Max power / Docked)\n "`"
)
echo $gui_tdp
if ! [ -z $gui_tdp ]; then
gui_msg "$(tdp set $gui_tdp --detail)"
fi
gui_tdp=$(
zenity --list --title "${gui_name}" --width=400 --height=350 $gui_options --text="Choose TDP to set:" --hide-column=1 --column="" --column="Wattage" \
8 "`printf "\n 8W (Ultra-low, for simple 2D games)\n "`" \
12 "`printf "\n 12W (Low power)\n "`" \
15 "`printf "\n 15W (Balanced)\n "`" \
20 "`printf "\n 20W (High power)\n "`" \
25 "`printf "\n 25W (Very-high power)\n "`" \
35 "`printf "\n 35W (Max power / Docked)\n "`"
)
if ! [ -z $gui_tdp ]; then
gui_msg "$(tdp set $gui_tdp --detail --same)"
fi
;;
"set")
gui_tdp=$(gui_read "Please enter TDP")
if ! [ -z $gui_tdp ]; then
if $(gui_ask "Should PL2 be set to the same wattage?\nIf unsure, answer No."); then
gui_msg "$(tdp set $gui_tdp --same --detail)"
else
gui_msg "$(tdp set $gui_tdp --detail)"
gui_tdp=$(gui_read "Please enter TDP")
if ! [ -z $gui_tdp ]; then
if $(gui_ask "Should PL2 be set to the same wattage?\nIf unsure, answer No."); then
gui_msg "$(tdp set $gui_tdp --same --detail)"
else
gui_msg "$(tdp set $gui_tdp --detail)"
fi
gui_tdp=""
fi
gui_tdp=""
fi
;;
*)