NVIDIA and compositing
On my main machine I have an NVIDIA graphics card and I use Openbox as my window manager. Openbox is fast and light, the only thing missing, really, is compositing support. I’m usually not one for eye candy, but I think having windows cast shadows makes them slightly easier to discern at a glance. To enable shadows I use Compton, a compositor which can coexist with non-compositing window managers. I’ve been running it using:
This turns on shadows for windows and disables it for docks. I was using this configuration for a while before I noticed tearing in fullscreen flash videos.
As I understand it, the compositor works by giving each window a surface which it can render itself to. Those surfaces are then composited together before being rendered to the screen. This means the compositor is the last part of the rendering chain and is therefore responsible for managing the V-sync, which is needed to avoid tearing.
Turning on V-sync for the xrender backend didn’t work for me, I had to switch to using the GLX backend. Starting compton using this command worked for me using the proprietary NVIDIA driver:
compton -bcC --backend glx --vsync opengl-swc
My quest for shadows and tearless videos seemed at an end.
Then, out of the depths of Santa Clara Valley, comes driver update 334.21. NVIDIA has made changes to their driver which does not play well with Compton. When I do something that generates lots of input events by either pressing keys or using the mouse, the last key or mouse event has a one second delay. This is incredibly annoying because it makes everything feel sluggish. After some googling I found this thread. The update in that thread solved my problem. You need a version of Compton from 2014-03-17 or later. Once you have updated Compton, run it using:
compton -bcC --backend glx --vsync opengl-swc \ --xrender-sync --xrender-sync-fence
And the input lag should be gone. I was satisfied. Or I should have been if only I hadn’t noticed another issue while trying to solve the input issue. But that is the story of my next blog post.