Bug 37946

Summary: [SNB] Font color corruption and other artifacts with SNA
Product: xorg Reporter: Ivan Bulatovic <combuster>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Font color corruption in terminal
none
Sonata album art glitches and missing icons in thunar
none
text corruption in skype: only the first letter of each string is displayed none

Description Ivan Bulatovic 2011-06-05 03:36:33 UTC
Created attachment 47548 [details]
Font color corruption in terminal

After compiling xf86-video-intel from git with SNA support on my SNB HD2000 (i5-2400) I get all sorts of graphics corruption. 

Discolored fonts in terminal and menu bar (namely the first letter on every menu entry), missing icons when just hovering the pointer over them in thunar, etc... Funny thing, after restarting thunar - icons are missing from the very start...

This happens with and without compositing on. 

There are no errors in i915_error_state, dmesg or Xorg.0.log. I'll attach the screenshot that best describes the problem.

mesa: 7.10.99.git20110531
xserver: 1.10.2
kernel: 2.6.39.1
OS/DE: Arch Linux / Xfce
Comment 1 Chris Wilson 2011-06-05 03:49:13 UTC
Ivan, can you download rendercheck and verify the basic computations are fine? If so, it follows that it's a flush issue.

And then can you try:

#define DEBUG_FLUSH_CACHE 1
and/or
#define DEBUG_FLUSH_BATCH 1

in src/sna/sna.h
Comment 2 Chris Wilson 2011-06-05 04:22:31 UTC
I've just "yum install @xfce" on my F15 HuronRiver (SNB laptop) and I don't see any corruption.

The rendercheck results will be most useful just to be sure the basics are working.
Comment 3 Ivan Bulatovic 2011-06-05 05:05:51 UTC
No they aren't, I get errors all over the place with rendercheck:

Beginning blend test on a8
Clear blend test error of 255.0000 at (0, 0) --
           R     G     B     A
got:       0.000 0.000 0.000 1.000
expected:  0.000 0.000 0.000 0.000
src color: 0.00 0.00 0.00 1.00 (a8)
dst color: 1.00 1.00 1.00 1.00
src: 1x1R a8, dst: a8

Beginning blend test on x2r10g10b10
Add blend test error of 6.0000 at (0, 0) --
           R     G     B     A
got:       0.495 0.000 0.000 1.000
expected:  0.500 0.000 0.000 1.000
src color: 0.25 0.00 0.00 1.00 (x2r10g10b10)
dst color: 0.25 0.00 0.00 1.00
src: 1x1R x2r10g10b10, dst: x2r10g10b10

Clear composite test error of 255.0000 at (0, 0) --
           R     G     B     A
got:       0.000 0.000 0.000 1.000
expected:  0.000 0.000 0.000 0.000
src color: 0.00 0.00 0.00 1.00
msk color: 0.00 0.00 0.00 1.00
dst color: 1.00 1.00 1.00 1.00
src: 1x1R a8, mask: 1x1R a8, dst: a8
Beginning composite mask test on a8r8g8b8
Clear composite test error of 255.0000 at (0, 0) --
           R     G     B     A
got:       1.000 1.000 1.000 1.000
expected:  0.000 0.000 0.000 0.000
src color: 0.00 0.00 0.00 1.00
msk color: 0.00 0.00 0.00 1.00
dst color: 1.00 1.00 1.00 1.00
src: 1x1R a8, mask: 1x1R a8, dst: a8r8g8b8

In linear gradient test error of 13.0000 at (0, 0) --
           R     G     B     A
got:       0.796 0.000 0.200 1.000
expected:  0.749 0.000 0.251 1.000
gradient: 0 stops: 0 repeat: 2 pos: 0/5
src color: 0.75 0.00 0.25 1.00
dst color: 0.25 0.00 0.00 1.00
In linear gradient test error of 13.0000 at (0, 0) --
           R     G     B     A
got:       0.796 0.000 0.200 1.000
expected:  0.749 0.000 0.251 1.000
gradient: 0 stops: 0 repeat: 2 pos: 5/0
src color: 0.75 0.00 0.25 1.00
dst color: 0.25 0.00 0.00 1.00
In linear gradient test error of 13.0000 at (0, 0) --

Beginning ConjointXor mask repeat test on r5g6b5
2x4 ConjointXor mask-repeat test error of 31.0000 at (0, 1) --
           R     G     B     A
got:       0.000 0.000 1.000 1.000
expected:  1.000 0.000 1.000 1.000

and so on...

Running rendercheck multiple times doesn't come up with same errors on blend ie, sometimes a8 passes sometimes doesn't.

I'll add DEBUG_FLUSH_CACHE and BATCH to sna.h and check logs again.
Comment 4 Ivan Bulatovic 2011-06-05 05:26:21 UTC
I've enabled debug info on flush cache and batch and there are no error messages. After restarting things are looking better, there is occasional corruption in terminal on single character here and there, rendercheck passes now blend test with one error:

Beginning blend test on x2r10g10b10
Add blend test error of 6.0000 at (0, 0) --
           R     G     B     A
got:       0.495 0.000 0.000 1.000
expected:  0.500 0.000 0.000 1.000
src color: 0.25 0.00 0.00 1.00 (x2r10g10b10)
dst color: 0.25 0.00 0.00 1.00
src: 1x1R x2r10g10b10, dst: x2r10g10b10

16 tests passed of 17 total

But the problem is still there...
Comment 5 Chris Wilson 2011-06-05 05:36:41 UTC
OMG. The add error is close enough to be a truncation error through the texture unit (10-bit to 8-bit and back again), but it looks like we are missing a flush in that kernel.

Time to dig deeper.
Comment 6 Chris Wilson 2011-06-05 07:43:41 UTC
Ivan, this should clear up the terminal (I was able to see a similar font color corruption on KDE/Konsole):

commit 407257570fea1c6456fda47c9fab36c39f169c2b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jun 5 15:33:27 2011 +0100

    sna/gen6: Flush the pipeline before effecting a change of blend modes
    
    ... also make sure that we flush if we change the blend mode for the CA pass
    
    Reported-by: Ivan Bulatovic <combuster@archlinux.us>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37946
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

You will need to keep DEBUG_FLUSH_CACHE enabled for your current kernel to keep rendercheck happy, though you would be unlikely to see that particular corruption in practice.
Comment 7 Ivan Bulatovic 2011-06-05 11:09:22 UTC
Rendercheck is still reporting the exact same Add blend test error even with the DEBUG_FLUSH_CACHE 1, but the problem with fonts in terminal are gone and I havent seen any graphical glitches whatsoever after 407257570fea1c6456fda47c9fab36c39f169c2b.

Thanks Chris !!!
Comment 8 Ivan Bulatovic 2011-06-05 15:21:20 UTC
Created attachment 47574 [details]
Sonata album art glitches and missing icons in thunar

I've spoke too soon. Those missing icons in thunar are definitely related to video driver, I have glitches also in sonata and I have a few missing icons in panel notification area. Moving the pointer over the box that should contain album art is changing it's contents randomly, here is another scrot attached.
Comment 10 Andreas Fleig 2011-06-06 18:38:27 UTC
I also get graphics corruption with the latest code from git on a 965GM, running Fedora 15.

In gnome-terminal, selected text is displayed incorrectly, and after deselecting it, some text becomes bolder than the rest. In Google Chrome, the buttons are rendered incorrectly. In Skype (Qt), only the first letter of most strings is displayed.

I also get the blend test error in rendercheck:
Add blend test error of 4.0000 at (0, 0) --
           R     G     B     A
got:       0.497 0.000 0.000 1.000
expected:  0.500 0.000 0.000 1.000
src color: 0.25 0.00 0.00 1.00 (x2r10g10b10)
dst color: 0.25 0.00 0.00 1.00
src: 1x1R x2r10g10b10, dst: x2r10g10b10

Also, rendercheck seems to hang at "composite mask test on a8", with 80% used by Xorg.
Comment 11 Andreas Fleig 2011-06-06 18:40:21 UTC
Created attachment 47633 [details]
text corruption in skype: only the first letter of each string is displayed
Comment 12 Chris Wilson 2011-06-07 01:42:27 UTC
(In reply to comment #10)
> I also get graphics corruption with the latest code from git on a 965GM,
> running Fedora 15.

Please include a git commit id (the sha1) so that I know just what the latest code you tried was.
 
> In gnome-terminal, selected text is displayed incorrectly, and after
> deselecting it, some text becomes bolder than the rest. In Google Chrome, the
> buttons are rendered incorrectly. In Skype (Qt), only the first letter of most
> strings is displayed.

I haven't been able to reproduce that behaviour on my F15 965gm box.  Any clues as to what might differ on your machine from a default install (other than the Xserver and DDX!)
 
> I also get the blend test error in rendercheck:
> Add blend test error of 4.0000 at (0, 0) --
>            R     G     B     A
> got:       0.497 0.000 0.000 1.000
> expected:  0.500 0.000 0.000 1.000
> src color: 0.25 0.00 0.00 1.00 (x2r10g10b10)
> dst color: 0.25 0.00 0.00 1.00
> src: 1x1R x2r10g10b10, dst: x2r10g10b10

That's justifiable (but still unwanted) truncation along the texture paths.

> Also, rendercheck seems to hang at "composite mask test on a8", with 80% used
> by Xorg.

It takes a very long time.
Comment 13 Ivan Bulatovic 2011-06-07 15:06:41 UTC
I can confirm that those 4 commits fixed all glitches that bothered me for the past two days. SNA is working great for me now...
Comment 14 Chris Wilson 2011-06-08 02:48:38 UTC
Andreas, do you mind filing a separate bug for your symptoms? First step is to update and verify that the bug is still present.

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.