This guide is to improve the KDE Plasma experience on X11. It particularly applies to those using the modesetting driver (mainly Intel graphics cards)
This is a crucial step. XLibre and xorg-git contain the "TearFree" feature for modesetting, which is not available in the standard releases. If you use a driver other than modesetting, check that the TearFree option exists for your driver.
Installation depends on the distribution you use. On Arch Linux and derivatives:
Xorg-git:
sudo yay -S xorg-server-git xorg-server-devel-git xorg-server-common-git xorgproto-git
sudo yay -S xf86-input-libinput-git
Xlibre:
see here for PKGBUILDS or here for an Arch repo with binary packages.
TearFree should be on by default, but you can configure things better
Creates a file called /etc/X11/xorg.conf.d/20-modesetting.conf with this content
Section "Device"
Identifier "My GPU Name"
Driver "modesetting"
Option "ShadowFB" "false" # you don't need on recent hardware
#Option "Atomic" "true" #only effective on Xlibre, or Xorg-git with a special patch
Option "TearFree" "true"
EndSection
Creates a file called /etc/X11/xorg.conf.d/15-dmabuf.conf with this content
Section "ServerFlags"
Option "Debug" "dmabuf_capable"
EndSection
Now that we have activated TearFree, the X11 server will take care of the tearing, so we can deactivate Kwin's functions in this regard.
Let's create a file /home/$USER/.config/plasma-workspace/env/kwin_env.sh
with this content:
export KWIN_PERSISTENT_VBO=1 #default?
export KWIN_USE_BUFFER_AGE=1 #default
export KWIN_EXPLICIT_SYNC=0 #Xorg takes care of it
export KWIN_X11_NO_SYNC_TO_VBLANK=1 #Xorg takes care of it
export KWIN_USE_INTEL_SWAP_EVENT=1 #not default, should be relevant only on glx, but we are going to use EGL
Let's make the file executable with
chmod +x /home/$USER/.config/plasma-workspace/env/kwin_env.sh
Now let's disable the synchronisation of Quick Scene Graph (a function of the QT libraries) but only for Kwin, not for the rest of the system, since for plasmashell and other parts of the system it is useful.
sudo mkdir /etc/systemd/user/plasma-kwin_x11.service.d/
Create a file /etc/systemd/user/plasma-kwin_x11.service.d/10-kwin_smoother.conf
With this content
[Service]
Environment="QSG_NO_VSYNC=1"
QT and Kwin work better using the EGL interface instead of the traditional GLX.
Create a file /etc/profile.d/egl.sh
with this content:
export QT_XCB_GL_INTEGRATION=xcb_egl
export KWIN_OPENGL_INTERFACE=egl
export GST_GL_PLATFORM=egl #this is not related to kwin, but it's useful
make it executable
sudo chmod +x /etc/profile.d/egl.sh
However, you may encounter some bugs with Libreoffice's OpenGL alimations. In this case you can modify the Impress launcher in menu, to use glx instead of EGL.
In the Enviroment variable: QT_XCB_GL_INTEGRATION=xcb_glx
With QTWebEngine based apps, you don't need to fall back to EGL if suoi set
export QTWEBENGINE_CHROMIUM_FLAGS="--use-gl=angle --use-angle=vulkan"
in a /etc/profile.d/ file like /etc/profile.d/egl.sh created above.
By default, Qt only uses the GPU for QtQuick objects (for example, in KDE it is used for Plasmashell, Discover, System Settings, etc.) but not for traditional Qt Widgets. However, starting with Qt 6.8, it is also possible to force the rendering of these with the GPU. It is not recommended to do this at the system level, but you can try it for individual apps by entering the environment variable in the launcher.
QT_WIDGETS_RHI=1
The default is OpenGL, which works well, but you can also choose Vulkan, which, however, currently (Qt 6.10) causes numerous problems.
QT_WIDGETS_RHI_BACKEND=vulkan
Please note that some applications will force the rendering of every single frame and effectively slow down the interface update.
GTK uses OpenGL acceleration by default, but it is possible to use Vulkan, which is faster.
export GSK_RENDERER=vulkan
(GSK is not a typo, GSK is the GTK rendering abstraction; it provides a low level rendering API to GTK in terms of draw operations, and converts them into commands for the graphics pipeline.)
Unlike Qt, using Vulkan with Vulkan does not cause any problems (it is the default on Wayland).
Kwin has some problems handling mixed refresh rates (e.g. a 144 Hz monitor and a 60 Hz monitor), but it can this way.
kate $HOME/.config/plasma-workspace/env/kwin_env.sh
add this lines
export KWIN_X11_REFRESH_RATE=144000 # the refresh rate of the fastest monitor * 1000, in this case 144 Hz. In most cases, this line is sufficient. Test it before adding the third one.
export KWIN_X11_NO_SYNC_TO_VBLANK=1
export KWIN_X11_FORCE_SOFTWARE_VSYNC=1
Make the file executable, then close the session and login again.
They say Wayland is better and more modern, but it lacks this essential function, without which it is a drama to use many apps.
X11, on the contrary, has had it for years! Kinetic scrolling implemented server-side in the touchpad driver.
Unfortunately, in the changeover to Plasma 6 they removed the driver configuration (heaven forbid someone stays on X11 because of this great feature!), but you can do it with a configuration file.
First, install the driver:
sudo pacman -S xf86-input-synaptics
Then create the configuration file:
kate /etc/X11/xorg.conf.d/70-synaptics.conf
copy&paste this then logout and login. Enjoy all apps with Inertial Scrolling! More information here (ignore the warning about the driver is "no longer actively updated", it works perfectly with practically all touchpads)
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
Option "Protocol" "event"
Option "SHMConfig" "on"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
MatchDevicePath "/dev/input/event*"
Option "LeftEdge" "140"
Option "RightEdge" "3372"
Option "TopEdge" "131"
Option "BottomEdge" "2311"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "MaxTapTime" "180"
Option "MaxTapMove" "110"
Option "MaxDoubleTapTime" "180"
Option "SingleTapTimeout" "180"
Option "ClickTime" "100"
Option "EmulateMidButtonTime" "0"
Option "EmulateTwoFingerMinZ" "282"
Option "EmulateTwoFingerMinW" "7"
Option "VertScrollDelta" "78"
Option "HorizScrollDelta" "155"
Option "VertEdgeScroll" "0"
Option "HorizEdgeScroll" "0"
Option "CornerCoasting" "0"
Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "1"
Option "MinSpeed" "1"
Option "MaxSpeed" "25"
Option "AccelFactor" "0.04"
Option "TouchpadOff" "0"
Option "LockedDrags" "0"
Option "LockedDragTimeout" "5000"
Option "RTCornerButton" "0"
Option "RBCornerButton" "0"
Option "LTCornerButton" "0"
Option "LBCornerButton" "0"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "ClickFinger1" "1"
Option "ClickFinger2" "3"
Option "ClickFinger3" "2"
Option "CircularScrolling" "0"
Option "CircScrollDelta" "0.10472"
Option "CircScrollTrigger" "0"
Option "CircularPad" "0"
Option "PalmDetect" "1"
Option "PalmMinWidth" "8"
Option "PalmMinZ" "100"
Option "CoastingSpeed" "20"
Option "CoastingFriction" "50"
Option "PressureMotionMinZ" "30"
Option "PressureMotionMaxZ" "160"
Option "PressureMotionMinFactor" "1"
Option "PressureMotionMaxFactor" "1"
Option "GrabEventDevice" "0"
Option "TapAndDragGesture" "1"
Option "AreaLeftEdge" "0"
Option "AreaRightEdge" "0"
Option "AreaTopEdge" "0"
Option "AreaBottomEdge" "0"
Option "HorizHysteresis" "21"
Option "VertHysteresis" "21"
Option "ClickPad" "1"
Option "RightButtonAreaLeft" "1756"
Option "RightButtonAreaRight" "0"
Option "RightButtonAreaTop" "2002"
Option "RightButtonAreaBottom" "0"
Option "MiddleButtonAreaLeft" "0"
Option "MiddleButtonAreaRight" "0"
Option "MiddleButtonAreaTop" "0"
Option "MiddleButtonAreaBottom" "0"
EndSection
Section "InputClass"
Identifier "touchpad ignore duplicates"
MatchIsTouchpad "on"
MatchOS "Linux"
MatchDevicePath "/dev/input/mouse*"
Option "Ignore" "on"
EndSection
# This option enables the bottom right corner to be a right button on clickpads
# and the right and middle top areas to be right / middle buttons on clickpads
# with a top button area.
# This option is only interpreted by clickpads.
Section "InputClass"
Identifier "Default clickpad buttons"
MatchDriver "synaptics"
Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%"
EndSection
# This option disables software buttons on Apple touchpads.
# This option is only interpreted by clickpads.
Section "InputClass"
Identifier "Disable clickpad buttons on Apple touchpads"
MatchProduct "Apple|bcm5974"
MatchDriver "synaptics"
Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
EndSection
sudo yay -S material-kwin-decoration-git # for Locally integrated menu
kwin-x11 with backports: kwin-x11-lite
libinput-gestures-qt for gestures (yes, it works even if you use the Synaptics driver for your touchpad!)
options i915 enable_guc=3 enable_fbc=1 nuclear_pageflip=1 enable_dmc_wl=1
<driconf>
<device>
<application name="Default">
<option name="mesa_glthread" value="true" />
<option name="force_glsl_extensions_warn" value="false" />
<option name="mesa_no_error" value="true" />
<option name="mesa_glthread_app_profile" value="1" />
<option name="mesa_glthread_driver" value="true" />
</application>
<application name="glxgears" executable="glxgears">
<option name="mesa_glthread" value="true" />
<option name="force_glsl_extensions_warn" value="false" />
<option name="mesa_no_error" value="true" />
<option name="vblank_mode" value="0" />
<option name="mesa_glthread_app_profile" value="1" />
<option name="mesa_glthread_driver" value="true" />
</application>
</device>
</driconf>
/etc/profile.d/VULKAN_VIDEO_ON.sh (must be executable)
export ANV_DEBUG=video-decode,video-encode
/etc/profile.d/mesa.sh (must be executable)
export INTEL_COMPUTE_CLASS=1
export VAAPI_MPEG4_ENABLED=1
export mesa_glthread=true
#export INTEL_SIMD_DEBUG=fs2x8 # (uncomment for Intel Xe2 or newer)
$HOME/.config/chromium-flags.conf
#--use-gl=angle
#--use-angle=vulkan
#--use-vulkan
--use-cmd-decoder=passthrough
--enable-features=VaapiIgnoreDriverChecks,VaapiLowPowerEncoderGen9x,Vp9kSVCHWDecoding,VaapiVp9kSVCHWEncoding,DesktopScreenshots,SharingDesktopScreenshotsEdit,WebUIDarkMode,PlatformHEVCDecoderSupport,PlatformHEVCEncoderSupport,PartialRaster,CanvasOopRasterization,AcceleratedVideoDecoder,AcceleratedVideoEncoder,AcceleratedVideoDecodeLinuxGL,AcceleratedVideoDecodeLinuxZeroCopyGL,UseMultiPlaneFormatForHardwareVideo,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE
--ignore-gpu-blocklist
--disable-gpu-driver-bug-workaround
#
#--enable-skia-graphite
#--skia-graphite-backend="Dawn"
#
--disk-cache-dir=/run/user/1000/chromium-cache
--disk-cache-size=419430400
--enable-chrome-browser-cloud-management
--show-component-extension-options
--enable-gpu-rasterization
--media-router=0
--enable-remote-extensions
--video-capture-use-gpu-memory-buffer
--enable-video-player-chromecast-support
--enable-pixel-canvas-recording
--enable-native-gpu-memory-buffers
--enable-zero-copy
--enable-partial-raster
--enable-parallel-downloading
--enable-quic
--enable-lazy-image-loading
--enable-lcd-text
--enable-oop-rasterization
--canvas-oop-rasterization
--enable-gpu-compositing
--enable-accelerated-mjpeg-decode
--enable-font-antialiasing
--enable-accelerated-2d-canvas
--enable-gpu-memory-buffer-video-frames
--enable-gpu-memory-buffer-compositor-resources
--enable-hardware-overlays
#FOR DEBUG
#--enable-features=VaapiVideoDecodeLinuxGL
#--vmodule=*/ozone/*=1,*/vaapi/*=4,*/media/*=4,*/shared_image/*=1
#--enable-logging=stderr --v=0
xorg-git breaks night light for me (alternatives such as
redshiftalso won't work). Seems that setting gamma and brightness no longer have any effects. Do you have any ideas on how to fix this?