VFIO Legion 5 Laptop and Backlight issue with video-linux driver

I know this seems to be a somewhat common problem by the search for legion 5 backlight issues, but this case throws in VFIO and gpu passthrough.

I have a a Legion 5 15ACH6H with a Windows 10 / Manjaro XFCE dual boot. During the initial Manjaro install I would get no desktop display after install with the hybrid driver so I uninstalled them after loggin into a tty and the iGPU works fine using the video linux driver.

I hate having to reboot anytime I need the one windows only program in my life so I thought I would give GPU passthrough and Lookingglass a go. That works flawlessly.

My only issue now is that I have terrible battery life because the screen brightness is always 100% on the iGPU using the video-linux driver. The brightness keys / display pop up using the Fn+f5 or f6 but the actual brightness remains unchanged.

System:
  Kernel: 5.14.0-0-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.14-x86_64 
  root=UUID=cf49fb68-ce52-48aa-8216-652a4a594912 rw quiet apparmor=1 
  security=apparmor udev.log_priority=3 iommu=pt 
  vfio-pci.ids=10de:2560,10de:228e acpi_backlight=vendor 
  Desktop: Xfce 4.16.0 tk: Gtk 3.24.29 info: xfce4-panel, plank 
  wm: xfwm 4.16.1 vt: 7 dm: LightDM 1.30.0 Distro: Manjaro Linux 
  base: Arch Linux 
Machine:
  Type: Laptop System: LENOVO product: 82JU v: Legion 5 15ACH6H 
  serial: <filter> Chassis: type: 10 v: Legion 5 15ACH6H serial: <filter> 
  Mobo: LENOVO model: LNVNB161216 v: SDK0R32862 WIN serial: <filter> 
  UEFI: LENOVO v: GKCN40WW date: 07/18/2021 
Battery:
  ID-1: BAT0 charge: 62.9 Wh (99.1%) condition: 63.5/60.0 Wh (105.9%) 
  volts: 17.2 min: 15.4 model: SMP L20M4PC0 type: Li-poly serial: <filter> 
  status: Discharging cycles: 18 
Memory:
  RAM: total: 27.27 GiB used: 1.7 GiB (6.2%) 
  RAM Report: permissions: Unable to run dmidecode. Root privileges required. 
CPU:
  Info: 8-Core model: AMD Ryzen 7 5800H with Radeon Graphics bits: 64 
  type: MT MCP arch: Zen 3 family: 19 (25) model-id: 50 (80) stepping: 0 
  microcode: A50000C cache: L2: 4 MiB bogomips: 102240 
  Speed: 1339 MHz min/max: 1200/3200 MHz boost: enabled Core speeds (MHz): 
  1: 1339 2: 1825 3: 1496 4: 1219 5: 1222 6: 1259 7: 1378 8: 2029 9: 1391 
  10: 1544 11: 2112 12: 1403 13: 1323 14: 1297 15: 1223 16: 1962 
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1 
  bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy 
  constant_tsc cpb cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total cqm_occup_llc 
  cr8_legacy cx16 cx8 de decodeassists erms extapic extd_apicid f16c 
  flushbyasid fma fpu fsgsbase fsrm fxsr fxsr_opt ht hw_pstate ibpb ibrs ibs 
  invpcid irperf lahf_lm lbrv lm mba mca mce misalignsse mmx mmxext monitor 
  movbe msr mtrr mwaitx nonstop_tsc nopl npt nrip_save nx ospke osvw 
  overflow_recov pae pat pausefilter pclmulqdq pdpe1gb perfctr_core 
  perfctr_llc perfctr_nb pfthreshold pge pku pni popcnt pse pse36 rapl rdpid 
  rdpru rdrand rdseed rdt_a rdtscp rep_good sep sha_ni skinit smap smca smep 
  ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor svm svm_lock syscall 
  tce topoext tsc tsc_scale umip v_spec_ctrl v_vmsave_vmload vaes vgif 
  vmcb_clean vme vmmcall vpclmulqdq wbnoinvd wdt xgetbv1 xsave xsavec 
  xsaveerptr xsaveopt xsaves 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, IBRS_FW, 
  STIBP: always-on, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] vendor: Lenovo 
  driver: vfio-pci v: 0.2 alternate: nouveau,nvidia_drm,nvidia bus-ID: 01:00.0 
  chip-ID: 10de:2560 class-ID: 0300 
  Device-2: AMD Cezanne vendor: Lenovo driver: amdgpu v: kernel 
  bus-ID: 06:00.0 chip-ID: 1002:1638 class-ID: 0300 
  Device-3: Acer Integrated Camera type: USB driver: uvcvideo bus-ID: 1-3:3 
  chip-ID: 5986:212b class-ID: 0e02 
  Display: x11 server: X.Org 1.20.13 compositor: xfwm4 v: 4.16.1 driver: 
  loaded: amdgpu,ati unloaded: modesetting alternate: fbdev,vesa 
  display-ID: :0.0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: eDP res: 1920x1080 hz: 165 dpi: 142 size: 344x194mm (13.5x7.6") 
  diag: 395mm (15.5") 
  OpenGL: renderer: AMD RENOIR (DRM 3.42.0 5.14.0-0-MANJARO LLVM 12.0.1) 
  v: 4.6 Mesa 21.2.1 direct render: Yes 
Audio:
  Device-1: NVIDIA driver: vfio-pci v: 0.2 alternate: snd_hda_intel 
  bus-ID: 01:00.1 chip-ID: 10de:228e class-ID: 0403 
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor vendor: Lenovo 
  driver: N/A alternate: snd_pci_acp3x, snd_rn_pci_acp3x bus-ID: 06:00.5 
  chip-ID: 1022:15e2 class-ID: 0480 
  Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel 
  v: kernel bus-ID: 06:00.6 chip-ID: 1022:15e3 class-ID: 0403 
  Sound Server-1: ALSA v: k5.14.0-0-MANJARO running: yes 
  Sound Server-2: JACK v: 1.9.19 running: no 
  Sound Server-3: PulseAudio v: 15.0 running: yes 
  Sound Server-4: PipeWire v: 0.3.34 running: yes 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: Lenovo driver: r8169 v: kernel port: 3000 bus-ID: 03:00.0 
  chip-ID: 10ec:8168 class-ID: 0200 
  IF: eno1 state: down mac: <filter> 
  Device-2: Realtek vendor: Lenovo driver: rtw89_pci v: N/A modules: rtw89pci 
  port: 2000 bus-ID: 04:00.0 chip-ID: 10ec:8852 class-ID: 0280 
  IF: wlp4s0 state: up mac: <filter> 
  IP v4: <filter> type: dynamic noprefixroute scope: global 
  broadcast: <filter> 
  IP v6: <filter> type: noprefixroute scope: link 
  IF-ID-1: virbr0 state: down mac: <filter> 
  IP v4: <filter> scope: global broadcast: <filter> 
  WAN IP: <filter> 
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8 
  bus-ID: 3-4:3 chip-ID: 0bda:4852 class-ID: e001 serial: <filter> 
  Report: rfkill ID: hci0 rfk-id: 3 state: down bt-service: enabled,running 
  rfk-block: hardware: no software: yes address: see --recommends 
Logical:
  Message: No logical block device data found. 
RAID:
  Message: No RAID data found. 
Drives:
  Local Storage: total: 1.84 TiB used: 93.79 GiB (5.0%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital 
  model: PC SN730 SDBPNTY-1T00-1101 size: 953.87 GiB block-size: 
  physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD 
  serial: <filter> rev: 11170001 temp: 40.9 C scheme: GPT 
  ID-2: /dev/nvme1n1 maj-min: 259:6 vendor: Western Digital 
  model: WDS100T2B0C-00PXH0 size: 931.51 GiB block-size: physical: 512 B 
  logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter> 
  rev: 211210WD temp: 36.9 C scheme: GPT 
  Message: No optical or floppy data found. 
Partition:
  ID-1: / raw-size: 488.28 GiB size: 479.55 GiB (98.21%) 
  used: 93.75 GiB (19.6%) fs: ext4 dev: /dev/nvme0n1p5 maj-min: 259:5 
  label: N/A uuid: cf49fb68-ce52-48aa-8216-652a4a594912 
  ID-2: /boot/efi raw-size: 260 MiB size: 256 MiB (98.46%) 
  used: 33.7 MiB (13.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 
  label: SYSTEM_DRV uuid: 3A82-1C35 
Swap:
  Alert: No swap data was found. 
Unmounted:
  ID-1: /dev/nvme0n1p2 maj-min: 259:2 size: 16 MiB fs: <superuser required> 
  label: N/A uuid: N/A 
  ID-2: /dev/nvme0n1p3 maj-min: 259:3 size: 464.34 GiB fs: ntfs 
  label: Windows-SSD uuid: D23A83983A8377ED 
  ID-3: /dev/nvme0n1p4 maj-min: 259:4 size: 1000 MiB fs: ntfs label: WINRE_DRV 
  uuid: 407E843E7E842F2A 
  ID-4: /dev/nvme1n1p1 maj-min: 259:7 size: 465.72 GiB fs: ext4 label: N/A 
  uuid: 38d86d73-aa7f-46ba-aef8-ab376669704e 
  ID-5: /dev/nvme1n1p2 maj-min: 259:8 size: 465.79 GiB fs: ntfs label: N/A 
  uuid: 3A4C5018057310E0 
USB:
  Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Hub-2: 1-2:2 info: Genesys Logic Hub ports: 3 rev: 2.1 speed: 480 Mb/s 
  chip-ID: 05e3:0610 class-ID: 0900 
  Device-1: 1-3:3 info: Acer Integrated Camera type: Video driver: uvcvideo 
  interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA chip-ID: 5986:212b 
  class-ID: 0e02 
  Device-2: 1-4:4 info: Integrated Express ITE Device(8910) type: Keyboard 
  driver: hid-generic,usbhid interfaces: 1 rev: 2.0 speed: 12 Mb/s 
  power: 100mA chip-ID: 048d:c101 class-ID: 0301 
  Hub-3: 2-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
  Hub-4: 2-2:2 info: Genesys Logic USB3.2 Hub ports: 3 rev: 3.2 speed: 5 Gb/s 
  chip-ID: 05e3:0620 class-ID: 0900 
  Hub-5: 3-0:1 info: Full speed (or root) Hub ports: 4 rev: 2.0 
  speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900 
  Device-1: 3-3:2 info: Integrated Express ITE Device(8295) type: Keyboard,HID 
  driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s 
  power: 100mA chip-ID: 048d:c965 class-ID: 0300 
  Device-2: 3-4:3 info: Realtek Bluetooth Radio type: Bluetooth driver: btusb 
  interfaces: 2 rev: 1.0 speed: 12 Mb/s power: 500mA chip-ID: 0bda:4852 
  class-ID: e001 serial: <filter> 
  Hub-6: 4-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s 
  chip-ID: 1d6b:0003 class-ID: 0900 
Sensors:
  Message: No sensor data found. Is lm-sensors configured? 
Info:
  Processes: 336 Uptime: 1h 39m wakeups: 2 Init: systemd v: 248 
  tool: systemctl Compilers: gcc: 11.1.0 Packages: pacman: 1195 lib: 343 
  flatpak: 0 Shell: Bash v: 5.1.8 running-in: xfce4-terminal inxi: 3.3.06 
mhwd --listinstalled
> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2021.07.28               false            PCI
           video-linux            2018.05.04                true            PCI
1 Like

I took a stab at this yesterday because I have a Legion 5 and experienced the backlight and brightness problem. But I know zilch about VFIO or Lookingglass so I deleted my post since you’re probably way ahead of me.

In any case, my screen problem was solved by installing video-hybrid-intel-nvidia-prime with the internal GPU selected in the BIOS.

Have you already tried directly manipulating /sys/class/backlight/ ?

:thinking:

Unfortunately installing the video-hybrid-(in my case )amd-nvidia-prime did not solve it.

I have directly manipulated /sys/class/backlight/ after following the backlight wiki and passing the suggested kernel parameters. The value change, but no change in brightness.

:+1: Welcome to Manjaro! :+1:

  1. Please read this:
    How to provide good information
    and press the three dots … below your post and press the :pencil2: to give us more information so we can see what’s really going on.
    Now we know the symptom of the disease, but we need some more probing to know where the origin lies… :grin:
  2. An inxi --admin --verbosity=7 --filter --no-host --width would be the minimum required information for us to be able to help you. (Personally Identifiable Information like serial numbers and MAC addresses will be filtered out by the above command)
    Also, please copy-paste that output in-between 3 backticks ``` at the beginning and end of the code/text.
  3. The output of mhwd --listinstalled would be helpful too!

:+1:

P.S. If you want to notify me that you did provide this information, please :heart: this message and I’ll come back and have another look.
P.P.S. If you enter a bit more details in your profile, we can also see which Desktop Environment you’re using, which exact CPU/GPU or Kernel, … you have without typing it every time

1 Like

Please read this:

Especially the section Linux has multiple kernels and then try an LTS kernel and see if the issues go away “automagically”. :grin:

Unrelated to your problem:

but please read this

:crossed_fingers:

LTS kernel 5.10 does not seem to affect the situation. Tried passing the various recommended kernel parameters from the archwiki again with no joy. I can still change the contents of /sys/class/backlight directly (and via the keyboard widget) actual_backlight changes as expected, but the screen remains the same. Its funny because all the other keyboard widget function key combinations (airplane mode, audio volume, etc) work as expected. I should also mention that closing the lid of the laptop does shutoff the screen and it wakes up as expected with all kernels.

Overall the linux experience has come so far since I first installed it on a macbook a decade ago.

ps - thanks for the headup on the swap.

1 Like

I’m sorry: you’ve reached the end of my capabilities. Let’s hope someone smarter than me shows up!

:sob:

I have found a solution!

xrandr --output eDP --brightness 0.5 

(will set brightness to 50%)

xrandr

Will output a lot of info about your display in case your screen is not label eDP

If you prefer a gui zrandr (available in AUR) will give you a Qt5 front end so you do not need to remember the xrandr cli commands

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.