GithubHelp home page GithubHelp logo

tildearrow / kwin-lowlatency Goto Github PK

View Code? Open in Web Editor NEW
374.0 21.0 10.0 61.94 MB

archived - X11 full-screen unredirection and lots'a settings for KWin

CMake 1.73% Shell 0.05% C++ 94.24% C 0.43% JavaScript 1.10% QML 2.18% Roff 0.09% GLSL 0.13% Python 0.05% Perl 0.01%
kde kwin

kwin-lowlatency's Introduction

archived

can't maintain this anymore... thanks everyone.

feel free to continue the project if you wish.

KWin-lowlatency

KWin-lowlatency is (was?) my attempt to reduce latency and stuttering in the popular KWin compositor used in KDE. since Plasma 5.21 the developers merged official patches which rewrite great parts of the compositing code, putting it on par with former KWin-lowlatency.

however, there's one thing that's not there yet: X11 full-screen unredirection....

Unredirection

the main aim of this project is to add additional settings to the compositor and bring back unredirection based on the direct scanout code. see unredirect.md for more details.

KWin-lowlatency is not...

  • perfect. it tries its best to allow full-screen unredirection to happen, but I can't promise this is always the case.
  • truly designed for low-end systems. if you use KWin-lowlatency in one of them, you may experience stuttering.

installation

Arch Linux

kwin-lowlatency is available in the AUR.

also available as a package in the CachyOS repository. thanks ptr1337!

Manjaro

Manjaro has updated Plasma to 5.23! follow the Arch Linux instructions.

openSUSE Leap and Tumbleweed

available at home:DarkWav:kwin-lowlatency. Leap is on 5.18 though.

other distributions/manual method

you can compile/install this yourself if your distro isn't listed here, or if you merely want to.

installing dependencies

you may need to install specific dependencies before compiling. here you can find a list.

acquiring the source

you can get the source code by using any of the following 2 methods:

git repo clone

$ git clone https://github.com/tildearrow/kwin-lowlatency.git
$ cd kwin-lowlatency

if you are not using the latest major version of Plasma (you can check by doing kwin_x11 --version), you may want to check out the branch for your version, e.g.:

$ git checkout Plasma/5.23

you may want to check the current stable version out:

$ git checkout v5.23.5

patch format

download stock KWin source and patch file:

$ wget https://download.kde.org/stable/plasma/5.23.5/kwin-5.23.5.tar.xz
$ wget https://tildearrow.org/storage/kwin-lowlatency/kwin-lowlatency-5.23.5.patch

extract:

$ tar -xvf kwin-5.23.5.tar.xz

patch:

$ cd kwin-5.23.5
$ patch -p1 < ../kwin-lowlatency-5.23.5.patch

building

Ubuntu

Ubuntu uses a different library path, which means you'll have to tweak the library dir:

$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DCMAKE_INSTALL_LIBEXECDIR=lib/x86_64-linux-gnu -DBUILD_TESTING=OFF ..
$ make

other distros

$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_LIBEXECDIR=lib -DBUILD_TESTING=OFF ..
$ make

installing

$ sudo make install

contacting original KWin development team

additional options menu

KWin-lowlatency introduces a few options in System Settings > Display and Monitor > Compositor. these options are documented in this section.

the options are:

  • Enable full-screen unredirection (X11): allows a full-screen application to bypass the compositor, which reduces latency.
  • Enable full-screen direct scanout (Wayland): same as above, but for Wayland.
  • Debug full-screen unredirection/direct scanout: writes unredirection/direct scanout check status to standard output on every frame, which is useful when it is not working and/or causing problems (KWin-lowlatency used to have problems with transparent dummy windows that stay on top hindering unredirection).
  • Force unredirection for non-opaque windows: ignores whether a full-screen window is transparent and attempts to unredirect anyway. may cause minor glitches.
  • My OpenGL is always safe!: tells the compositor to never set OpenGLIsUnsafe when it detects initialization problems. on vanilla KWin there is a bug which triggers a false-positive when KWin takes too long to start (e.g. on an HDD).
  • Set MaxFramesAllowed to 1 (NVIDIA only): sets __GL_MaxFramesAllowed to 1 which ensures the compositor will wait for vertical blank (use in conjunction with VSync mechanism described below). has no effect on AMD and Intel graphics.
  • Debug composite timer: writes the value of the composite timer to standard output on every frame. useful for debugging latency problems.
  • Render time estimator: this is a vanilla setting which isn't there for some reason. KWin-lowlatency adds it. may help with latency/stutter (use with caution).
  • VSync mechanism: forces a different vertical blank detection system from the default one. the options are:
    • Automatic: default KWin behavior.
      • uses Intel swap event if available (AMD and Intel (but I've heard it's disabled there due to bugs))
      • uses GLX_SGI_video_sync extension otherwise (NVIDIA) or GLX_OML_sync_control if the former isn't available.
      • worst case it falls back to using a timer (which may cause stuttering).
    • None: don't use anything at all. will increase latency in nearly every case.
    • Intel swap event: use the GLX_INTEL_swap_event extension (implemented by Mesa) for detecting the vertical blank. ironically this is not the default for Intel graphics due to some reason.
    • glFinish: use the glFinish() operation at the end of a frame to block until the next vertical blank interval. doesn't always work.
    • SGI video sync: use the GLX_SGI_video_sync extension to determine the next vertical blank.
    • OML sync control: use the GLX_OML_sync_control extension to determine the next vertical blank. not available on NVIDIA, or at least not yet.
    • SGI video sync busy-wait: use the GLX_SGI_video_sync extension, but poll every millisecond until the next vertical blank interval occurs. this option is there because there was a bug in Mesa which caused hangs when using the wait functions.
  • Action on crash: allows you to choose what happens when KWin-lowlatency crashes.
  • VSync pixel position (SGI/OML only): allows you to change the position of the dummy window created for detecting the next vertical blank when using SGI video sync or OML sync control. this may come in handy if you use more than one monitor.
  • Force disable VSync: turns VSync off completely. no need to pass an environment variable to do that anymore with KWin-lowlatency! may require restarting compositor manually.
    • use in conjunction with the settings above for some kind of multi-monitor support. not perfect though.

misc/FAQ

what's this "Paint cursor" effect in Desktop Effects?

it's an effect I wrote back in 2018 when experimenting with kmsgrab for some private recordings. it basically redraws the cursor. this may seem redundant, but actually is helpful for recording with kmsgrab (since it doesn't draw the hardware sprite).

the following applications may benefit from the usage of this effect:

  • FFmpeg (kmsgrab input device)
  • darmstadt
  • w23's drmtoy/linux-libdrm-grab OBS plugin

will this work under Wayland?

it probably will, but there isn't too much difference

do you have any plans to upstream this?

the unredirection part? maybe. I'll think about it.

unredirection is not working.

please see unredirect.md for known issues. you may file a bug report as well.

Support (bugs?)

use the issues section at the top. but wait! before reporting an issue, first test it again on the official KWin to determine whether this is really a KWin-lowlatency-only bug.

if the bug also reproduces in official KWin, please file a bug on their bug tracker instead.

Developing on KWin

the hacking documentation has information on how to build and start KWin.

kwin-lowlatency's People

Contributors

aleixpol avatar aseigo avatar bam80 avatar bhush9 avatar coolo avatar d1saster avatar davidedmundson avatar dfaure avatar ismailof avatar jriddell avatar kbroulik avatar llunak avatar lmurray avatar luebking avatar mgraesslin avatar mikelima avatar montel avatar mwoehlke avatar nicolasfella avatar notmart avatar pointedstick avatar romangg avatar sebasje avatar sgiessl avatar skelet avatar tibirna avatar tildearrow avatar yurchor avatar zamundaaa avatar zzag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kwin-lowlatency's Issues

Unclear settings.

The application doesnt make it clear enough what the difference is between responsiveness and low latency. They seem like roughly the same thing. Maybe changing the names to something more understandable would be a good idea? ( I am still confused for one, because in the readme, you dont explain what the responsiveness option does, only latency)

kwin-lowlatency still hangs on Mesa even with glFinish

After several hours of usage, the compositor may hang. This is hard to reproduce, as it requires me to get on my computer at 3-4pm so it reproduces at around 10pm-12am.

Let's hope the glFinish method isn't the culprit........

Is this supposed to work on Nvidia?

It doesn't seem make a difference on Nvidia. Firefox still stutters while scrolling, so setting the MaxFPS option is still needed to make it smooth. I tried adding the modeset=1 parameter to nvidia_drm, but that didn't make a difference. Nor did the sync to vblank option in nvidia-settings.

I also tried using nouveau but that didn't even have vsync working and was stuttery, though I did see multiple lines of tearing.

If it matters I tried both the 5.15.3 and 5.15.4 versions.

KWin freezing

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.

Build error when applying patch to kwin 5.16.0

Building the kwin-lowlatency Plasma/5.16 branch directly works fine. However, generating a patch with patch.sh and applying it to vanilla kwin 5.16.0, results in a build error:

[  3%] Linking CXX shared library ../bin/libkwin4_effect_builtins.so
/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/kwin4_effect_builtins.dir/effect_builtins.cpp.o: in function `KWin::Effect* KWin::BuiltInEffects::createHelper()':
effect_builtins.cpp:(.text._ZN4KWin14BuiltInEffects12createHelperINS_14MousePosEffectEEEPNS_6EffectEv[_ZN4KWin14BuiltInEffects12createHelperINS_14MousePosEffectEEEPNS_6EffectEv]+0x1a): undefined reference to `KWin::MousePosEffect::MousePosEffect()'
collect2: error: ld returned 1 exit status

Add patch files

It would be useful to have a list of patch files used to create kwin-lowlatency to on top of kwin.

Multiple monitors with different refresh rates

I am very excited about this project. Upstream kwin does bad job when it deals with multiple monitors of different refresh rates. They get locked down to lowest available refresh rate. Do you plan to solve this and allow each monitor run at it's own refresh rate? I found that Option "TearFree" "true" option somewhat remedies the situation but it is not perfect. There still is some stuttering, albeit almost inperceivable.

Failed build from Aur on Manjaro

No extensive error, just the quiet death as I call it:

home/gstarr/.cache/yay/kwin-lowlatency/src/kwin-lowlatency/screenlockerwatcher.cpp: In member function ‘void KWin::ScreenLockerWatcher::serviceOwnerChanged(const QString&, const QString&, const QString&)’:
/home/gstarr/.cache/yay/kwin-lowlatency/src/kwin-lowlatency/screenlockerwatcher.cpp:84:62: error: ‘AboutToLock’ is not a member of ‘OrgKdeScreensaverInterface’
   84 |         connect(m_kdeInterface, &OrgKdeScreensaverInterface::AboutToLock, this, &ScreenLockerWatcher::aboutToLock);
      |                                                              ^~~~~~~~~~~
make[2]: *** [CMakeFiles/kwin.dir/build.make:1109: CMakeFiles/kwin.dir/screenlockerwatcher.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2147: CMakeFiles/kwin.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
Error making: kwin-lowlatency

No warning, everytjing going fine, and then it just fails suddenly.

Kwin crashing when exiting World of Warcraft Classic

I've been having consistent crashes due to a seg fault when exiting World of Warcraft Classic while it is in fullscreen. I mistakenly sent a bug report to KDE bugtracking before remembering that I'm using kwin-lowlatency. The bug report contains a backtrace and system info. I'm not sure if this is specific to only World of Warcraft Classic but it has been occurring consistently while playing it through multiple Wine versions.

Let me know if I can provide some more information.

kwin-lowlatency and nvidia 435.17 - performance regression?

It seems that kwin-lowlatency doesn't work well together with the latest nvidia driver.
Performance (scrolling, moving windows, hovering menus, etc.) is noticeably worse than before with driver 430.40.
Going back to either default kwin or to the previous driver solves this.
What I haven't tried yet is to recompile kwin-lowlatency, although I'm not sure whether and how that would change anything.

(Manjaro, kwin 5.16.4, kernel 4.19, GTX 1070)

Cannot enable compositor on Kubuntu

Hi,

I apologize in advance if Kubuntu/Ubuntu is not supported. I recently compiled and installed kwin-lowlatency with all required dependencies installed. There were no issue during installation but I found that I cannot enable the compositor anymore. Every time I turn on the compositor, kwin crashes several times and reverts to running without a compositor.

I am using Kubuntu 19.04, the latest kwin-lowlatency (5.16.2) and nvidia 430 drivers. I used the repo clone step to get the source and compile it.

Attached is my kwin crash backtrade: kwin_x11-20190628-133015.kcrash.txt.

Thanks

5.16.90 compatibility?

I like to live on the edge and so I use Plasma 5.16.90, but the only thing I can't use still is kwin-5.16.90 because your patch fails on the kwin-5.16.90 source code. Are you planning to make it compatible soon? :D

The freeze fix commit causes high CPU load and high latency increase

Using 5.15.6 causes one CPU core to nearly max out when there's changes on the desktop (like moving a window or playing a video). It also causes a big increase in latency. Reverting commit 73f09f6 fixes the issue.

This is on a GTX 980 Ti using the nvidia 430.14 driver on an AMD64 Gentoo install. Plasma 5.15.5. X.Org server 1.20.5.

Incompatible with Qt 5.13

When compiling against Qt 5.13, compiling fails at the following part:

[ 90%] Building CXX object plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/KWinQpaPlugin_autogen/mocs_compilation.cpp.o
[ 90%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/KWinWaylandDrmBackend_autogen/mocs_compilation.cpp.o
[ 90%] Building CXX object plugins/kglobalaccel/CMakeFiles/KF5GlobalAccelPrivateKWin.dir/kglobalaccel_plugin.cpp.o
[ 90%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_backend.cpp.o
[ 90%] Linking CXX shared module ../../bin/kf5/org.kde.kidletime.platforms/KF5IdleTimeKWinWaylandPrivatePlugin.so
[ 90%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_object.cpp.o
[ 90%] Building CXX object plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/abstractplatformcontext.cpp.o
make[2]: Leaving directory '/home/vistaus/Apps/from=git/kwin-lowlatency/build'
[ 90%] Built target KF5IdleTimeKWinWaylandPrivatePlugin
[ 90%] Building CXX object plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/backingstore.cpp.o
In file included from /home/vistaus/Apps/from=git/kwin-lowlatency/main_x11.cpp:28:
/home/vistaus/Apps/from=git/kwin-lowlatency/xcbutils.h: In function ‘QVector<xcb_rectangle_t> KWin::Xcb::regionToRects(const QRegion&)’:
/home/vistaus/Apps/from=git/kwin-lowlatency/xcbutils.h:1790:53: warning: ‘QVector<QRect> QRegion::rects() const’ is deprecated: Use begin()/end() instead [-Wdeprecated-declarations]
     const QVector<QRect> regionRects = region.rects();
                                                     ^
In file included from /usr/include/QtGui/qmatrix.h:45,
                 from /usr/include/QtGui/qtransform.h:43,
                 from /usr/include/QtGui/qimage.h:48,
                 from /usr/include/QtGui/QImage:1,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/libkwineffects/kwinglobals.h:25,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/main.h:25,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/main_x11.h:22,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/main_x11.cpp:22:
/usr/include/QtGui/qregion.h:127:20: note: declared here
     QVector<QRect> rects() const;
                    ^~~~~
[ 90%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_object_connector.cpp.o
[ 90%] Linking CXX shared module ../../bin/org.kde.kglobalaccel5.platforms/KF5GlobalAccelPrivateKWin.so
[ 90%] Linking CXX shared library bin/libkdeinit5_kwin_x11.so
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_object_crtc.cpp.o
make[2]: Leaving directory '/home/vistaus/Apps/from=git/kwin-lowlatency/build'
[ 91%] Built target KF5GlobalAccelPrivateKWin
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_object_plane.cpp.o
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_output.cpp.o
make[2]: Leaving directory '/home/vistaus/Apps/from=git/kwin-lowlatency/build'
[ 91%] Built target kdeinit_kwin_x11
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_buffer.cpp.o
[ 91%] Building CXX object plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/integration.cpp.o
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_inputeventfilter.cpp.o
/home/vistaus/Apps/from=git/kwin-lowlatency/plugins/qpa/integration.cpp:48:10: fatal error: QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h: No such file or directory
 #include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/build.make;102: plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/integration.cpp.o] Error 1
make[2]: Leaving directory '/home/vistaus/Apps/from=git/kwin-lowlatency/build'
make[1]: *** [CMakeFiles/Makefile2;9176: plugins/qpa/CMakeFiles/KWinQpaPlugin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/logging.cpp.o
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/scene_qpainter_drm_backend.cpp.o
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/screens_drm.cpp.o
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/egl_gbm_backend.cpp.o
[ 91%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/drm_buffer_gbm.cpp.o
[ 92%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/gbm_surface.cpp.o
[ 92%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/remoteaccess_manager.cpp.o
[ 92%] Building CXX object plugins/platforms/drm/CMakeFiles/KWinWaylandDrmBackend.dir/egl_stream_backend.cpp.o
In file included from /home/vistaus/Apps/from=git/kwin-lowlatency/toplevel.h:28,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/scene.h:24,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/plugins/platforms/drm/egl_stream_backend.cpp:29:
/home/vistaus/Apps/from=git/kwin-lowlatency/xcbutils.h: In function ‘QVector<xcb_rectangle_t> KWin::Xcb::regionToRects(const QRegion&)’:
/home/vistaus/Apps/from=git/kwin-lowlatency/xcbutils.h:1790:53: warning: ‘QVector<QRect> QRegion::rects() const’ is deprecated: Use begin()/end() instead [-Wdeprecated-declarations]
     const QVector<QRect> regionRects = region.rects();
                                                     ^
In file included from /usr/include/QtGui/QRegion:1,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/platformsupport/scenes/opengl/backend.h:25,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/platformsupport/scenes/opengl/abstract_egl_backend.h:22,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/plugins/platforms/drm/egl_stream_backend.h:22,
                 from /home/vistaus/Apps/from=git/kwin-lowlatency/plugins/platforms/drm/egl_stream_backend.cpp:20:
/usr/include/QtGui/qregion.h:127:20: note: declared here
     QVector<QRect> rects() const;
                    ^~~~~
[ 92%] Linking CXX shared module ../../../bin/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so
make[2]: Leaving directory '/home/vistaus/Apps/from=git/kwin-lowlatency/build'
[ 92%] Built target KWinWaylandDrmBackend
make[1]: Leaving directory '/home/vistaus/Apps/from=git/kwin-lowlatency/build'
make: *** [Makefile;130: all] Error 2
vistaus@solus ~/A/f/k/build>

Add clarification to README

It would be nice, if you could add a note to the README on whether you are planning on upstreaming your work at some point.

On high refresh rate monitors, Chrome still runs at 60fps until I do kwin_x11 --replace

So kwin_lowlatency does a great job of detecting and setting my 144Hz monitor and correctly making the compositor repaint at 144Hz, unlike regular kwin. However, it still has the same bug where certain apps will still repaint at 60Hz. I've already submitted a similar bug for this issue on the official KDE bug tracker, but it's over a year old and the developer is completely unresponsive on it now. So I figured I'd post the bug here since this issue is very closely related to latency and stutter.

The biggest example of this bug is Google Chrome/Chromium (and I am assuming all apps that use Chromium embedded, like Discord). Here are steps to reproduce.

  1. Attach a single 144Hz monitor. (Although, I have a feeling this bug will occur on all monitors capable of > 60Hz)
  2. Go to Display settings and set the refresh rate to 144Hz.
  3. Reboot and log in.
  4. Launch Google Chrome and go to www.vsynctester.com. Note that the screen repaints at 60Hz.
  5. Relaunch kwin_lowlatency with kwin_x11 --replace
  6. Notice that www.vsynctester.com now reports 144Hz. Animations are also much smoother.

You can also verify this by using qdbus org.kde.KWin /KWin supportInformation before and after kwin_x11 --replace. In the Screen 0 section, this command will report refresh rate is at 60. After restarting kwin, the command correctly reports the actual refresh rate of 144Hz.

Workarounds

  1. If I set the SDDM login screen to run at 144Hz, then Google Chrome will run at 144Hz on first login. Usually SDDM defaults to 60Hz. I am guessing when Kwin is setting the monitor frequency on login, it isn't setting the right values in all the places it needs to?
  2. If you put kwin_x11 --replace inside an Autostart script, this also fixes the issue on login.

Neither of these workarounds are optimal though because if you change the refresh rate later on in Display settings, the affected apps will still run at the old refresh rate.

Sorry if this is too long winded of a report, I'd be happy to provide more info and help with debugging.

Thanks for all your great work!

kwin_x11 crashes

I tried to install kwin_lowlatency on Clear Linux and it compiles and installs fine, but it doesn't work as kwin crashes immediately upon booting and it can't be started manually either. Here's the output of kwin_x11 --replace :

vistaus@ThinkClear ~>kwin_x11 --replace
Module 'org.kde.kwin.decoration' does not contain a module identifier directive - it cannot be protected from external registrations.
Application::crashHandler() called with signal 11; recent crashes: 4
KCrash: Application 'kwin_x11' crashing...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
Icon theme "Yaru" not found.

gdb does show a symbol lookup error for kwin, but there's no backtrace:

vistaus@ThinkClear~/Apps/from=git/kwin-lowlatency/build $ QT_PLUGIN_PATH="$PWD/bin" gdb ./bin/kwin_x11
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-generic-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
--Type <RET> for more, q to quit, c to continue without paging--c
Reading symbols from ./bin/kwin_x11...
(gdb) run --replace
Starting program: /home/vistaus/Apps/from=git/kwin-lowlatency/build/bin/kwin_x11 --replace
source: Error encountered while sourcing file “/home/vistaus/.local/share/omf/init.fish”:
source: No such file or directory
/home/vistaus/Apps/from=git/kwin-lowlatency/build/bin/kwin_x11: symbol lookup error: /home/vistaus/Apps/from=git/kwin-lowlatency/build/bin/libkwin.so.5: undefined symbol: _ZN12ScreenLocker7KSldApp4lockENS_13EstablishLockEi
[Inferior 1 (process 2584) exited with code 0177]
(gdb) backtrace
No stack.

Could you help me solve this?

Screen tearing in DXVK game

When running kwin-lowlatency I see screen tearing in Diablo 3 running with DXVK, regardless of the state of the in-game VSync setting. In case it's relevant, the game is running in a Wine virtual desktop (to fix a disappearing cursor bug). My GPU is an AMD Radeon RX 570.

Broken/slowed down Animations when VSync is turned off

Video of the problem

Since the 5.16.5 update, kwin-lowlatency has issues with animations on my system. The video demonstrates whats happening. Animations are being played really slowly or even getting stuck, until something else on the screen is drawn. Like selecting something on the desktop or moving another window while the animation is being played, fixes the animation.
Even recording the screen altered this behaviour quiet a bit. Animations were being played more smoothly, depending on the recordingframerate, although still still stuttery and not at the right speed.

This happens when the vsync mechanism is set to anything else, but "SGI video sync with horrible hack" or backend set to Xrender. Also disabling my second monitor does not change this behaviour. Upstream kwin works as intended on my system.

Let me know, if you need any more information or testing.

edit: Using Xrender shows the same problem Problem.

My system:
Arch Linux
Nvidia 435.21 (GTX 970)
Intel i7-8700k
kwin 5.16.5
plasmashell 5.16.5

5.16.5 tag is missing the "v" prefix

Just a minor nitpick: The latest 5.16.5 tag is missing the "v" prefix ("v5.16.5"), so a few automatic builders may fail due to this. You might want to replace the current "5.16.5" with "v5.16.5", add a new "v5.16.5" tag or just ignore this and let maintainers handle it on their end. (Eg. this breaks the AUR package right now.)

Build failed on Arch

[ 92%] Building CXX object plugins/platforms/virtual/CMakeFiles/KWinWaylandVirtualBackend.dir/logging.cpp.o [ 92%] Linking CXX shared module ../../../bin/org.kde.kwin.waylandbackends/KWinWaylandWaylandBackend.so [ 92%] Built target KWinWaylandWaylandBackend [ 92%] Linking CXX shared module ../../../bin/org.kde.kwin.waylandbackends/KWinWaylandVirtualBackend.so [ 92%] Built target KWinWaylandVirtualBackend [ 92%] Linking CXX shared module ../../../bin/org.kde.kwin.waylandbackends/KWinWaylandDrmBackend.so [ 92%] Built target KWinWaylandDrmBackend make: *** [Makefile:130: all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... Error making: kwin-lowlatency

alt + tabbing back into Wine fullscreen windows makes them freeze

It seems to affect any Wine fullscreen window and is not related to unredirect:
Start any game (e.g. vkquake or Heroes of the Storm) in Wine in fullscreen mode. Then use alt + tab to switch to the desktop and use it again to switch back into the game. Result: The game's window stays black and freezes (while audio continues running), its process has to be killed to make the system usable again.
This does not happen with native Linux games.

The issue does not occur when applications are allowed to suspend KWin, so the checkbox for it should be unticked when trying to reproduce.

Log file for vkquake in Wine (not sure if it contains the required information):
kwin.log

Opensuse RPM packaging error?

Problem: kwin-lowlatency-5.16.2-2.3.x86_64 requires libQt5Core.so.5(Qt_5.12.3_PRIVATE_API)(64bit), but this requirement cannot be provided

deleted providers: libQt5Core5-5.12.3-2.1.x86_64
 Solution 1: Following actions will be done:
  keep obsolete libQt5Core5-5.12.3-2.1.x86_64
  keep obsolete libQt5Gui5-5.12.3-2.1.x86_64
  keep obsolete libQt5DBus5-5.12.3-2.1.x86_64
 Solution 2: deinstallation of kwin-lowlatency-5.16.2-2.3.x86_64
 Solution 3: break kwin-lowlatency-5.16.2-2.3.x86_64 by ignoring some of its dependencies

This is on tumbleweed trying to update to latest snapshot.

Bug in Screen Edges

edgeconfig
I'm not sure what you mean by "relogging in." This change in the settings is consistent across both the laptop and desktop KDE Manjaro installs, and I've rebooted both at least a half dozen times. Anything else I can provide you?

Originally posted by @Iiari in #22 (comment)

Why is there a "Paint cursor" in the Screen Edges config?

half vsync with nvidia 435.21 and opengl compositing

Hello,
I just upgraded to 435.21 earlier tonight (on archlinux) and am having worse performance than with nvidia 435.17 (re: #36 ). kwin-lowlatency seems to only be running at half vsync (refresh rate at 60 appeared to be 30fps, 30hz appeared to be 15fps, etc) This included scrolling in various windows, moving windows, etc. Xrender compositing was unaffected. Installing regular kwin restored normal opengl compositing functionality. Willing to help test possible solutions or scenarios.

Sometimes it doesn't register keyboard shortcuts

Sometimes when starting KWin-lowlatency and pressing Alt-Tab, it literally passes Alt-Tab to the focused application, effectively not allowing me to switch between windows until I restart the compositor.

[Feature] Re-implement Click-to-Close in Present Window Effect

Hi! First of all: thanks for the great work you are doing. Although changing my nVidia card for an AMD card, helped a lot, I still see much better performance using your fork of kwin.

As you maybe are aware, there was a very controversial decision to remove the click-to-close functionality from the Present Window effect. Luckily, it is very easy to patch kwin to add the feature again.

I am currently applying a similar patch when building kwin and it works just fine. I was wondering whether you would consider adding this to your fork?

feature request: use existing window rules to block unredirect for defined applications

It would be nice if it was possible to exclude single programs/windows from auto unredirect, e.g. media players for smooth OSD pop ups etc.

With KWin's given feature set, it is already possible to create rules to prevent single applications from turning off the compositor. Perhaps auto-unredirect could simply honor them as well?

That being said: When a window is unredirected and I press the media volume control buttons of my keyboard, the volume OSD triggers the compositing to be temporarily enabled. This allows transparency and an animation, however it also creates stutter when composting turns on and off. Would it be possible to implement an option to keep compositing also entirely turned off in such situations?
It supposedly can also cause issues with FreeSync like flickering.

[RFE] Ubuntu ppa

Would be nice to expose this for more people. Having easily installable .deb in Ubuntu ppa might help to bring this to wider audience and improve testing as a result.

Patch for 5.15.5 does not compile

The patch from the website for kwin 5.15.5 does not compile due to:

kwin/u/rpmbuild/BUILD/kwin-5.15.5/scripting/scriptedeffect.cpp:156:15: error: 'options' was not declared in this scope
  156 |       switch (options->animationCurve()) {
      |               ^~~~~~~

[Feature idea] Re-implement fullscreen unredirection back

First of all, thanks for this, it's working really well for me, no issues yet and browsers/scrolling is smooth as butter now, I've finally come back from compton :) Oddly enough my trusty stutterless compton was the old one with --vsync=opengl, which used the same method you implemented here (dev deprecated it recently).

Now to the point, kwin used to do fullscreen unredirection so you could play games without compositor overhead and still alt+tab to a composited desktop. Mutter and compton still can do that but kwin deprecated it in favor of totally disabling it with a Block composition window rule OR by application's request (https://blog.martin-graesslin.com/blog/2016/08/opengl-changes-in-kwin-compositing/). What's your thoughts on bringing the feature back, at least as an option? Seems to align with the forks goal.

Autotests don't build anymore

projects/kwin/scripting/scriptedeffect.cpp: In function ‘KWin::AnimationSettings KWin::animationSettingsFromObject(QScriptValue&)’:
projects/kwin/scripting/scriptedeffect.cpp:156:15: error: ‘options’ was not declared in this scope
       switch (options->animationCurve()) {
               ^~~~~~~
projects/kwin/scripting/scriptedeffect.cpp:156:15: note: suggested alternative: ‘Motion’
       switch (options->animationCurve()) {
               ^~~~~~~
               Motion
make[2]: *** [autotests/CMakeFiles/testScriptedEffectLoader.dir/build.make:160: autotests/CMakeFiles/testScriptedEffectLoader.dir/__/scripting/scriptedeffect.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:9299: autotests/CMakeFiles/testScriptedEffectLoader.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Apparently caused by the addition of the Animation curve option.

Recommendations for safely uninstalling?

Hello. I see a dramatic improvement with one of my machines with your package (congrats!) but not so much another, and I want to remove it without breaking anything else. Advice? Keep all dependencies I presume. Anything else? Thank you!

Add these extra instructions to compilation guide

(I'm not a C++ dev or KDE expert, just a dev trying to make their gorram laptop work more betterer. There was a lot of stumbling here. Recommend you add these directions, it will make this much easier for that expert-non-c++-dev userbase. Yes, its basic.)

Tell people to run
kwin --version
in order to determine the version of kwin installed on their system. and then some of the branches to check out onto / links for a couple different common versions of kwin-lowlatency for those wget endpoints.

(Assumption: kwin version should match the various KDE framework versions that are available for them on their distro, right? I mean that its a decent proxy, and if someone is compiling for a different target/version/whatever or somehow have a non-normal kwin version present then they obviously wont need this help.)

Provide a link to the dependency lists installation page for KDE. I understand that it is most desirable to send peeps to the hacking.md file (which has a link that eventually gets you here) but as there is no .deb for K/Ubuntu at this time, and as such compilation is required for us, it would be nice to have such a link up front.
https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Install_the_dependencies

5.15.90 Transparent titlebars

The titlebars are almost fully transparent (there is a outline on the outside where the border usually ends). Compiled it from 2048e9f 5.15.90.

Seems to work otherwise, and it seems to allow me to fully interact with the buttons that are invisible.

Using a RX 560 on Arch Linux and AMDGPU drivers.

FF scrolling : smooth at 144 Hz / slightly jerky at 120 Hz ?

Hi !

I own a 144 Hz monitor with an NVIDIA card (Neon distro), 435.x drivers. I noticed that, when switching to 120 Hz (which I thought was relevant for instance for some emulators that are smooth at a multiple of 60 Hz and not at 144 Hz...), the FF scrolling was turning slightly jerky while it's absolutely butter smooth at 144 Hz.

Is that expected ? I find it a little surprising but there might be an explanation ? Well, most people would find it acceptable as it's a little subtle.

(OT : I noticed also that when switching my monitor manually to a different frequency -- not through the control panel but with the monitor buttons --, the screen turned black -- it doesn't happen under Mutter / Muffin for instance. I'm not sure under the vanilla kwin, I should try. Same when enabling Freesync).

Add upstream commits

Specifically those that improve desktop effects appearance such as blur. If the latency changes are small, it shouldnt be too hard to implement.

Is glFinish really the answer?

Hi,

Disclaimer: i have no clue how KWin's code works internally or what the actual issue is. So i could be totally wrong here.

It appears to me like you found a feature (glFinish) and think it is the answer to the timer based approach KWin has (or had). But is it really?

If i google on glFinish, the very first result i get is a small post (from Kronos itself!) to get rid of it because it's heavyweight. See: https://www.opengl.org/pipeline/article/vol001_6

Quote:

Say you are rendering to a texture in one context while another context needs to use the result of that rendering. You do this by inserting a fence right after the rendering to texture commands in the one context and waiting for the fence to complete in the other context. Again, there is no need to call glFinish!

That seems to be exactly what you need.
You shouldn't need to worry about driver support as it has very wide support: https://mesamatrix.net/ (search for GL_ARB_sync).

Other forum posts seem to indicate that glFinish was the pre-opengl-3.2 way of doing things, and since 3.2 there is GL_ARB_sync with glWaitSync that seems to be the recommended way https://community.khronos.org/t/glflush-or-glfinish-with-mulithreading/61309/2

Again, i might be wrong in all of this...

Cheers,
Mark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.