Unable to setup Hybrid with NVIDIA (prime-run, BadWindow)

Hi,

I’d like to setup my NVIDIA card for gaming in a hybrid laptop (beside Intel). When I try to run anything with prime-run I get “Error of failed request: BadWindow” error.
I tried to setup the non-free version of NVIDIA however it seems to impossible to setup video-hybrid-intel-nvidia-prime config with non-free driver.

I tried to install with sudo mhwd -a pci nonfree 0300 but it didn’t work.

Should I go with bumblebee instead?

Please help me to get it alive.

lspci | grep VGA

01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1)

sudo mhwd-kernel -li

Currently running: 6.5.11-1-MANJARO (linux65)
The following kernels are installed in your system:
   * linux61
   * linux65

sudo mhwd -li

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-intel-nvidia-prime            2023.03.23               false            PCI
     video-modesetting            2020.01.13                true            PCI


Warning: No installed USB configs!

inxi -Fza

System:
  Kernel: 6.5.11-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.5-x86_64
    root=UUID=d08b83b2-e06f-4a26-8f63-3beb89bbbc8d rw quiet apparmor=1
    security=apparmor udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.9 tk: Qt v: 5.15.11 info: latte-dock, docker
    wm: kwin_x11 vt: 2 dm: SDDM Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 81SY v: Legion Y540-15IRH-PG0
    serial: <superuser required> Chassis: type: 10 v: Legion Y540-15IRH-PG0
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: NO DPK serial: <superuser required>
    UEFI: LENOVO v: BHCN32WW date: 08/29/2019
Battery:
  ID-1: BAT0 charge: 42.6 Wh (100.0%) condition: 42.6/52.5 Wh (81.1%)
    volts: 12.7 min: 11.4 model: SMP L17M3PG3 type: Li-poly serial: <filter>
    status: full cycles: 261
CPU:
  Info: model: Intel Core i7-9750H bits: 64 type: MT MCP arch: Coffee Lake
    gen: core 9 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 0xA (10) microcode: 0xF4
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
    L3: 12 MiB desc: 1x12 MiB
  Speed (MHz): avg: 3300 min/max: 800/4500 scaling: driver: intel_pstate
    governor: powersave cores: 1: 3300 2: 3300 3: 3300 4: 3300 5: 3300 6: 3300
    7: 3300 8: 3300 9: 3300 10: 3300 11: 3300 12: 3300 bogomips: 62431
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling mitigation: Microcode
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS, IBPB: conditional, STIBP: conditional,
    RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] vendor: Lenovo
    driver: nvidia v: 535.129.03 alternate: nouveau,nvidia_drm non-free: 545.xx+
    status: current (as of 2023-11; EOL~2026-12-xx) arch: Turing code: TUxxx
    process: TSMC 12nm FF built: 2018-2022 pcie: gen: 1 speed: 2.5 GT/s
    lanes: 16 link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0
    chip-ID: 10de:1f91 class-ID: 0300
  Device-2: Chicony Integrated Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-6:5 chip-ID: 04f2:b6d9
    class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.9 compositor: kwin_x11 driver: X:
    loaded: N/A failed: nvidia gpu: nvidia display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3839x1080 s-dpi: 144 s-size: 678x191mm (26.69x7.52")
    s-diag: 704mm (27.73")
  Monitor-1: DP-4 pos: primary,left res: 1920x1080 hz: 60 dpi: 142
    size: 344x193mm (13.54x7.6") diag: 394mm (15.53") modes: N/A
  Monitor-2: HDMI-0 pos: right res: 1920x1080 hz: 60 dpi: 93
    size: 527x296mm (20.75x11.65") diag: 604mm (23.8") modes: N/A
  API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 1
    drv: swrast gbm: drv: kms_swrast surfaceless: drv: nvidia x11: drv: nvidia
    inactive: wayland
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: mesa v: 23.1.9-manjaro1.1
    glx-v: 1.4 direct-render: yes renderer: llvmpipe (LLVM 16.0.6 256 bits)
    device-ID: ffffffff:ffffffff memory: 15.18 GiB unified: yes
  API: Vulkan v: 1.3.269 layers: 5 device: 0 type: discrete-gpu
    name: NVIDIA GeForce GTX 1650 driver: nvidia v: 535.129.03
    device-ID: 10de:1f91 surfaces: xcb,xlib
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Lenovo driver: snd_hda_intel
    v: kernel alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
    chip-ID: 8086:a348 class-ID: 0403
  Device-2: NVIDIA vendor: Lenovo driver: snd_hda_intel v: kernel pcie:
    gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:10fa
    class-ID: 0403
  API: ALSA v: k6.5.11-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 0.3.84 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Lenovo driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: 3000 bus-ID: 07:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp7s0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) driver: btusb
    v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-14:7
    chip-ID: 8087:0aaa class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 3 state: up address: see --recommends
Drives:
  Local Storage: total: 931.51 GiB used: 619.14 GiB (66.5%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Crucial model: CT1000P1SSD8
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: P3CR013 temp: 61.9 C
    scheme: GPT
Partition:
  ID-1: / raw-size: 50 GiB size: 48.91 GiB (97.83%) used: 40.24 GiB (82.3%)
    fs: ext4 dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 316 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 448.83 GiB size: 440.71 GiB (98.19%)
    used: 366.61 GiB (83.2%) fs: ext4 dev: /dev/nvme0n1p3 maj-min: 259:3
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 83.0 C pch: 63.0 C mobo: N/A gpu: nvidia
    temp: 48 C
  Fan Speeds (rpm): N/A
Info:
  Processes: 333 Uptime: 6h 45m wakeups: 0 Memory: total: 16 GiB
  available: 15.54 GiB used: 10.35 GiB (66.6%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: 1721 pm: pacman pkgs: 1715 libs: 449 tools: pamac pm: flatpak
  pkgs: 0 pm: snap pkgs: 6 Shell: Zsh v: 5.9 running-in: konsole inxi: 3.3.31

glxinfo | grep OpenGL

OpenGL vendor string: Mesa
OpenGL renderer string: llvmpipe (LLVM 16.0.6, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 23.1.9-manjaro1.1
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.1.9-manjaro1.1
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.1.9-manjaro1.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

prime-run glxinfo | grep OpenGL

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  156 (NV-GLX)
  Minor opcode of failed request:  4 ()
  Resource id in failed request:  0x6400003
  Serial number of failed request:  41
  Current serial number in output stream:  41

i see only one nvidia card
Have you PGPU disable in BIOS ?

You are right.

nvidia-smi -L

GPU 0: NVIDIA GeForce GTX 1650 (UUID: GPU-cef230f8-6c2c-93b4-f5ed-80a424647782)

It seems my Intel VGA disappeared from my system. It is an additional problem which come from the whole setup chaos.

I can’t find any PGPU setting in my BIOS. There is a Win installed which I can start from bootloader but everything is fine there (The NVIDIA card only fires when it is needed).

provide output from:
ls /etc/modprobe.d
find /etc/X11/ -name "*.conf"
pacman -Qs 'nvidia|prim|optimus|bbswitch'
pacman -Qm

Here they are sir :slight_smile:

ls /etc/modprobe.d

blacklist.conf  mhwd-gpu.conf

find /etc/X11/ -name "*.conf"

/etc/X11/xorg.conf
/etc/X11/xorg.conf.d/30-touchpad.conf
/etc/X11/xorg.conf.d/00-keyboard.conf
/etc/X11/xorg.conf.d/90-mhwd.conf
/etc/X11/mhwd.d/nvidia.conf

pacman -Qs 'nvidia|prim|optimus|bbswitch'

local/bumblebee 3.2.1-23
    NVIDIA Optimus support for Linux through Primus/VirtualGL
local/egl-wayland 2:1.1.13-1
    EGLStream-based Wayland external platform
local/lib32-nvidia-utils 535.129.03-2
    NVIDIA drivers utilities (32-bit)
local/lib32-opencl-nvidia 535.129.03-2
    OpenCL implemention for NVIDIA (32-bit)
local/libexttextcat 3.4.6-1
    N-Gram-Based Text Categorization library primarily intended for language guessing
local/libplacebo 5.264.1-4
    Reusable library for GPU-accelerated video/image rendering primitives
local/libvdpau 1.5-2
    Nvidia VDPAU library
local/libxnvctrl 535.129.03-2
    NVIDIA NV-CONTROL X extension
local/linux61-nvidia 535.129.03-3 (linux61-extramodules)
    NVIDIA drivers for linux
local/linux65-nvidia 535.129.03-3 (linux65-extramodules)
    NVIDIA drivers for linux
local/mhwd-nvidia 535.129.03-2
    MHWD module-ids for nvidia 535.129.03
local/mhwd-nvidia-390xx 390.157-9
    MHWD module-ids for nvidia 390.157
local/mhwd-nvidia-470xx 470.223.02-1
    MHWD module-ids for nvidia 470.223.02
local/nvidia-prime 1.0-4
    NVIDIA Prime Render Offload configuration and utilities
local/nvidia-settings 535.129.03-2
    Tool for configuring the NVIDIA graphics driver
local/nvidia-utils 535.129.03-2
    NVIDIA drivers utilities
local/opencl-nvidia 535.129.03-2
    OpenCL implemention for NVIDIA
local/primus 20151110-9
    Faster OpenGL offloading for Bumblebee
local/python-cryptography 41.0.5-1
    A package designed to expose cryptographic recipes and primitives to Python developers
local/python-pycryptodomex 3.12.0-2
    A self-contained Python package of low-level cryptographic primitives
local/xorg-xrandr 1.5.2-1 (xorg-apps xorg)
    Primitive command line interface to RandR extension

pacman -Qm

autojump 22.5.3-9
cockpit-docker 226-2
dropbox 162.4.5419-1
electron6-bin 6.1.12-4
gamehub 0.16.3.2-1
gnome-icon-theme 3.12.0-7
gnome-icon-theme-symbolic 3.12.0-6
hardcode-fixer 1:r543.0321910-1
kdeplasma-applets-fokus 1.5.5-1
linux59-headers 5.9.16-1
lite-xl 2.1.0-2
manjaro-documentation-en 20181009-1
manjaro-firmware 20160419-1
nodejs-lts-gallium 16.20.2-1
notion-app 2.0.18-1
phoenicis-playonlinux 5.0_snapshot-1
phpstorm 2022.3-1
phpstorm-jre 2022.3-1
python2 2.7.18-7
python2-setuptools 2:44.1.1-2
simplenote-electron-bin 2.21.0-1
spotify 1:1.1.84.716-2
spotify-tui-bin 0.25.0-4
systemd-fsck-silent 239-1
tidal-hifi 2.7.0-1
transcode 1.1.7-41
ttf-ms-fonts 2.0-12
typora 1.4.7-1
wpscan-git 3.8.21.3152.33056928-1
xdg-su 1.2.3-2

cat /etc/X11/mhwd.d/nvidia.conf

##
## Generated by mhwd - Manjaro Hardware Detection
##

I can tell you that you dont want these installed.

Please also show

cat /etc/modprobe.d/*
cat /etc/X11/xorg.conf.d/90-mhwd.conf

Oops, missed a few more.
You should also get rid of

(ex: sudo pacman -Rns bumblebee primus manjaro-firmware manjaro-documentation-en linux59-headers)

Thanks. I’ve removed the unnecessary packages.

cat /etc/modprobe.d/*

blacklist pcspkr
##
## Generated by mhwd - Manjaro Hardware Detection
##
 
blacklist nouveau
blacklist ttm
blacklist drm_kms_helper
blacklist drm
options nvidia "NVreg_DynamicPowerManagement=0x02"

cat /etc/X11/xorg.conf.d/90-mhwd.conf

##
## Generated by mhwd - Manjaro Hardware Detection
##
 
 

Ok, lets remove that

sudo rm /etc/modprobe.d/mhwd-gpu.conf

Might as well get the empty one too:

sudo rm /etc/X11/xorg.conf.d/90-mhwd.conf

Then we will do the sync/update dance:

sudo pacman -Syu

Then reinstall your driver profile:

sudo mhwd -f -i pci video-hybrid-intel-nvidia-prime

Then rebuild initramfs, etc:

sudo mkinitcpio -P && sudo update-grub

Reboot.

And check it out:

glxinfo | grep 'renderer string'
prime-run glxinfo | grep 'renderer string'

glxinfo | grep 'renderer string'

OpenGL renderer string: NVIDIA GeForce GTX 1650/PCIe/SSE2

prime-run glxinfo | grep 'renderer string'

OpenGL renderer string: NVIDIA GeForce GTX 1650/PCIe/SSE2

Awesome, thank you! The Nvidia card working fine now.
I am not sure that it means that the Intel GPU is the default for the desktop. Or it is the next step?

lspci | grep VGA

01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1)

That is not yet the case.
Still no Intel graphics

It must look like this

lspci | grep VGA                                                                                  
00:02.0 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation AD106M [GeForce RTX 4070 Max-Q / Mobile] (rev a1)
pacman -Qs 'nvidia|prim|optimus|bbswitch'                                                              ✔ 
local/egl-wayland 2:1.1.13-1
    EGLStream-based Wayland external platform
local/lib32-libvdpau 1.5-2
    Nvidia VDPAU library
local/lib32-nvidia-utils 535.129.03-2
    NVIDIA drivers utilities (32-bit)
local/libplacebo 5.264.1-4
    Reusable library for GPU-accelerated video/image rendering primitives
local/libva-nvidia-driver 0.0.11-1
    VA-API implementation that uses NVDEC as a backend
local/libvdpau 1.5-2
    Nvidia VDPAU library
local/libxnvctrl 535.129.03-2
    NVIDIA NV-CONTROL X extension
local/linux61-nvidia 535.129.03-3 (linux61-extramodules)
    NVIDIA drivers for linux
local/linux66-nvidia 535.129.03-3 (linux66-extramodules)
    NVIDIA drivers for linux
local/mhwd-nvidia 535.129.03-2
    MHWD module-ids for nvidia 535.129.03
local/mhwd-nvidia-390xx 390.157-9
    MHWD module-ids for nvidia 390.157
local/mhwd-nvidia-470xx 470.223.02-1
    MHWD module-ids for nvidia 470.223.02
local/nvidia-prime 1.0-4
    NVIDIA Prime Render Offload configuration and utilities
local/nvidia-settings 535.129.03-2
    Tool for configuring the NVIDIA graphics driver
local/nvidia-utils 535.129.03-2
    NVIDIA drivers utilities
local/python-cryptography 41.0.5-1
    A package designed to expose cryptographic recipes and primitives to Python developers
local/xorg-xrandr 1.5.2-1 (xorg-apps xorg)
    Primitive command line interface to RandR extension

Please post the output of
journalctl -b | grep VGA and journalctl -b | grep i915

remove it

journalctl -b | grep VGA

nov 18 15:38:32 manjaro-cc kernel: pci 0000:01:00.0: vgaarb: setting as boot VGA device
nov 18 15:38:32 manjaro-cc kernel: pci 0000:01:00.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
nov 18 15:38:33 manjaro-cc kernel: nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem

journalctl -b | grep i915
empty result

local/primus is no more installed

Go to BIOS by Press F2
Check this Video

Time 0:25
What is your setting?

Graphic Driver: Discrete Graphics

Thats the error. You must set Switchable Graphics

When I set to Switchable Graphics I get black laptop screen on startup. When my monitor plugged in that will be the only and working display. The monitor screen is still nonexistent.

In the terminaI (in another runlevel) I get the following:

00:02.0 VGA compatible controller: Intel Corporation CofeeLake-H GT2 [UHD Graphics 630]
01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1)

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