Bug 41165 - [GM965 SNA] Broken rendering (KRDC)
Summary: [GM965 SNA] Broken rendering (KRDC)
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Chris Wilson
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-24 02:13 UTC by Roman Jarosz
Modified: 2011-09-25 12:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
krdc-windowtotal.png (68.84 KB, image/png)
2011-09-24 02:13 UTC, Roman Jarosz
no flags Details
winecfg.png (16.73 KB, image/png)
2011-09-24 02:14 UTC, Roman Jarosz
no flags Details
wineword.png (62.99 KB, image/png)
2011-09-24 02:14 UTC, Roman Jarosz
no flags Details
NO_GLYPHS_VIA_MASK 1 and title corruption (only restarted X not whole system) (81.56 KB, image/png)
2011-09-24 03:22 UTC, Roman Jarosz
no flags Details
WORD corruption debug (337.76 KB, text/plain)
2011-09-24 05:01 UTC, Roman Jarosz
no flags Details
rdesktop screen corruption xtrace (266.38 KB, application/gzip)
2011-09-24 16:11 UTC, Roman Jarosz
no flags Details
No text with patch (906 bytes, image/png)
2011-09-24 16:42 UTC, Roman Jarosz
no flags Details

Description Roman Jarosz 2011-09-24 02:13:32 UTC
Created attachment 51563 [details]
krdc-windowtotal.png

When using latest driver (7f7f95abbf57e6e71f6a30d917f97c2f2bd6cea9) some applications are not correctly rendered.

krdc-windowtotal.png shows wrong rendering of Total Commander in KRDC ... if I move other window over KRDC, the content is restored correctly.

winecfp.png shows wrong text on disabled buttons.
wineword.png this is MS Word in Wine, the text area is corrupted.

If I move other window over the corrupted text (in MS Word or winecfg), it is redrawn to something else but it's still corrupted.

Standard KDE apps looks normal.
If I don't use SNA the Wine and KRDC is OK.

00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
Linux version 3.0.4 (gcc version 4.5.3 (Gentoo 4.5.3-r1 p1.0, pie-0.4.5) ) #2 SMP Sat Sep 17 20:04:54 CEST 2011
Comment 1 Roman Jarosz 2011-09-24 02:14:03 UTC
Created attachment 51564 [details]
winecfg.png
Comment 2 Roman Jarosz 2011-09-24 02:14:43 UTC
Created attachment 51565 [details]
wineword.png
Comment 3 Roman Jarosz 2011-09-24 02:25:39 UTC
PS. I don't use compositing in KWin.
Comment 4 Chris Wilson 2011-09-24 02:43:40 UTC
If you have a moment, can you double check to see if this is a recent regression?
Comment 5 Chris Wilson 2011-09-24 02:43:58 UTC
Note for future self: #define NO_GLYPHS_VIA_MASK 1
Comment 6 Roman Jarosz 2011-09-24 02:58:27 UTC
IMHO it's not recent regression, at least the MS WORD was "always" broken in SNA, I remember that it was broken even more (whole text area was black)

Will try to change the NO_GLYPHS_VIA_MASK in sna_glyphs.c
Comment 7 Roman Jarosz 2011-09-24 03:20:27 UTC
I've tried the NO_GLYPHS_VIA_MASK 1.
1. The text in WineCfg and WORD is now OK.
2. The KRDC is still broken as it was.
3. I also get different (bolder, corrupted) text in title bar of KDE windows (screenshot), if I move other window over the title bar sometimes it is rendered correctly sometimes it corrupted even more (no text visible).
Comment 8 Roman Jarosz 2011-09-24 03:22:59 UTC
Created attachment 51566 [details]
NO_GLYPHS_VIA_MASK 1 and title corruption (only restarted X not whole system)
Comment 9 Roman Jarosz 2011-09-24 03:36:25 UTC
After system restart it's the same: WINE OK, WORD OK, KRDC broken, +title text broken.
Comment 10 Roman Jarosz 2011-09-24 05:01:48 UTC
Created attachment 51567 [details]
WORD corruption debug

Don't know if it will help but I've enabled glyph debug and wrote something in MS WORD
#define NO_GLYPHS_VIA_MASK 0
#define DEBUG_GLYPHS (DEBUG_ALL || 1)

I've added tags to log
--------- Started writing ROMANJAROSZROMANJAROSZROMANJAROSZ in MS WORD => corrupted text
--------- Stoped writing ROMANJAROSZROMANJAROSZROMANJAROSZ in MS WORD => corrupted text
Comment 11 Chris Wilson 2011-09-24 10:48:27 UTC
The text issue I managed to reproduce and identified the path to investigate. It just happens to be the main path for rendering glyphs so slightly baffling that we've managed to so easily trigger a bug!

Can you explain KRDC, as that is outside my experience and I have no idea what I need to do to reproduce the issue? Alternatively you might be able to find another application that reproduces the same bug. In the meantime an xtrace of the rendering will help me narrow down which paths are in use and so potentially buggy.
Comment 12 Chris Wilson 2011-09-24 11:17:40 UTC
Ah, the rendering is also affected by flushing the cache, and in particular submitting a batch for every operation.

Can you try #define DEBUG_FLUSH_BATCH 1 in src/sna/sna.h and see if that helps with KDRC and the other wine applications?
Comment 13 Chris Wilson 2011-09-24 15:16:08 UTC
So the text corruption, I have narrowed down to:

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index e0ef313..28f692b 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -748,6 +748,8 @@ glyphs_via_mask(struct sna *sna,
                return FALSE;
        }
 
+       kgem_submit(&sna->kgem);
+
        memset(&tmp, 0, sizeof(tmp));
        glyph_atlas = NULL;
        do {

which leaves me mighty baffled. Nothing new there then. ;-)
Comment 14 Chris Wilson 2011-09-24 15:32:16 UTC
And one more clue before I let my subconscious solve this (i.e. sleep), it seems specific to the i965+ architecture - I could not reproduce it on gen3 (i915), but have on gen4 and gen5.
Comment 15 Roman Jarosz 2011-09-24 16:11:24 UTC
Created attachment 51577 [details]
rdesktop screen corruption xtrace

First just to make it clear in WINE I see only text corruption, not screen corruption (will try if your patch solved it)

In KRDC (rdesktop) I see the screen corruption even with DEBUG_FLUSH_BATCH 1.
To reproduce the bug you can use KRDC or rdesktop ... with rdesktop do
"rdesktop 1.1.1.1" where 1.1.1.1 is ip address of Windows computer with remote desktop enabled, than to reproduce it install/run Total Commander on the Windows computer, happens with other programs (not all) too but it's best visible with Total Commander.

I've captured the xtrace of rdesktop, the corruption should be at the end of log, at the beginning I logged into Windows remote desktop.
Comment 16 Roman Jarosz 2011-09-24 16:42:04 UTC
Created attachment 51578 [details]
No text with patch

With the kgem_submit(&sna->kgem); in winecfg I see empty text (see screenshoot) and when I'm writing in Word mostly I don't see any text, but when the text sometimes appear it looks ok (no corruption).
Comment 17 Chris Wilson 2011-09-25 02:02:44 UTC
One down:

commit 5154e281ed66334a8ff6342236c1203a1e4ac5a3
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Sep 25 09:56:16 2011 +0100

    sna/glyph: Avoid useless attempt at GPU glyph rendering to a1 destinations
    
    The actual bug is a little involved as we don't damage the temporary
    glyph mask correctly presuming that we only hit GPU paths. However,
    should we fail to prepare the composite operation that paints the mask
    on to the destination, things fail horribly.
    
    One particular example is that wine like to create its own temporary a1
    buffer for the glyphs (which we render to via another temporary mask...)
    which triggers the delayed fallback and then sw compositing with a random
    buffer.
    
    Reported-by: Roman Jarosz <kedgedev@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41165
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Comment 18 Roman Jarosz 2011-09-25 02:39:48 UTC
Confirming ... commit 5154e281ed66334a8ff6342236c1203a1e4ac5a3 fixed the corruption in winecfg and Word ... thanks a lot!!!
Comment 19 Chris Wilson 2011-09-25 02:49:03 UTC
My initial impression of krdc is that it does a lot of 1-bit stippled fills along with back-to-front buffer copies. Didn't see any of my usual bugs (but those are the ones that I already fixed I hope!).

Is KRDC + a remote windows destkop + midnight commander the only way to do this? That's going to be a bit of a hassle for me to reproduce. :|

My guess is that it is going to be an annoying typo somewhere.
Comment 20 Roman Jarosz 2011-09-25 02:59:39 UTC
Actually the easies way is rdesktop (no KDE app) + remote windows destkop + total commander (it's free to download, http://www.ghisler.com/)

If you don't have computer with Windows I me be able to create access to one ... later this evening.
Comment 21 Roman Jarosz 2011-09-25 03:51:07 UTC
I was able to get you access to windows box, see mail for access info.
Comment 22 Chris Wilson 2011-09-25 04:43:38 UTC
And the second...

commit a53538659d5e18cb5a7a7a7dbd460f35985183fd
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Sep 25 12:40:01 2011 +0100

    sna/accel: Fix s/x/y/ typo in computing relative drawing coordinates
    
    Reported-by:Roman Jarosz <kedgedev@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41165
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Comment 23 Roman Jarosz 2011-09-25 12:41:47 UTC
Works, thanks a lot one more time! ;)


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.