We are having video tearing problems using the xvimagesink gstreamer element.
We can’t use xvoverlaysink, even though that provides smooth video, because
of severe image distortion (red screen) if it’s used on both HDMI outputs.
The problem does seem to be update sync’d with vertical blanking, we get
good video on one screen if /sys/module/window/parameters/no_vsync = 0, the
tearing problem if it’s = 1.
Searching does seem to indicate the X11 XV subsystem supports XV_SYNC_TO_VBLANK
flag or atom.
Searching the shared libraries used by Xorg seems to indicate this flag does exist
# lsof -p 18344 | cut -c 70- | egrep '(/usr|/lib)' | while read lib; do echo $lib; strings $lib | grep XV_SYNC; done
/usr/lib/xorg/Xorg
/usr/lib/aarch64-linux-gnu/libevdev.so.2.1.12
/usr/lib/aarch64-linux-gnu/libmtdev.so.1.0.0
/usr/lib/xorg/modules/input/evdev_drv.so
/usr/lib/xorg/modules/libwfb.so
/usr/lib/xorg/modules/libfb.so
/usr/lib/xorg/modules/drivers/nvidia_drv.so
XV_SYNC_TO_VBLANK
XV_SYNC_TO_VBLANK
XV_SYNC_TO_VBLANK
XV_SYNC_TO_VBLANK
XV_SYNC_TO_VBLANK
XV_SYNC_TO_VBLANK
XV_SYNC_TO_VBLANK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_gpu.so
The open questions is is this flag supported, how can it be set, and does it actually work.
Setting the environment variable XV_SYNC_TO_VBLANK=1 before starting Xorg doesn’t change anything.
It does seem like it is possible to set this programmatically (mplayer patch):
Atom xv_atom = xv_intern_atom_if_exists("XV_SYNC_TO_VBLANK");
if (xv_atom == None)
return -1;
return XvSetPortAttribute(mDisplay, xv_port, xv_atom, 1) == Success;
The gstreamer xvimagesink does set some xv_port attributes, ( but not XV_SYNC_TO_BLANK
(Port attributes that xvimagesink sets, from sys/xvimage/xvcontext.c)
static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
static const char colorkey[] = "XV_COLORKEY";
static const char iturbt709[] = "XV_ITURBT_709";
... (goes on to use XInternAtom() and XvSetPortAttribute () to set these
So…
a) Can XV_SYNC_TO_VBLANK be set in nvidia_drv.so using XvSetPortAttribute()?
b) If not, how can it be set.
Thanks in advance,
Cary