External monitor not detected in plasma wayland session

Because X11 is very choppy on my laptop I tried installing plasma-wayland-session package on my intel/nvidia laptop. After a restart the integrated screen was very smooth, but I couldn’t get any output on my external monitor.

xrandr --listmonitors showed me this

Monitors: 1
 0: +*XWAYLAND0 1920/340x1080/190+0+0  XWAYLAND0

I have tried adding nvidia-drm.modeset=1 kernel parameter alongside adding nvidia, nvidia_modeset, nvidia_uvm and nvidia_drm to the initramfs. But then I couldn’t reach the graphical interface.

In journalctl I found this error

sddm[714]: Display server starting...
sddm[714]: Adding cookie to "/var/run/sddm/{8daefaf0-ba4e-4d73-afa2-636aa31e0da4}"
sddm[714]: Running: /usr/bin/X -nolisten tcp -background none -seat seat0 vt1 -auth>
sddm[714]: Failed to read display number from pipe
sddm[714]: Display server stopping...
sddm[714]: Attempt 3 starting the Display server on vt 1 failed
sddm[714]: Could not start Display server on vt 1

Downgrading to nvidia-470xx hybrid drivers worked with the parameters set but then external monitor would be very choppy, probably because the external monitor was 1440p 144hz and have heard that the driver would just use the CPU for external monitors.

I have also tried using KDE-unstable repository and newer linux kernels but no luck.

Some information about my setup:
Current KDE Plasma version: 5.24.5
Qt version: 5.15.4
Kernel version: 5.15.41-1-MANJARO

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 TU116M [GeForce GTX 1660 Ti Mobile] (rev a1)

please post the output of

glxinfo | grep server

intel active ?

The output is:

server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:

Intel is active, and there isn’t a way to use nvidia only in bios. At least to my knowledge.

My laptop is: Acer Predator PH315-52

mine is a Predator PH317-52

systemctl status optimus-manager

running ?

Unit optimus-manager.service could not be found.

I also should mention after all the debugging I have reinstalled Manjaro and I only have the plasma-wayland-session package installed.

install optimus manager. enable it with “sudo systemctl enable optimus-manager”

edit /etc/default/grub (you must edit with sudo rights) and add the following to GRUB_CMDLINE_LINUX_DEFAULT line "optimus-manager.startup=nvidia ". be aware you have to add this parameter to the already existing ones.
after editing do an

sudo update-grub
sudo mkinitcpio -P

reboot and nvidia is active.

That did make it work, but now the external monitor is very laggy, similar how video-hybrid-intel-nvidia-470xx-prime drivers were working.

Should I be using video-nvidia instead of video-hybrid-intel-nvidia-prime that were installed by default?

my personal experience is to stay on x11 and don’t use wayland.

what is the output of

glxinfo | grep server

now ?

It’s the same

server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:

I also tried using optimus-manager --switch nvidia and got this

ERROR: the active card is "integrated" but it should be "nvidia".
Something went wrong during the last GPU setup...
Log at /var/log/optimus-manager/switch/switch-20220609T145621.log
Cannot execute command because of previous errors.

The log file:

[14] INFO: # Xorg pre-start hook
[14] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'nvidia', 'current_mode': None}
[14] INFO: Requested mode is: nvidia
[1569] INFO: Available modules: ['nouveau', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[1569] INFO: Unloading modules ['nouveau'] (if loaded)
[1573] INFO: switching=none, nothing to do
[1612] INFO: Loading module nvidia
[2513] INFO: Loading module nvidia_drm
[4792] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf
[4792] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20220609T145621', 'requested_mode': 'nvidia'}
[4793] INFO: Xorg pre-start hook completed successfully.
[6] INFO: # Xorg post-start hook
[6] INFO: Running xrandr commands
[266] INFO: Running /etc/optimus-manager/xsetup-nvidia.sh
[284] INFO: Writing state {'type': 'done', 'switch_id': '20220609T145621', 'current_mode': 'nvidia'}
[284] INFO: Xorg post-start hook completed successfully.

i need a info

prime-run glxinfo | grep "OpenGL renderer"

It returns

OpenGL renderer string: NVIDIA GeForce GTX 1660 Ti/PCIe/SSE2

okay and if you run

glxinfo | grep "OpenGL renderer"

intel ?

Yes, it returns intel

OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)

okay, fingers crossed and try

prime-offload

success ? it’s possible that you have to setup the monitors afterwards in the system-settings

No luck, it doesn’t do anything, and the monitors were already set up in kde system settings as the screen was working but it’s unusable as to how laggy it is.

but you did this ?

edit /etc/default/grub (you must edit with sudo rights) and add the following to GRUB_CMDLINE_LINUX_DEFAULT line "optimus-manager.startup=nvidia ". be aware you have to add this parameter to the already existing ones.
after editing do an

sudo update-grub
sudo mkinitcpio -P

reboot 

please post the output of

cat /etc/default/grub

and the status of optimus

systemctl status optimus-manager
GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="optimus-manager.startup=nvidia nvidia-drm.modeset=1 apparmor=1 security=apparmor resume=UUID=e218ae5f-1e51-4031-b9b8-6d625f4bf64e udev.log_priority=3"
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/theme.txt"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
#GRUB_ROOT_FS_RO=true

tried with and without nvidia-drm.modeset=1 same result

yes it’s still laggy because intel is still the primary-graphics adapter

glxinfo | grep "OpenGL renderer"

will show that it is still intel and not nvidia

also you said you’ve installed plasma-wayland-session from packet-manager. in this case you can choose X11 or wayland at login (left, bottom corner). choose X11

Actually with optimus-manager set up all X11 lag is gone and everything is incredibly smooth.

So the solution is to just ditch wayland and use optimus-manager. I’ll try to tinker more with optimus-manager, try to make power managment work and stuff like that, but the main issue is fixed.

Thank you four all your help Olli.

make sure that you enable nvidia-persistenced

sudo systemctl enable nvidia-persistenced