tildearrow / kwin-lowlatency

archived - X11 full-screen unredirection and lots'a settings for KWin
373 stars 10 forks source link

Kwin_x11 uses 100% of 1 core when unredirect is on #95

Closed rnd-ash closed 2 years ago

rnd-ash commented 3 years ago

Regardless on GPU (Intel/NVIDIA), when I lock my laptop 1 CPU core gets pegged at 100% by kwin_x11 process (Checked htop in another tty to verify)

Any debugging steps i can do?

tildearrow commented 3 years ago

Try disabling full-screen unredirection. If that fixes the issue, then something's wrong with the unredirect code.

rnd-ash commented 3 years ago

Tried that. It didn't help unfortunately...

tildearrow commented 3 years ago

Hmm.... May I see your kwinrc? Let's check if perhaps block compositing is on...

I completely forgot that 5.19.5 was being released today, but I am not releasing it until I fix this bug...

What I guess is that something is making the compositor do nothing for some time, which causes the wait for VBlank function to fail and wastes a core.

realnc commented 3 years ago

I completely forgot that 5.19.5 was being released today, but I am not releasing it until I fix this bug...

For what it's worth, I upgraded to 5.19.5 with the 5.19.4 lowlatency patch applied and it seems to work perfectly fine.

tildearrow commented 3 years ago

5.19.5 released...... without any fix to this problem due to rush from Gentoo side :<

tildearrow commented 3 years ago

This could also be an issue in the VBlank waiting code... because we use the "horrible hack" on Intel...

rnd-ash commented 3 years ago

Still a problem in 5.19.5...

[$Version]
update_info=kwin.upd:replace-scalein-with-scale,kwin.upd:port-minimizeanimation-effect-to-js,kwin.upd:port-scale-effect-to-js,kwin.upd:port-dimscreen-effect-to-js,kwin.upd:auto-bordersize,kwin.upd:animation-speed

[Compositing]
LatencyControl=2
OpenGLIsUnsafe=false
WindowsBlockCompositing=false

[Desktops]
Id_1=a2a40f0a-7857-4aaf-9043-e3d6de46cc55
Id_2=c32d011e-1ff3-40e6-80f1-d8a24ed40a0b
Id_3=cffbea09-b132-4e8c-815f-5bbbb7370559
Id_4=003561ab-9768-4638-82d5-5eb5490b7892
Name_2=New Desktop
Name_3=New Desktop
Name_4=New Desktop
Number=4
Rows=1

[Effect-PresentWindows]
Accuracy=5
BorderActivate=7
BorderActivateAll=9
LayoutMode=1

[ElectricBorders]
TopLeft=None

[Plugins]
ParachuteEnabled=true
lattewindowcolorsEnabled=false
minimizeallEnabled=false
synchronizeskipswitcherEnabled=false
toggleparachuteEnabled=true
videowallEnabled=false

[TabBox]
BorderActivate=9
DesktopLayout=org.kde.breeze.desktop
DesktopListLayout=org.kde.breeze.desktop
LayoutName=org.kde.breeze.desktop

[org.kde.kdecoration2]
library=org.kde.breeze
theme=Breeze
tildearrow commented 3 years ago

Issue reproduces when VSync mechanism is set to "hope for the best" or "SGI video sync with horrible hack".

Now to see where is the program getting stuck at...

tildearrow commented 3 years ago

Issue does not reproduce on latest Git version. I am not sure what did I do, but it does not reproduce anymore.

@rnd-ash Are you able to test using the latest version from Git branch Plasma/5.19?

rnd-ash commented 3 years ago

@tildearrow unfortunately not, I'm on 5.20 now. Will happily roll back to test though

rnd-ash commented 3 years ago

can confirm same issue with 5.20 branch using NVIDIA or intel GPU

UnicodeMan commented 3 years ago

If anyone is bothered by the problem (like me having a laptop), I created a dirty workaround. Lockscreen might lag or even freeze (type in password and press ENTER, it will work anyway), but the workaround does the trick quite well. First, install required dependencies: sudo apt install cpulimit (same package name in many other distros, too)

This script should added to user autostart: #!/bin/sh sleep 10 dbus-monitor --session "type='signal',interface='org.freedesktop.ScreenSaver'" | while read x; do case "$x" in *"boolean true"*) sh /home/lukas/locked.sh ;; *"boolean false"*) sh /home/lukas/unlocked.sh ;;
esac done

locked.sh : #!/bin/sh echo SCREEN_LOCKED; sleep 0.2 cpulimit -b -e kwin_x11 -l 6 &

unlocked.sh : #/bin/sh echo SCREEN_UNLOCKED killall -u USERNAME cpulimit # change USERNAME to your user

killall will kill all cpulimit instances, so beware if you are using cpulimit for something else, too.

You may want to increase the number specified in cpulimit's -l option if your experience is suboptimal.

EDIT: small syntax change that for some reason is required in Manjaro, but not in *buntu.

tildearrow commented 3 years ago

This bug has been confirmed again, on Plasma 5.20. Now what happened that broke the wait code again? :<

livelace commented 3 years ago

Hi there. I've just installed 5.19.5 and have similar problem. If I play Firefox/Youtube or VLC in fullscreen mode (windowed mode is ok) - kwin eats 1 core with 90-100% of usage.

UP. It seems unchecked "Suspend compositor for full-screen windows" helps.

CarliJoy commented 3 years ago

The bug also exist in vanilla kwin or is this what you talking of anyway?

tildearrow commented 2 years ago

The bug also exist in vanilla kwin or is this what you talking of anyway?

It's (or was) a bug exclusive to KWin-lowlatency.

Doesn't happen anymore on KWin-lowlatency 5.22/5.23 with the unredirection code rewrite.