桌面特效性能
桌面特效性能
KDE Plasma 工作空间的图形特效性能是由显卡(GPU)、显卡驱动和混成特效窗口管理器(Kwin) 三者决定的。窗口管理器通过从显卡驱动那获取当前硬件说支持的特性来设定最优化的配置。有时候,细调 KWin 会有一定的性能改进。
选择合适的驱动
获取当前的驱动信息
驱动问题得解决好,不然没装驱动,或是装了错的驱动,桌面特效就会回退去用无硬件加速的后端 XRender,无论效果还是响应速度都很难受。
KInfoCenter 可以查看使用的驱动信息。点击 ,然后去找 "Driver" 字样,尤其是 "Vendor","Renderer" 和 "OpenGL/ES 版本"这些信息。
Renderer 如果标识是 "Software Rasterizer"那就是没有装驱动。其他驱动的话检查下是否该项正确。 |
可用的驱动
AMD/ATI
AMD/ATI 显卡有2种驱动能用,官方的私有驱动 fglrx 或 Catalyst,和自由开源的Mesa(又叫 radeon, r300, r600)。用 fglrx 驱动的话不是所有特性都能开启,而且用 Mesa 的话性能一般来说还要好点。推荐是用 Mesa 驱动的。如果你在 OpenGL/ES 版本信息中找到 "Mesa" 的字眼,那就不需要再折腾了。
还有,用新版本的 Mesa 驱动,在 Renderer(渲染器)字段应该有 "Gallium" 字眼。
Intel
Intel 硬件用的是自由的 Mesa 驱动,你没的选择。
NVIDIA
NVIDIA 驱动也有2种选择:官方私有驱动和自由的 Mesa 驱动(叫做 nouveau)。自由驱动还在开发中,不一定所有发行版本都有,也不一定支持所有显卡。通常来说还是推荐的官方私有驱动。如果 OpenGL/ES version 字段有 NVIDIA 文字那就是在用官方驱动了。
安装驱动
安装驱动的方法实在是多变,发行版不同,安装的命令以及包名也不一样。你还是去查看你用的系统的文档比较好。
OpenGL 版本
KWin 支持 OpenGL 1.x 和 OpenGL 2.x。默认能用的话 KWin 是使用 OpenGL 2 的特性。OpenGL 2 能够提供更多的特效,但是相应的硬件要求也要高点。了解你当前硬件具体的支持很重要,有些驱动会通过插件来模拟支持高版本的 OpenGL,可想而知效率有多低下。
KInfoCenter 的 "OpenGL/ES version" 字段有具体的 OpenGL 版本信息,像是 2.1 之类的。
It is not trivial to find out whether KWin uses OpenGL 1 or 2 as this is completely determined at runtime. The best available test is to use the Invert effect which can be enabled in Meta + Ctrl + I. If it inverts OpenGL 2 is used, if it does nothing OpenGL 1 is used.
. After enabling the screen should be inverted when using the shortcutIt is possible to force KWin to use OpenGL 1 through
and unchecking . This can improve the performance for older hardware. In general it is completely safe to use OpenGL 2 Shaders if the driver reports a version of 3.x (only available with NVIDIA at the time of this writing).
kwin_gles
Beginning with KWin version 4.8 it is possible to use the separately built binary kwin_gles as a replacement for kwin. It behaves almost the same as the kwin executable in OpenGL2 mode with the slight difference that it uses egl instead of glx as the native platform interface.
To test kwin_gles you just have to run kwin_gles --replace
in Konsole. Since this is a rather new feature it is not as thoroughly tested as the normal kwin and feedback is always welcome. Assuming that the test succeeded and you want to use kwin_gles on a regular basis you can add an executable script to ~/.kde4/env/
that exports the KDEWM=kwin_gles
environment variable.
Thumbnail Scaling
The Compositor supports different scaling methods for thumbnails as rendered in the taskbar preview or effects like Present Windows. It is tried to render the thumbnails as accurate as possible which of course requires more resources.
The scaling method can be changed in
. The following settings are available:- Crisp
- Smooth
- Accurate
The table provides an overview of how the thumbnails are rendered with the different settings.
Overview of how the thumbnails are rendered with the different settings | |
---|---|
Crisp: | |
Smooth: | |
Accurate: |
By default Accurate is used. On Intel hardware Accurate is never used and cannot be enabled unless the environment variable KWIN_FORCE_LANCZOS is set to 1.
Switching from Accurate to Smooth can significantly improve the performance of effects like Present Windows.
General Speed of Animations
Animations take some time and the length of an animations is what makes people think that this is a snappy interface or that it lags. This is a very subjective feeling and the difference between too fast and too slow can be milliseconds. It is impossible to have a perfect value for all users.
The global animation duration level can be changed through
. It varies from "Extremely slow" to "Instant" which does not render any animations. By changing from "Normal" to "Fast" many users reported having a more snappy interface.Qt Graphics System
Since 4.7 (Released July 2011) the Compositor can use the Qt graphics system raster instead of native (X11). This is only relevant for rendering the window decorations and is not related to the compositing backends (OpenGL/XRender).
Which graphics system is used depends on the distribution defaults. For the Compositor raster is recommended especially if the NVIDIA driver is used.
Window Decorations
Some Window Decorations perform animations when a window gets activated. This influences the performance of effects if during an animation the active window changes. The performance impact can be reduced by using the graphics system "raster" (see above).
The default window decoration Oxygen provides an option to disable the animations:
Checkbox Enable animations. Disabling the animations can improve the performance.All window decorations which can be downloaded through the Get New Decorations... dialog use such animations, but it is not possible to disable them. If there is an performance impact due to the theme, it is recommended to use a different one. In general the themed decorations are not optimized and provided to look good and not to be fast.
Another area of window decorations which can impact the performance are shadows. Again the default decoration Oxygen provides a setting to disable them in the same configuration dialog as described above in tab "Shadows" and the themed decorations do not provide an option to disable shadows.
Blur Effect
The Blur Effect is one of the most expensive effects provided by the Compositor. By default it gets enabled for all hardware except Intel hardware. The performance impact of the blur effect depends on the number of open and translucent windows. Especially translucent widget styles (e.g. Oxygen Translucent) and translucent window decorations (e.g. Aurorae Themes) have an impact on the performance. If such a theme is used and the performance is bad it is recommended to either change the theme or disable the Blur effect.
The performance of the Blur effect can be adjusted through
. Moving the slider for strength to "Light" requires less resources while moving it towards "Strong" requires more resources. Since 4.8 (release January 2012) the intermediate rendering results can be kept (default) which improves the performance even with translucent themes.Advanced Desktop Effects Settings
The Compositor provides some advanced settings under
. Some of the settings have already been explained. This section focuses on the remaining settings. Changing these settings in general do not improve the performance but make it worse. The Compositor uses the best possible settings.Compositing type
The Compositing type allows choice of the compositing backend, either XRender or OpenGL. By default OpenGL is used which is hardware accelerated. XRender is available even if no OpenGL driver is installed (e.g. virtual machines) and uses mostly the CPU for rendering. Many effects are not available with XRender.
Keep window thumbnails
This has hardly any influence on performance. It is an option to decide how long thumbnails are kept. Best is to not touch this setting.
Suspend desktop effects for fullscreen windows
This setting influences the performance of fullscreen windows such as games. The compositor is suspended as long as there is a fullscreen window. The disadvantage is that it causes flickering when a window appears on top of the fullscreen window (e.g. a context menu) and is too generic. As well on some distributions (e.g. Kubuntu 11.04) the Intel driver causes a crash when closing the fullscreen window.
If the compositor should be disabled while a fullscreen application such as games or video is used it is better to disable compositing either through the shortcut Alt + Shift + F12 or since 4.7 (Released July 2011) through a window specific rule for the window.
OpenGL mode
Enable direct rendering
The compositor determines by itself whether direct rendering can and has to be used. Changing this setting will most likely break functionality.
Use VSync
VSync allows you to synchronize the rendering with the screen. Unless there is good reason to change, this setting should be enabled. Even if the setting is disabled the Compositor tries to use the frame rate the screen supports and by default a frame rate of 60 Hz is used.
For multiple screens it is important to know that the rendering can only be synchronized with one screen. In case the screens have a different frame rate it might be valid to disable this option and to set a manual frame rate.