Bug 85005 - integrated VNC/Spice viewer widget in virt-manager stops updating w/ xlib-xcb enabled cairo
Summary: integrated VNC/Spice viewer widget in virt-manager stops updating w/ xlib-xcb...
Alias: None
Product: cairo
Classification: Unclassified
Component: xcb backend (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Uli Schlachter
QA Contact: cairo-bugs mailing list
Depends on:
Reported: 2014-10-14 14:50 UTC by Matthias Dahl
Modified: 2015-08-02 15:43 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Matthias Dahl 2014-10-14 14:50:51 UTC
If cairo (master branch and earlier as well) is compiled with xlib-xcb enabled, starting a VM in virt-manager will result in an integrated VNC/Spice viewer widget that stops updating after approx. 1 sec or less. Taking screenshots still works (with an actual up to date image) as well as connecting with the external Spice or VNC client (which then works just fine).

After I waded through the sources of virt-manager to debug this, I finally figured the problem was rooted at a much lower level which lead me to cairo eventually.

Once cairo is compiled without the xlib-xcb adapter, everything works just fine again.

By the way, this happens with the following versions I tested:

virt-manager: 1.0.1, 1.1.0 and master.
libvirt: 1.2.6 and 1.2.9.
spice-gtk: 0.25 and master
qemu: 2.1.1
Kernel: 3.16.1
pygobject: 3.12.2 and master

If there is anything I can do to help debug this further, please let me know.
Comment 1 Matthias Dahl 2014-10-14 14:52:34 UTC
Just for completeness, this is the bug report for virt-manager that I opened before I came to realize that this was a cairo problem:

Comment 2 Fabio Coatti 2015-07-31 16:23:26 UTC
This seems to be still present in cairo 1.14.2, any news on this bug?

Comment 3 Uli Schlachter 2015-08-02 15:26:46 UTC
Sigh. The bug is in spice.

In `spike-gtk-0.25` (I'm looking at the version in debian testing), go to `gtk/spice-widget-cairo.c`, line 126. After the `if (d->ximage) {` add `cairo_surface_mark_dirty(d->ximage)` and see if that fixes the problem. It might also make everything die with an assertion failure.

I cannot find any code that draws to the cairo image surface that is saved in `d->ximage`, but from what I see is that spice is modifying the image data inside of an image surface behind of cairo's back. Spice has to call `cairo_surface_flush()` before drawing directly to that data and `cairo_surface_mark_dirty()` or `cairo_surface_mark_dirty_area()` afterwards.

Without this, cairo assumes that the pixel content of the image surface did not change and thus does some clever caching to speed things up. This might only break with `xlib-xcb`, but is still a bug in spice.
Comment 4 Uli Schlachter 2015-08-02 15:43:56 UTC
It seems like the function `invalidate()` in spice-widget.c gets notified about changes part of the image. I guess this should call `cairo_surface_mark_dirty_rectangle()` with the right arguments (directly the arguments of the function?).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.