Bug 485429 - kwin uses %100 CPU on Wayland when nouveau.noaccel=1
Summary: kwin uses %100 CPU on Wayland when nouveau.noaccel=1
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 6.0.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2024-04-12 11:07 UTC by omeringen
Modified: 2024-04-15 16:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
no nouveau and intel xf86-video drivers installed (21.15 KB, text/plain)
2024-04-12 11:07 UTC, omeringen
Details
nouveau and intel xf86-video drivers installed (21.15 KB, text/plain)
2024-04-12 11:08 UTC, omeringen
Details
htop CPU usage (141.43 KB, image/png)
2024-04-12 11:08 UTC, omeringen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description omeringen 2024-04-12 11:07:15 UTC
Created attachment 168416 [details]
no nouveau and intel xf86-video drivers installed

SUMMARY
kwin is using all CPU resources on Wayland session while using nouveau.noaccel=1 

STEPS TO REPRODUCE
1. add nouveau.noaccel=1 to your kernel parameters, regenerate
2. reboot and login with a wayland session

OBSERVED RESULT
it's even hard to move your cursor, CPU usage is %100

EXPECTED RESULT
acceptable average kwin CPU usage

SOFTWARE/OS VERSIONS
System:
  Host: arch Kernel: 6.8.4-zen1-1-zen arch: x86_64 bits: 64
  Desktop: KDE Plasma v: 6.0.3 Distro: Arch Linux
Graphics:
  Device-1: NVIDIA GT216M [GeForce GT 320M] driver: nouveau v: kernel
  Device-2: Bison HP Webcam driver: uvcvideo type: USB
  Display: server: X.Org v: 21.1.12 with: Xwayland v: 23.2.6 driver: X:
    loaded: modesetting unloaded: fbdev,vesa gpu: nouveau s-res: 1366x768
    resolution: 1366x768
  API: EGL v: 1.5 drivers: kms_swrast,swrast
    platforms: gbm,x11,surfaceless,device
  API: OpenGL v: 4.5 vendor: mesa v: 24.0.5-arch1.1 renderer: llvmpipe
    (LLVM 17.0.6 128 bits)
  API: Vulkan Message: No Vulkan data available.

KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.7.0

ADDITIONAL INFORMATION
Using nouveau.noaccel=1 because i am having random kernel lockups:
https://fedoraproject.org/wiki/Common_kernel_problems#Systems_with_nVidia_adapters_using_the_nouveau_driver_lock_up_randomly
Using modesetting driver because of "purple note" sections with explanation links:
https://wiki.archlinux.org/title/Nouveau

But i also installed both xf86-video-nouveau and intel packages to see if anything changes, no difference at all about CPU usage. I am attaching journalctl logs and screenshot of CPU usage.
Comment 1 omeringen 2024-04-12 11:08:21 UTC
Created attachment 168417 [details]
nouveau and intel xf86-video drivers installed
Comment 2 omeringen 2024-04-12 11:08:51 UTC
Created attachment 168418 [details]
htop CPU usage
Comment 3 omeringen 2024-04-12 11:14:53 UTC
forgot to add my CPU:

CPU:
  Info: dual core model: Intel Core i5 M 430 bits: 64 type: MT MCP cache:
    L2: 512 KiB
  Speed (MHz): avg: 1733 min/max: 1199/2267 cores: 1: 1199 2: 2267 3: 1199
    4: 2267
Comment 4 omeringen 2024-04-12 14:10:13 UTC
(In reply to omeringen from comment #3)
> forgot to add my CPU:
> 
> CPU:
>   Info: dual core model: Intel Core i5 M 430 bits: 64 type: MT MCP cache:
>     L2: 512 KiB
>   Speed (MHz): avg: 1733 min/max: 1199/2267 cores: 1: 1199 2: 2267 3: 1199
>     4: 2267

Another information which might be useful. Looks like i don't have iGPU on CPU, only nvidia. Cross checked with Windows11, Fedora etc.
https://hastebin.com/share/tifomupuqo.scss
https://hastebin.com/share/axiboweyed.markdown

looks like hP is disabling it, no option at BIOS:
https://h30434.www3.hp.com/t5/Notebook-Video-Display-and-Touch/Integrated-Intel-Graphics-GPU-disabled-by-factory/td-p/7178220
Comment 5 Zamundaaa 2024-04-12 15:02:43 UTC
Afaict the kernel parameter you're using disables hardware acceleration, so rendering happens on the CPU. High CPU usage is expected with that.
Comment 6 omeringen 2024-04-12 15:28:36 UTC
(In reply to Zamundaaa from comment #5)
> Afaict the kernel parameter you're using disables hardware acceleration, so
> rendering happens on the CPU. High CPU usage is expected with that.

I am using X11 session without any issue.
Comment 7 Zamundaaa 2024-04-12 15:55:03 UTC
Xorg has hardware specific ways to use 2D blitters when 3D hardware acceleration isn't available. KWin just doesn't and can't support that, sorry. The only way for you to get a usable Wayland session is to get that driver bug fixed so you don't need to effectively disable the only GPU in your system, or maybe to use QPainter (https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_compose) but its performance is pretty bad too
Comment 8 omeringen 2024-04-13 07:40:10 UTC
(In reply to Zamundaaa from comment #7)
> Xorg has hardware specific ways to use 2D blitters when 3D hardware
> acceleration isn't available. KWin just doesn't and can't support that,
> sorry. The only way for you to get a usable Wayland session is to get that
> driver bug fixed so you don't need to effectively disable the only GPU in
> your system, or maybe to use QPainter
> (https://invent.kde.org/plasma/kwin/-/wikis/Environment-
> Variables#kwin_compose) but its performance is pretty bad too

Thanks for the info.
Comment 9 omeringen 2024-04-15 16:04:42 UTC
Some info for users who wants to use wayland like me and don't have any other GPU without nvidia:
Remove nouveau.noaccel=1 kernel parameter and use environment variable "LIBGL_ALWAYS_SOFTWARE=1"
In this way, you can use wayland without the issues i encountered. (still high CPU usage for some apps but at least you can use your DE fine)