External monitor uses igpu instead of dgpu on laptop

I’ve got a Clevo P950R, which is hybrid Intel/Nvidia.
I can play games on the internal monitor just fine. But when I try to watch videos or game on an external monitor instead, plugged into the HDMI port, the framerate drops very low and it becomes oh so stuttery. The wayland/xwayland screen on the external monitor seems to tax the igpu quite heavily, even if the game itself uses the dgpu.
This seems weird.

Can someone give me pointers to get reverse prime(?) working on wayland?


Section “ServerLayout”
Identifier “layout”
Option “AllowNVIDIAGPUScreens”

Section “Device”
Identifier “intel”
Driver “modesetting”
BusID “PCI:0@0:2:0”

Section “Device”
Identifier “nvidia”
Driver “nvidia”
BusID “PCI:1@0:0:0”
Option “ConstrainCursor” “off”
Option “coolbits” “28”
Option “PrimaryGPU” “yes”

Section “OutputClass”
Identifier “nvidia”
MatchDriver “nvidia-drm”
Driver “nvidia”
Option “AllowEmptyInitialConfiguration”
Option “SLI” “Auto”
Option “BaseMosaic” “on”
Option “PrimaryGPU” “yes”

lspci | grep VGA:

00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630]
01:00.0 VGA compatible controller: NVIDIA Corporation GP104M [GeForce GTX 1070 Mobile] (rev a1)
inxi -FAzy80

Kernel: 6.4.7-200.fc38.x86_64 arch: x86_64 bits: 64 Desktop: KDE Plasma
v: 5.27.6 Distro: Fedora release 38 (Thirty Eight)
Type: Laptop System: Notebook product: P95xER v: N/A
Mobo: Notebook model: P95xER serial:
UEFI: American Megatrends v: 1.07.15 date: 11/16/2018
ID-1: BAT0 charge: 31.7 Wh (89.5%) condition: 35.4/53.2 Wh (66.5%)
Info: 6-core model: Intel Core i7-8750H bits: 64 type: MT MCP cache:
L2: 1.5 MiB
Speed (MHz): avg: 1616 min/max: 800/4100 cores: 1: 2200 2: 2200 3: 800
4: 2200 5: 2200 6: 800 7: 800 8: 2200 9: 2200 10: 2200 11: 800 12: 800
Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] driver: i915 v: kernel
Device-2: NVIDIA GP104M [GeForce GTX 1070 Mobile] driver: nvidia
v: 535.86.05
Device-3: Chicony USB 2.0 Camera driver: uvcvideo type: USB
Display: wayland server: X.org v: 1.20.14 with: Xwayland v: 22.1.9
compositor: kwin_wayland driver: X: loaded: modesetting,nvidia dri: iris
gpu: i915,nvidia resolution: 1920x1080
API: OpenGL v: 4.6 Mesa 23.1.5 renderer: Mesa Intel UHD Graphics 630 (CFL
Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel
Device-2: NVIDIA GP104 High Definition Audio driver: snd_hda_intel
API: ALSA v: k6.4.7-200.fc38.x86_64 status: kernel-api
Server-1: PipeWire v: 0.3.77 status: active
Device-1: Intel Wireless-AC 9260 driver: iwlwifi
IF: wlp3s0 state: up mac:
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
driver: r8169
IF: enp4s0 state: down mac:
IF-ID-1: wg-norway state: unknown speed: N/A duplex: N/A mac: N/A
Device-1: Intel Wireless-AC 9260 Bluetooth Adapter driver: btusb type: USB
Report: rfkill ID: hci0 rfk-id: 3 state: down bt-service: enabled,running
rfk-block: hardware: no software: yes address: see --recommends
Local Storage: total: 2.05 TiB used: 1.23 TiB (60.2%)
ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 960 EVO 250GB
size: 232.89 GiB
ID-2: /dev/sda vendor: Seagate model: ST2000LX001-1RG174 size: 1.82 TiB
ID-1: /boot size: 973.4 MiB used: 98 MiB (10.1%) fs: ext4 dev: /dev/nvme0n1p2
ID-2: /boot/efi size: 598.8 MiB used: 9.8 MiB (1.6%) fs: vfat
dev: /dev/nvme0n1p1
ID-1: swap-1 type: zram size: 14 GiB used: 0 KiB (0.0%) dev: /dev/zram0
System Temperatures: cpu: 49.0 C pch: 54.0 C mobo: N/A
Fan Speeds (RPM): N/A
Processes: 368 Uptime: 1d 2h 38m Memory: available: 31.06 GiB
used: 6.92 GiB (22.3%) Shell: Zsh inxi: 3.3.27

  1. your file /etc/X11/xorg.conf.d/nvidia.conf is not even close to the simple 2 stanza file that is provided when one installs the nvidia drivers. It has a lot of extraneous info and probably would not work at all.
  2. That file also is never used when one is using the wayland DE. It only applies when running the X11 DE.

The stuttering on the external monitor appears it may not be using the harware acceleration that is available with the nvidia drivers. The cpu is then tasked with video rendering and slows everything down.

1 Like
  1. I’ve tried over a long time to improve the nvidia.conf file, using bits and bobs from different wikis and forums. I’m pretty sure that, as you say, there is extraneous info there. I just don’t know enough to determine exactly what. I know the simple two stanza file caused me sleep/resume issues and black screen on boot, when I tried the “clean slate approach” last year…

  2. I’ve wondered about this very much, as pretty much every guide for configuring specific graphics things (even these days, when wayland is the base assumption) use the xorg.conf files. Is there an equivalent for wayland?

I don’t think it’s merely a hw video acceleration issue, since the problem is the same for any video source and format output over hdmi… I’m inclined to believe the external monitor is rendered on the igpu, for some reason.

Would a screenshot of nvtop during a game session with an external monitor be useful?

I personally do not like wayland since it is the new kid on the block and has not fully matured yet.

I have had no issues with anything I do when running xorg. Steam, Zoom, etc. all just work and work well. Watching others problems on this forum sometimes can show one having a problem and when they switch from wayland to xorg the problem disappears. Thus it seems apparent that for at least some, and in some situations, wayland does not yet fully support everything. In fact just in the last couple days one user reported that zoom crashes on wayland but works on xorg.

On my system I copied in the nvidia.conf file exactly as provided, added the one line Option "PrimaryGPU" "yes" and have been running xorg for over 2 years without a hiccup of any kind.

This ensures the nvidia GPU is used 100% of the time, that it supports both the internal and external screens, and that when needed the hardware acceleration is available.

These instructions tell exactly how I did that.

1 Like

Doing this and running an X11 session rather than wayland solves this issue.

I quickly discovered that I don’t want the dgpu to run all the time, because the noise is too much… For now I guess I’ll use wayland for daily tasks, and switch to X whenever I want to game/watch videos on external monitors.

some observations:

  • X11 has different resolution/scaling than Wayland on my internal HiDPI monitor, making things really weirdly sized whenever I switch between them.
  • on X11 KRunner opens in the middle of the screen every other time, for some reason.
  • I love using gestures, so wayland is a better daily driver for me.

Does someone have a script to adapt resolution/scaling when switching back and forth between X11 and wayland?