[cairo-bugs] [Bug 67505] GIMP image rendering is broken with --enable-xlib-xcb

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Aug 1 05:43:25 PDT 2013


--- Comment #3 from Uli Schlachter <psychon at znc.in> ---
Easily reproducable with gimp 96a090d9b12d20deec20248a841f7b36e103c17c.

No idea what to do about this. I say the bug is in gimp, Chris blames
cairo-xcb. The problem goes something like this:

- gimp draws to a small part of an image surface
- gimp wants this part to be visible in the GUI and uses it as source surface
in cairo_paint()
- cairo-xcb uploads the whole image surface to the X11 server (which is way
more than is actually needed)
- Since this was an expensive operation, cairo-xcb attaches a so called
snapshot to the image surface. This snapshot keeps alive the temporary pixmap
that the image surface was uploaded to.
<time passes>
- gimp wants to redraw another part of the visible image and draws to another
part of the above image surface
- cairo-xcb sees the snapshot attached to the image surface and optimizes away
the new upload, because it still has the pixmap that the surface was uploaded
to before. Thus, old data is used.

I blame gimp because IMHO the API docs imply that it should call
cairo_surface_flush() before directly modifying an image surface and
mark_dirty() afterwards. The flush() would get rid of the snapshot. Gimp
currently only does these calls the first time that it directly modifies the

Chris argues that gimp never touches the same area of the image surface twice
and that it calls flush();mark_dirty() when all of the temporary image was
used. So the bug is that cairo-xcb uploads more of the image surface than it
really has to. Also, it needlessly uploads to a temporary pixmap when it could
paint directly to the target surface. (And such an optimization would fix the
visible results of this bug and thus hide it)

If I add a call to cairo_surface_mark_dirty(xfer); to
gimp_display_shell_render() (after xfer was modified, gimp dies: gimp-2.9:
cairo-surface.c:1585: cairo_surface_mark_dirty_rectangle: Assertion `!
_cairo_surface_has_snapshots (surface)' failed
(This basically says: You should have called cairo_surface_flush(), so that the
snapshot is detached)

If I remove the call to _cairo_surface_attach_snapshot() from
_cairo_xcb_surface_picture(), the problem (obviously) goes away (and cairo-xcb
re-uploads the whole image surface on each cairo_paint()).

You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20130801/23e8adaf/attachment.html>

More information about the cairo-bugs mailing list