Bug 426370

Summary: Checkerboard-like artifacts in Qt/GTK widgets
Product: [openSUSE] openSUSE 11.1 Reporter: Jiri Dluhos <jdluhos>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: E-mail List <xorg-maintainer-bugs>
Severity: Major    
Priority: P1 - Urgent CC: bitdealer, eich, jnelson-suse, locilka, sndirsch, snwint, tgoettlicher
Version: Beta 1   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Screenshot of the artifacts.
Test case exposing the opacity/alpha channel bug
Workaround patch
Updated testcase

Description Jiri Dluhos 2008-09-15 16:18:50 UTC
This problem occurs in SLES11 and also in openSUSE 11 with updates from GNOME online repository; I believe it is a problem in GTK theme engine or in interaction with rendering acceleration.

Various GTK text fields have incorrectly drawn boundaries; it seems like they are partly drawn with a dashed line (please see the screenshot). This effect does not depend on the selected theme.

Observed on two different machines (one with an Intel embedded graphics, one with nVidia graphics card).
Comment 1 Jiri Dluhos 2008-09-15 16:28:31 UTC
Created attachment 239618 [details]
Screenshot of the artifacts.
Comment 2 Jiri Dluhos 2008-09-15 16:32:09 UTC
Note: the screenshot shows a Firefox window, but the problem is not specific to Firefox; it seems to occur in any GTK-based application.
Comment 3 Jiri Dluhos 2008-09-15 16:39:40 UTC
Note 2: It seems that this occurs where a color gradient would normally be; it does not occur on plain lines, nor on contiguous single-colored regions.
Comment 4 Jiri Dluhos 2008-09-15 16:41:11 UTC
Stefan, do you think it might be a bug in X.org?
Comment 5 Stefan Dirsch 2008-09-15 16:55:19 UTC
Try with "noaccel" to verify.
Comment 6 Jiri Dluhos 2008-09-15 17:13:34 UTC
The "noaccel" option does not affect this bug; the artifacts are exactly the same.
Comment 7 Stefan Dirsch 2008-09-15 17:47:42 UTC
Ok. Then I don't think it's a bug in X.Org.
Comment 8 Jiri Dluhos 2008-09-16 09:34:48 UTC
OK, thanks - in this case I'd guess at GTK gradient drawing. Gnome team, please?
Comment 9 JP Rosevear 2008-09-20 18:12:20 UTC
I could see this until updating to about the beta 1 packages, but now its gone.  Do you see it still?
Comment 10 Jiri Dluhos 2008-09-22 10:18:15 UTC
In openSUSE 11, the problem disappeared with the most recent updates; I will test with SLES11 beta1 and inform you.
Comment 11 Aaron Bockover 2008-09-22 14:20:55 UTC
I've seen this with Beta 1, and also noticed it in the installer which is using QT. It seemed x.org/driver related. On an ATI card, but not sure what model right now (machine is not in my reach).
Comment 12 Jiri Dluhos 2008-09-22 14:25:18 UTC
Also noticed it in the installer; now I'm waiting if it occurs in the installed system as well.
Comment 13 Jiri Dluhos 2008-09-22 17:17:31 UTC
Unfortunately, it still occurs in Beta 1 for me, although the patterns may be are a bit different (less noticeable perhaps, but still there) :-(
Comment 14 JP Rosevear 2008-09-22 17:49:43 UTC
Yes, got it doing a b1 install as well (was just zyppering up before).  Moving back to the X team, appears to affect QT and GTK as well as be limited to ATI.
Comment 15 Stefan Dirsch 2008-09-22 18:46:41 UTC
The installer runs on a fbdev driven Xserver. Therefore I rule out a driver bug here. Must be bug in the toolkits. Let's try it with KDE now.
Comment 16 Aaron Bockover 2008-09-22 20:40:38 UTC
This seems to happen in any graphics path where alpha blending occurs. For instance, in the installer it is most notable where the box to display the license is rendered, it's very evident when drawing the selection box in Nautilus on the desktop, and when dragging columns in Banshee.

In Banshee this is done in Cairo - the column is rendered "live" when dragging, and is rendered with some level of transparency on top of the existing columns. I suspect it's something in the ATI driver, not the toolkit as the path in Banshee really has nothing to do with GTK (we do direct rendering with Cairo onto a GDK-bound context/surface).
Comment 17 Jiri Dluhos 2008-09-23 10:26:47 UTC
I am almost sure that ATI driver is not the culprit here; I have experienced this problem on two machines, neither of which have an ATI card (one Intel, one nVidia).
Comment 18 Dirk Mueller 2008-09-23 11:18:13 UTC
it happens with many toolkits, something has regressed or drastically changed behaviour in our X.org packages. 
Comment 19 Stefan Dirsch 2008-09-23 11:30:38 UTC
How can I easily reproduce this on an installed system (11.1 Beta1)? No, I don't want to test this during installation.
Comment 20 Aaron Bockover 2008-09-23 13:48:50 UTC
Stefan: in GNOME, try dragging on the desktop to cause Nautilus to render its selection rectangle - it's semi-transparent, and exhibits this issue. You can also run Banshee and rearrange columns in the track list.
Comment 21 Jiri Dluhos 2008-09-23 14:28:28 UTC
Stefan: you should be able to see the pattern on most color gradients in GTK - I routinely see them on Firefox, as shown on the attached screenshot snippet.

However: on my workstation, where I first seen the problem in GTK, it somehow disappeared after last automatic update. I now have: xorg-x11 7.4-5.1, xorg-x11-driver-video 7.4-5.3.
Comment 22 Aaron Bockover 2008-09-23 15:38:53 UTC
My guess is that those aren't actually gradients, but applied alpha blending of elements. I see gradients all over the place without any issues - it's just when something is alpha blended.
Comment 23 Stefan Dirsch 2008-09-23 16:00:51 UTC
Matthias, could you have a look at this issue? Thanks.
Comment 24 Egbert Eich 2008-09-23 19:02:41 UTC
Would it be possible to test this on an older Xserver (ie. remotely)?
If the problem goes away it would indicate an issue on the server side.
One would also be able to obtain a screen shot of how these parts of the widget are supposed to look like.
It looks like the depth of the alpha channel is reported wrong and only the lowest bit is used.
Comment 25 Dirk Mueller 2008-09-25 10:08:07 UTC
*** Bug 427936 has been marked as a duplicate of this bug. ***
Comment 27 Lukas Ocilka 2008-09-25 10:12:10 UTC
The bug #427936 (marked as duplicate of this one) is at least major for installation.
Comment 28 Stephan Binner 2008-09-25 10:15:37 UTC
*** Bug 429831 has been marked as a duplicate of this bug. ***
Comment 29 Stefan Dirsch 2008-09-25 11:06:04 UTC
(In reply to comment #25 from Dirk Mueller)
> *** Bug 427936 has been marked as a duplicate of this bug. ***

So the original reporter became the assignee? Wow!


Comment 30 Matthias Hopf 2008-09-25 17:47:09 UTC
Yes :-/

Does anybody have a simple reproduction case? Read: code.
Comment 31 Aaron Bockover 2008-09-25 21:22:27 UTC
Created attachment 241788 [details]
Test case exposing the opacity/alpha channel bug

If you compile and run this test case you'll be presented with a window and a black rectangle. Adjusting the opacity will yield this bug immediately. What I found interesting is that running the sample multiple times often leads to different "checker board" patterns, suggesting that there might be some corrupt memory regarding the alpha channel in XRender or something.

It's a C# test case, meaning "Mono/Gtk#/Cairo". 

"zypper in mono-core gtk-sharp2" should pull the deps needed to reproduce this on openSUSE 11.1 Beta 1. Compilation and execution instructions are at the top of the source file.
Comment 32 Matthias Hopf 2008-09-26 16:11:16 UTC
Probable culprit: pixman_rasterize_trapezoid

Had some issues with gdb, breakpoint in libpixman only work if X is started within gdb, not attached afterwards.
Comment 33 Matthias Hopf 2008-09-29 15:59:10 UTC
No, it's not pixman_rasterize_trapezoid, it's pixman_image_composite / fbCompositeSolid_nx8888sse2, called via miCompositeRects/CompositePicture/fbComposite. The results are only drawn to the visible area with fbCopyRegion (fbCopyNtoN) later on, but are already broken.

The pixman_rasterize_trapezoid were from GTK toolkit widgets.

-> remember: never create graphics glitch reproduction testcase that renders more than absolutely necessary!
Comment 34 Matthias Hopf 2008-09-29 15:59:37 UTC
The MMX accelerated function fbCompositeSolid_nx8888mmx does work correctly.
Comment 35 Matthias Hopf 2008-09-29 16:05:59 UTC
Created attachment 242324 [details]
Workaround patch

This patch for pixman disables the sse2 paths for compositing solid pixels w/o mask.
Dunno whether the other paths work correctly.

This is not a real fix, but the MMX paths are reasonably fast enough.
Comment 36 Matthias Hopf 2008-09-29 16:14:16 UTC
Wrote mail for upstream to be aware of this issue. Stefan, please package.
Comment 37 Matthias Hopf 2008-09-29 16:15:48 UTC
Created attachment 242325 [details]
Updated testcase

For completeness - the updated test case that doesn't do any spurious GTK rendering.
Comment 41 Aaron Bockover 2008-09-30 03:40:24 UTC
*** Bug 429070 has been marked as a duplicate of this bug. ***
Comment 42 Stefan Dirsch 2008-09-30 10:43:17 UTC
Indeed this issue is fixed with the update to pixman 0.12.0 on Beta2. Matthias verified this now. So there's no need for his patch.
Comment 44 Thomas Göttlicher 2008-10-02 13:17:49 UTC
*** Bug 429640 has been marked as a duplicate of this bug. ***
Comment 45 Jakub Steiner 2008-10-03 18:26:54 UTC
*** Bug 426566 has been marked as a duplicate of this bug. ***