atomic-penguin's blog

Musings on Linux, Opscode Chef, online gaming, and home cooking.

Disabling VerticalSync in KDE for Steam4Linux Beta

According to Wikipedia, Vertical synchronization (or VerticalSync) is

an option in most systems, wherein the video card is prevented from doing anything visible to the display memory until after the monitor finishes its current refresh cycle.

In layman’s terms, when Vertical synchronization is turned on, many aspects of video processing are locked to the reported refresh rate of your display hardware. In other words, if your fancy LCD screen reports 60 Hz. is its own supported refresh rate, then games or video playback will be capped at 60 frames per second when Vertical synchronization is turned on.

I have seen a couple reports that turning off VSync doesn’t actually disable VSync in Linux Steam games like Team Fortress 2. The proposed workaround in this reddit thread was toggling the option on, and off, until VSync was actually turned off. Searching through the steam-for-linux issue tracker last night, I found this solution on an unrelated AMD TearFree bug report.

The solution offered by Github user dedoz, worked perfectly for me. It turns out this is not a bug within any game, or Linux Steam, but rather a default option in compositing window managers such as KDE. By default KDE turns on VSync for OpenGL rendering. By changing the following setting, I am now able to toggle the option mat_vsync 1 to enable VSync, or mat_vsync 0 to disable VSync in-game from a game configuration file. I have no idea, how to go about changing this in other window manager/desktop environments suffering from the same problem. If you encounter such a problem on another desktop environment, or find another workaround, be sure to leave a comment.

  1. First locate kwinrc. Mine lives in ~/.kde/share/config/kwinrc
$ locate kwinrc
  1. Next, find the [Compositing] section in kwinrc. Add the line GLVSync=false to this section.
$ vim $HOME/.kde/share/config/kwinrc


  1. Finally, use qdbus to call org.kde.kwin.reconfigure().
$ qdbus org.kde.kwin /KWin reconfigure

Whether you want to play with Vertical synchronization on, or off, while in-game will come down to personal preference. The window manager probably should not enforce Vertical synchronization being on by default, while in-game however. Ideally, the in-game setting should be deferred to by the window manager. The agnostic approach here, is to turn off enforcement within the window manager, so that the user can decide on the setting which they prefer in-game.