tildearrow / kwin-lowlatency

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

KWin freezing #10

Closed An4cl3t0 closed 5 years ago

An4cl3t0 commented 5 years ago

Hi, my Kwin session freezes when moving a windows around the screen, starting the animation to expand to half/all screen. It is reproducible only sometimes, but if I drag the window a lot it happens. It freezes completely without recovering. I tried to lower the latency compensation to 0/0 , deactivate all animations and set to instant, but doesn't work. I use the OpenGL 3.1 and "full screen repaints" setting, on Intel integrated GPU. On normal Kwin it works. Sorry for the bad English and thanks for your time.

sanderboom commented 5 years ago

I had the same thing, but plasma packages on my system were still at 5.14. Now that I've update those to 5.15 I haven't had any freezes anymore.

An4cl3t0 commented 5 years ago

I can reproduce the issue on Plasma 5.15.5-1

tildearrow commented 5 years ago

Confirmed. After checking the code, I may be able to conclude this is more of a Mesa bug in the glXWaitVideoSyncSGI function which sometimes causes the function to never return. I'll be trying the OML replacement for a while, and if it still reproduces, this isn't going to be good...

tildearrow commented 5 years ago

Nope, OML doesn't make a difference. I'm opening a bug in the Mesa bug tracker...

tildearrow commented 5 years ago

OK, so indeed Mesa 19.0 causes freezing, even on my AMD GPU. I'm going to try using the Intel swap event instead of glXWaitVideoSyncSGI, but if it doesn't work, this will be even more depressing...

tildearrow commented 5 years ago

I probably have fixed this issue now! By just using glFinish instead of glXWaitVideoSyncSGI, we achieve a similar effect (no extra latency). May you please test the changes I just pushed to the Plasma/5.15 branch?

sanderboom commented 5 years ago

Awesome! Compiling now. Yesterday and today I indeed experienced hangs on 5.15.5-1 as well. Will let you know the results!

sanderboom commented 5 years ago

Unfortunately, with the build of yesterday, I experienced two more hangs. The compositor dialog complains that OpenGL has crashed. Is there any package I can downgrade/upgrade (mesa?) to prevent hangs at the moment? Next week I will be on-site at a client and hangs would be unfortunate. I know I can go back to stock kwin, but I rather not as your changes make the WM smoother than ever - it has positive effect on my workflow (I especially hate input lag).

tildearrow commented 5 years ago

I'm not sure which package may be able to fix the hangs. I tried downgrading X.Org and bisecting Mesa to go back to a point where in my system it no longer hangs, but neither helped.

Can you provide a backtrace at the time it does? Here are some instructions for doing so: In an off-screen terminal (e.g. SSH):

$ cd kwin-lowlatency/build
$ QT_PLUGIN_PATH="$PWD/bin" gdb ./bin/kwin_x11

After the debugger loads:

(gdb) run --replace

Then, try getting the compositor to hang, and when it does, press Ctrl-Z in the debugger to break. Then do:

(gdb) backtrace

and copy/paste the result here.

sanderboom commented 5 years ago

I definitely will help, but this week is madness for work, so I reinstalled stock kwin for now :sad: Will report back when I have the opportunity!

tildearrow commented 5 years ago

Sure. I will be patiently waiting for a response. (sidenote: you can try openbox in the meanwhile)

(By the way, @An4cl3t0 are you still here?)

An4cl3t0 commented 5 years ago

Yes, I'm following the report but I can't test the system until the weekend. Sorry :/

tildearrow commented 5 years ago

That's fine. I thought you abandoned the bug report.

lucasslima commented 5 years ago

Yo, Just wanted to give an Up, I'm experiencing the same issue.I haven't seen it in the last couple of days, but let me know if there's any way I can test it more precisely. I'm also on Intel Graphics.

tildearrow commented 5 years ago

@lucasslima Have you updated to 5.15.6? If so, and if it still reproduces, then may you provide me with a backtrace at the time of the hang? (instructions above)

sanderboom commented 5 years ago

This reddit post seems the describe the problem I had. Maybe this is a hint that the problem is not due to kwin-lowlatency but other factors (someone suggests kernel 5.1). I will install kwin-lowlatency again and run kernel 5.0.15 and see whether I have problems. When I have my other machine at hand I can try the offscreen debug session.

tildearrow commented 5 years ago

Linux 5.1...? I haven't upgraded to that version because in my case anything after 5.0.2 is borked (I upgraded once to 5.0.6, and next day I had filesystem corruption).

light0ear commented 5 years ago

Can confirm that it works exactly as intended on kernel 5.0.18 with nvidia 418.74 without any freezing. 5.1 introduces freezes with a standard Kwin for me. The new kwin breaks Vsync so KDE devs should definitely find a way to fix their GLX swap buffers "fix". Legacy method of forcing triple buffering used to work, even at the cost of extra latency. Now it doesn't.

@tildearrow Thanks a lot for your effort and work! Right now, it is virtually the only way to get Vsync without stuttering, when running an Nvidia GPU.

lucasslima commented 5 years ago

I'm on versions:

kwin 5.15.6
kernel 5.1.5-2
mesa 19.0.5-1

I'm trying to reproduce the issue as hard as possible but didn't find that issue in the last couple of days. I'll try to find a case that reliably reproduces it.

By the way, just to send a message of appreciation for the project, this thing improved my Plasma experience quite a lot!

tildearrow commented 5 years ago

Sure. If you do reproduce the hang while not debugging, you may still be able to attach a debugger and provide a backtrace:

$ sudo gdb -p `pgrep kwin_x11`
(gdb) backtrace

(thanks for the message!)

An4cl3t0 commented 5 years ago

Been using for 2 days and completely stable on kwin 5.15.6 and linux 5.0.18-hardened. Thanks.

fvguilherme commented 5 years ago

I am using Manjaro this kwin with:

KDE Plasma: 5.15.5 KDE Frameworks: 5.58.0 Qt: 5.12.3 Kernel: 5.1.4-1-MANJARO NVidia 418.74-1 (MX150)

I can reproduce the bug and nothing has fix it. I found just a palliative: disable nvidia drm (options nvidia_drm modeset=1). That, however, cause some vertical tearing. So... It's tearing or hangs when using Edges. I choose the second one.

I already tried OpenGL 3.1 and 2.0 with VSync as "Never", but no success. A guy on Manjaro's official forum has solved the problem just installing kwin-lowlattency. So, I am confuse.

lucasslima commented 5 years ago

@fvguilherme , I assume you are using the Nvidia PRIME Sync? I had all sorts of problem with it when I was using it on my laptop with regular kwin (including absurd amounts of latency). You sure that doesn't happen on vanilla kwin?

fvguilherme commented 5 years ago

yes, you're right, I am using PRIME. And yes, the issue happen here with kwin-lowlatency. I tried with kernels 5.1.x, 5.0.x and 4.19.x-LTS, OpenGL 3.1 and 2.0 with VSync as "Never". Just two things has solved the problem: disable Compositor or set nvidia_drm modeset =0.

What worked for me (as palliative) to stop the freeze:

1 - nvidia_drm modeset =0 + OpenGL 2 - nvidia_drm modeset =1+ Compositor off 3 - nvidia_drm modeset =1 + Compositor on + XRender

The number 1 decrease performance on games. I got this when executing nvidia-settings:

$ nvidia-settings 

(nvidia-settings:3373): GLib-GObject-CRITICAL **: 23:10:08.370: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
GPU at BusId 0x1 doesn't have a supported video decoder

Maybe this can be the reason why kwin-lowlatency doesn't work for me.