Razer Blade Advanced (Mid-2019) Arch Linux

Trials and tribulations of working with a non-mux laptop.

Specs:

  • i7-9750H @ 2.60GHz
  • 32 GB HyperX Impact DDR4 kit @ 2666MHz XMP 15-17-17 1.2V (upgrade)
  • 1TB ADATA XPG SX8200 Pro NVMe SSD (upgrade)
  • GTX 2070 Max-Q 8GB

What works well:

  • Performance: https://browser.geekbench.com/v4/cpu/compare/15152923?baseline=15152879 performance compared to Windows was noticeably better in both multi-core and single core. the only test that Windows had a significant win in was “HTML5 DOM”, curiously.
  • WiFi: no problems with the AX200 card, including power management
  • RBG Lighting: Polychromatic works very well, though does not have the effect layering that Synapse offers.
  • Battery life: With intel driving X and the NVIDIA card properly power managed I see idle drain < 10W, which is pretty good for this class of laptop.

Issues:

  • Thunderbolt docking does occasionally present issues. About 50% of the time, booting while connected to my CalDigit will hard freeze when starting X. This does happen under Windows, though Windows seems to recover when the dock is unplugged and re-plugged. Linux also locks up on shutdown when external displays are connected, though I have only reproduced this with SDDM
  • PRIME Synchronization: There seem to be vsync issues with my 60Hz thunderbolt DP display no matter what. With PRIME Sync enabled, both kwin and mutter tear. Only ForceCompositionPipeline eliminates the tearing, which has its own drawbacks.
  • hard freeze on suspend: button.lid_init_state=open on grub kernel params fixes this
  • firmware updates: you’ll need to boot windows. fortunately(?), Razer never seems to update the firmware on their systems.

Packages:

optimus-manager-qt was the way to go for graphics switching. hybrid mode with nvidia-prime package will allow you to offload OpenGL and Vulkan rendering onto the NVIDIA card with the prime-run wrapper, which sets the necessary environment variables. However, external displays are wired to the NVIDIA card and there is no mux. For working external displays you’ll need to switch to run X on the NVIDIA card wholly.

PRIME sync is broken in kernel >5.4, patched driver PKGBUILD: https://bbs.archlinux.org/viewtopic.php?pid=1882507#p1882507

polychromatic openrazer-daemon openrazer-driver-dkms for keyboard RGB

tlp: not required. nvidia power management is handled by the udev rule i’ll post below

Configuration:

/etc/modprobe.d/nvidia.conf
options nvidia-drm modeset=1
options nvidia NVreg_DynamicPowerManagement=0x02
"/lib/udev/rules.d/80-nvidia-pm.rules

http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/dynamicpowermanagement.html

# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1"

# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1"

# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{remove}="1"

# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="auto"

# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="on"
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"
/etc/mkinitcpio.conf
MODULES=(i915 nvidia nvidia_modeset nvidia_uvm nvidia_drm)
FILES=(/etc/modprobe.d/nvidia.conf)
# if using lvm on luks like I am
HOOKS=(base systemd autodetect modconf block keyboard sd-encrypt sd-lvm2 filesystems fsck)
/etc/default/grub

switch your resume= line to point to your swap

GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet resume=/dev/archblade/swap button.lid_init_state=open"
/etc/optimus-manager/optimus-manager.conf
[intel]
DRI=3
accel=
driver=modesetting
modeset=yes
tearfree=

[nvidia]
DPI=96
PAT=yes
ignore_abi=no
modeset=yes
options=overclocking

[optimus]
auto_logout=yes
pci_power_control=no
pci_remove=no
pci_reset=no
switching=none
KDE kwin

With external displays, kwin will run at a framerate equal to the refresh rate of the lowest Hz display. If you want 144/240Hz on the laptop display, you’ll need to set the following in ~/.config/kwinrc

[Compositing]
GLPreferBufferSwap=n
MaxFPS=240

There may be hacky ways to get mutter to cooperate too, though I haven’t experimented.

let me know if there are any improvements that can be made, or post your experiences with this beautiful laptop!

4 Likes

Hello, thanks for this guide, I do this before read this except a little things, that I have doubts.

options nvidia-drm modeset=1

Is necesary?
lsmod | grep nvidia
nvidia_drm 53248 6
nvidia_modeset 1118208 8 nvidia_drm
nvidia 20467712 375 nvidia_modeset
ipmi_msghandler 73728 2 ipmi_devintf,nvidia
drm_kms_helper 237568 2 nvidia_drm,i915
drm 557056 9 drm_kms_helper,nvidia_drm,i915
i2c_nvidia_gpu 16384 0

Is necesary edit /etc/mkinitpcio.conf I don’t do anything and I work, except to nvidia_uvm’s module, or how I can check that.

options nvidia NVreg_DynamicPowerManagement=0x02

Is working? or how check that?

Thanks in advance.
Sorry for my english, I am not a native speaker.