Bug 31931 - Black rectangles displayed instead of menu/buttons/text with --enable-xlib-xcb
Summary: Black rectangles displayed instead of menu/buttons/text with --enable-xlib-xcb
Alias: None
Product: cairo
Classification: Unclassified
Component: xcb backend (show other bugs)
Version: 1.10.1
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
Depends on:
Reported: 2010-11-26 00:20 UTC by ojab
Modified: 2011-07-02 07:55 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

Screenshot without error (13.60 KB, image/png)
2010-11-26 00:21 UTC, ojab
Screenshot with error (10.61 KB, image/png)
2010-11-26 00:22 UTC, ojab

Description ojab 2010-11-26 00:20:45 UTC
Menu in Firefox (builded with system cairo), for example, is displayed wrong (looks like background is black, but I'm not sure), screenshots will follow in the attached files. I don't see such issue in another programs, so maybe it's firefox-specific.

cairo-git-493aaf0, pixman-git-4b5b5a2, libxcb-1.7, xcb-proto-1.6, libX11-1.4.0.

This bug also appears in firefox via ssh -X, so I assume that it's not video driver bug.
Comment 1 ojab 2010-11-26 00:21:56 UTC
Created attachment 40581 [details]
Screenshot without error

cairo builded with '--enable-xcb --enable-gl --enable-qt'
Comment 2 ojab 2010-11-26 00:22:47 UTC
Created attachment 40582 [details]
Screenshot with error

cairo builded with '--enable-xlib-xcb --enable-xcb --enable-gl --enable-qt'
Comment 3 Uli Schlachter 2011-01-02 04:23:18 UTC
No idea what I might be doing wrong, but I can't reproduce this.

pixman: pixman-0.21.2-4-g4b5b5a2 (same version as reporter)
cairo: 1.10.0-187-g493aaf0 (also the same version)
libxcb-1.6, xcb-proto-1.6 both from current debian testing

cairo was built with ./autogen.sh PKG_CONFIG_PATH=/home/psychon/projects/pixman/ --enable-xcb --disable-ps --disable-pdf --disable-svg --enable-xlib-xcb

Tested via this command, result looks good to me (and according to lsof, this cairo is being used):
$ LD_PRELOAD=/tmp/cairo/src/.libs/libcairo.so /usr/lib/iceweasel/firefox-bin -ProfileManager -no-remote
Comment 4 ojab 2011-01-05 02:55:22 UTC
Tested with libX11-1.3.3 & libxcb-1.6, the same black rectangles :/

Can xserver cause it?
Comment 5 Uli Schlachter 2011-01-05 04:02:25 UTC
Sure, which graphics driver do you use? Could you test via e.g. Xnest?
Comment 6 ojab 2011-01-06 18:24:11 UTC
>This bug also appears in firefox via ssh -X, so I assume that it's not video driver bug.

xf86-video-ati/libdrm/mesa from git.
Comment 7 ojab 2011-01-26 08:13:40 UTC
Can't reproduce with latest git.
Comment 8 ojab 2011-01-29 11:39:31 UTC
Looks like lat time firefox havenn't built clean and was linked to bundled cairo copy.

I can reproduce this issue with firefox-4.0[beta], firefox-3.6 works ok (sorry that I haven't mentioned Fx version before and haven't tested 3.6). 

Reproducible with xserver-1.9.3/1.94[rc], libX11-1.3/1.4, libxcb-1.6/1.7 for me.

Building Fx with system cairo is broken ATM, you may need patches from https://bugzilla.mozilla.org/show_bug.cgi?id=623797
Comment 9 ojab 2011-03-06 02:16:30 UTC
Still the same with f1d313e042af89b2f5f5d09d3eb1703d0517ecd7
Comment 10 ojab 2011-03-16 09:41:04 UTC
Still the same with ed78510.
Comment 11 ojab 2011-04-12 23:02:54 UTC
Still the same with b377380.
Comment 12 ojab 2011-05-24 05:27:53 UTC
Still the same with cairo-git HEAD 6936a2b
Comment 13 Uli Schlachter 2011-07-01 09:03:58 UTC
I installed the iceweasel 5.0-1 package from debian experimental which is built with system cairo. I can reproduce the bug now (I used LD_PRELOAD to make it use my xlib-xcb cairo built).
Comment 14 Uli Schlachter 2011-07-01 12:29:12 UTC
With lots of try-and-error I noticed that sticking a cairo_surface_flush() into _cairo_xcb_surface_mark_dirty() makes the problem go away, but _cairo_xcb_surface_flush() doesn't help. In other words, _cairo_surface_detach_snapshots() is needed. Meh?

Digging a little deeper, I found out that the _cairo_surface_attach_snapshot() created in _cairo_xcb_surface_acquire_source_image() causes this problem. Dunno where to go from here.
Comment 15 Uli Schlachter 2011-07-01 13:05:00 UTC
Ah, finally. Could you check if the following commit fixes the issue for you? It's already pushed to cairo.git.
Also, sorry that this took me three bugspam-comments.

commit 7e1a9f1db0471f238a954a1fd248695a2a6920d7
Author: Uli Schlachter <psychon@znc.in>
Date:   Fri Jul 1 21:48:31 2011 +0200

    xlib-xcb: Fix cairo_surface_flush()
    This function called directly into the xcb's surface flush function. This means
    that snapshots for that surface weren't detached since that's normally done in
    cairo_surface_flush() before calling into the backend.
    Fix this by using surface_flush() instead of calling into the backend directly.
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31931
    Signed-off-by: Uli Schlachter <psychon@znc.in>
Comment 16 ojab 2011-07-01 14:11:40 UTC
Fixed, thanks.
Comment 17 James Cloos 2011-07-02 00:58:14 UTC
That also fixes the black on black I got.

The other xlib-xcb render corruption still exists, though.
Comment 18 Uli Schlachter 2011-07-02 01:32:05 UTC
@James Cloos: What are you talking about? I only see a single render corruption mentioned in this bug.
Comment 19 ojab 2011-07-02 02:09:54 UTC
(In reply to comment #18)
> @James Cloos: What are you talking about? I only see a single render corruption
> mentioned in this bug.

Please check https://bugs.freedesktop.org/show_bug.cgi?id=38904
I know that report isn't extremely useful, but maybe you'll be able to reproduce this bug too.
Comment 20 James Cloos 2011-07-02 07:55:29 UTC
> What are you talking about? I only see a single render corruption
> mentioned in this bug.

I may have only mentioned it in the thread on the list; I can’t remember
right now.  But the bug ojab referred to in commment #19, bug #38904, is
on point.  This one can be closed and further dialog moved there.

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.