VSync in a XRender-based compositing window manager?

Richard Grenville pyxlcy at gmail.com
Thu Oct 25 17:48:59 PDT 2012

Hmm, firstly, please forgive me if I'm send this to the improper place.

I'm working on a fork of xcompmgr called compton. Some users complain about
screen tearing when playing videos with compton running. Most of the reports
come from Intel integrated graphic chip users, but one from a nVidia card
user. (I don't know why the "Sync to VBlank" support in the binary blob isn't
working for him.) And they demand VSync support on compton, but I don't see X
Render supporting it. I could not reproduce this issue on my nVidia GTX 670 +
binary blob regardless of how I change the settings, so effectively I'm
working on this "blindly". I've tried 3 ways:

1. Let compton paint with the pace of the refresh rate, using 3 different
methods: software method (sleep using nanosleep()), DRM_IOCTL_WAIT_VBLANK,
and OpenGL SGI_video_sync. According to the debugging output they supplied,
I'm pretty sure that compton is painting with the correct interval. And they
are reporting a tearing line that either stays at fixed place in the screen
or moves very slowly, instead of going away. If the tearing line is moving,
they says, it moves in one direction to the bottom, then starts from the top.
So looks like, regardless of when compton starts painting, the tearing does
not go away.

2. Let compton paint to a backbuffer provided by X DBE extension. This has no
effect according to their reports.

3. Let compton paint to the X composite overlay window (what
XCompositeGetOverlayWindow() returns). No effect, even combined with the
double buffering above, they says.

So, despite all my efforts, the best result I got is a tearing line that
sticks in a particular place on the screen. 

And despite all my efforts, I got no further information from them about how
this problem is happening. I did recommend them to try the unaccelerated x11
video output, and test if VSync features of other compositing window managers
(mostly, cairo-compmgr) works, but I'm afraid they either didn't follow my
advice or did not report the result to me.

This is the original issue report, in case I missed any information:

So I wonder what is the correct cure to the tearing issue in video playback,
for a compositing window manager using X Render as backend? What could I have
missed? And if possible, I hope somebody could provide a hint about why all
my 3 approaches are failing, and why the software VSync (sleep using
nanosleep(), calculated from the initial paint time and refresh rate) causes
the tearing line to constantly move in one direction. (I expect it to move
back and forth.) Thanks in advance.

Richard Grenville

More information about the xorg mailing list