Bug 42625

Summary: [945G] Incorrect tiling/swizzling configuration
Product: DRI Reporter: Pavel Ondračka <pavel.ondracka>
Component: DRM/IntelAssignee: Daniel Vetter <daniel>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: high CC: ben, bugzilla, chris, daniel, jbarnes, Pitxyoki
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
small part of the corrupted wallpaper
none
Xorg.0.log
none
dmesg
none
glxinfo
none
print out detected swizzle configuration
none
new kernel log
none
fix swizzle detection on gen3/4 none

Description Pavel Ondračka 2011-11-05 10:25:41 UTC
Created attachment 53188 [details]
small part of the corrupted wallpaper

After some time using my desktop, the wallpaper becomes corrupted, it looks chequered as if some parts of the screen were switched (screenshot attached). This is not a SNA regression, I just tried SNA to check if this is fixed there and its not. 
No visible corruption in any other part of the desktop, just the wallpaper.
Comment 1 Pavel Ondračka 2011-11-05 10:26:28 UTC
Created attachment 53189 [details]
Xorg.0.log
Comment 2 Pavel Ondračka 2011-11-05 10:26:51 UTC
Created attachment 53190 [details]
dmesg
Comment 3 Pavel Ondračka 2011-11-05 10:27:13 UTC
Created attachment 53191 [details]
glxinfo
Comment 4 Chris Wilson 2011-11-05 12:41:54 UTC
Can I have a few details as to how the wallpaper is being rendered? Are using you using gnome-shell, nautilus, kwin, etc?
Comment 5 Pavel Ondračka 2011-11-05 15:12:02 UTC
This is using gnome 3 fallback mode, but i did have the some problem with gnome 2 and nautilus.
Comment 6 Chris Wilson 2011-11-05 15:58:01 UTC
Can you please download intel-gpu-tools [git://anongit.freedesktop.org/xorg/app/intel-gpu-tools] and execute gem_tiled_blits and gem_tiled_pread? That should hopefully verify the basic tiling works.
Comment 7 Daniel Vetter 2011-11-05 16:55:18 UTC
Created attachment 53203 [details] [review]
print out detected swizzle configuration

Can you please apply this kernel patch and attach the ouput of it? Also please attach the lspci -nn line for your gpu.
Comment 8 Pavel Ondračka 2011-11-06 08:14:37 UTC
gem_tiled_blits:

Starting program: /home/Marie/intel-gpu-tools/tests/gem_tiled_blits 
[Thread debugging using libthread_db enabled]
Using 383 1MiB buffers
Verifying initialisation...
Expected 0x00180080, found 0x00180090 at offset 0x00000200

Program received signal SIGABRT, Aborted.
0x00110416 in __kernel_vsyscall ()
(gdb) bt full
#0  0x00110416 in __kernel_vsyscall ()
No symbol table info available.
#1  0x4684e26f in __GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
        resultvar = <optimized out>
        resultvar = <optimized out>
        pid = 1184530420
        selftid = 8924
#2  0x4684fba5 in __GI_abort () at abort.c:93
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x80481dc, 
            sa_sigaction = 0x80481dc}, sa_mask = {__val = {3221221820, 
              1182915156, 0, 3086906952, 1, 0, 1, 1182914808, 0, 134537104, 
              40, 0, 134517524, 134532104, 1183785625, 1206927608, 1206897028, 
              7, 0, 3221221876, 3221221904, 1184530420, 134580568, 134580568, 
              1182914808, 0, 134532224, 134514235, 1140799, 134532224, 
              1074553951, 3221221876}}, sa_flags = 134528388, 
          sa_restorer = 0x804cf78}
        sigs = {__val = {32, 0 <repeats 31 times>}}
#3  0x080492b4 in check_bo (bo=<optimized out>, start_val=<optimized out>)
    at gem_tiled_blits.c:122
        linear_bo = 0x8058958
        linear = 0xa13e6000
        i = <optimized out>
#4  0x08048dde in main (argc=1, argv=0xbffff394) at gem_tiled_blits.c:170
        bo = 0x804c008
        bo_start_val = 0x804c608
        start = 100401152
        i = <optimized out>
        fd = 7
        count = 383


gem_tiled_pread:

Starting program: /home/Marie/intel-gpu-tools/tests/gem_tiled_pread 
[Thread debugging using libthread_db enabled]
Bad read [0]: 16 instead of 0 at 0x00000000 for read from 0x00000000 to 0x00100000, swizzle=none

Program received signal SIGABRT, Aborted.
0x00110416 in __kernel_vsyscall ()
(gdb) bt full
#0  0x00110416 in __kernel_vsyscall ()
No symbol table info available.
#1  0x4684e26f in __GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
        resultvar = <optimized out>
        resultvar = <optimized out>
        pid = 1184530420
        selftid = 8948
#2  0x4684fba5 in __GI_abort () at abort.c:93
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x80481dc, 
            sa_sigaction = 0x80481dc}, sa_mask = {__val = {3221221836, 
              1182915156, 0, 3086906952, 1, 0, 1, 1182914808, 3221221872, 
              1182914808, 1, 134522904, 3087006040, 0, 3086906952, 1206891120, 
              1, 0, 0, 134523020, 3221221920, 1182963268, 134522968, 0, 
              1182914808, 0, 1182870064, 134513638, 1183785600, 7, 4294967295, 
              134522968}}, sa_flags = 1182912452, sa_restorer = 0xb7fff958}
        sigs = {__val = {32, 0 <repeats 31 times>}}
#3  0x08048b7c in main (argc=1, argv=0xbffff394) at gem_tiled_pread.c:286
        expected_val = 0
        found_val = <optimized out>
        swizzled_offset = <optimized out>
        swizzle_str = 0x80493b4 "none"
        size = 1048576
        offset = 0
        len = <optimized out>
        j = <optimized out>
        fd = 7
        i = <optimized out>
        tiling = <optimized out>
        swizzle = 0
        handle = 1
        devid = <optimized out>
Comment 9 Pavel Ondračka 2011-11-06 08:15:55 UTC
$ lspci -nn

00:00.0 Host bridge [0600]: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub [8086:2770] (rev 02)
00:01.0 PCI bridge [0604]: Intel Corporation 82945G/GZ/P/PL PCI Express Root Port [8086:2771] (rev 02)
00:02.0 VGA compatible controller [0300]: Intel Corporation 82945G/GZ Integrated Graphics Controller [8086:2772] (rev 02)
00:02.1 Display controller [0380]: Intel Corporation 82945G/GZ Integrated Graphics Controller [8086:2776] (rev 02)
00:1c.0 PCI bridge [0604]: Intel Corporation N10/ICH 7 Family PCI Express Port 1 [8086:27d0] (rev 01)
00:1c.1 PCI bridge [0604]: Intel Corporation N10/ICH 7 Family PCI Express Port 2 [8086:27d2] (rev 01)
00:1d.0 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 [8086:27c8] (rev 01)
00:1d.1 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 [8086:27c9] (rev 01)
00:1d.2 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 [8086:27ca] (rev 01)
00:1d.3 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 [8086:27cb] (rev 01)
00:1d.7 USB Controller [0c03]: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller [8086:27cc] (rev 01)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev e1)
00:1e.2 Multimedia audio controller [0401]: Intel Corporation 82801G (ICH7 Family) AC'97 Audio Controller [8086:27de] (rev 01)
00:1f.0 ISA bridge [0601]: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge [8086:27b8] (rev 01)
00:1f.1 IDE interface [0101]: Intel Corporation 82801G (ICH7 Family) IDE Controller [8086:27df] (rev 01)
00:1f.2 IDE interface [0101]: Intel Corporation N10/ICH7 Family SATA IDE Controller [8086:27c0] (rev 01)
00:1f.3 SMBus [0c05]: Intel Corporation N10/ICH 7 Family SMBus Controller [8086:27da] (rev 01)
02:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express [14e4:1677] (rev 01)
04:02.0 Multimedia controller [0480]: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast Decoder [1131:7133] (rev d0)
Comment 10 Daniel Vetter 2011-11-06 09:14:47 UTC
Woot, tiling is indeed broken. Pavel, can you grab the debug output of my kernel patch, please? I'll try to dig up what's going wrong with my i915G meanwhile, that fails in a similar fashion with the intel-gpu-tools tests.
Comment 11 Pavel Ondračka 2011-11-06 23:45:56 UTC
Created attachment 53232 [details]
new kernel log

Hi, sorry it took so long, this is old P4 system and kernel compilation takes ages. I hope I did it right, there is just one extra line printed:
[    6.908466] bit6 swizzling for x: 0 and for y 0
Full log attached.
Comment 12 Daniel Vetter 2011-11-07 02:38:07 UTC
> --- Comment #11 from Pavel Ondračka <pavel.ondracka@email.cz> 2011-11-06 23:45:56 PST ---
> Hi, sorry it took so long, this is old P4 system and kernel compilation takes
> ages. I hope I did it right, there is just one extra line printed:
> [    6.908466] bit6 swizzling for x: 0 and for y 0
> Full log attached.

No problem. Interesting that your machine is a P4, too. Next thing to do:
Can you please check the ram module configuration of your machine? I'd
need the capacity of every module and in which slot and channel it's in.

Can you also check in your bios whether there's a ddr ram config option
like "channel interleave" and report its setting (if it exists).

Thanks, Daniel
Comment 13 Pavel Ondračka 2011-11-07 02:56:15 UTC
OK, some info from BIOS, if you need more Iľl need more detailed instructions how to obtain it. 

Memory size: 1,0GB
Memory speed: 533MHz
Memory channel mode: Dual Interleaved
Memory technology: DDR2 SDRAM

------------+------------+------+----------+--------------
Memory slot | Size | ECC | Rank | Type     | Organization
------------+------------+------+----------+--------------
DIMM 1      |512 MB| no  |  1   |Unbuffered| x8
------------+------------+------+----------+--------------
DIMM 2      |empty |     |      |          |
------------+------------+------+----------+--------------
DIMM 3      |512 MB| no  |  1   |Unbuffered| x8
------------+------------+------+----------+--------------
DIMM 4      |empty |     |      |          |
------------+------------+------+----------+--------------
Comment 14 Daniel Vetter 2011-11-07 11:21:18 UTC
Created attachment 53264 [details] [review]
fix swizzle detection on gen3/4

Please test this kernel patch, both with the test from intel-gpu-tools and with your background image.
Comment 15 Pavel Ondračka 2011-11-07 13:15:51 UTC
(In reply to comment #14)
> Created attachment 53264 [details] [review] [review]
> fix swizzle detection on gen3/4
> 
> Please test this kernel patch, both with the test from intel-gpu-tools and with
> your background image.

Hi, both tests now execute without crash and no corruption so far. Thank you for incredibly fast response and patch.
Comment 16 Daniel Vetter 2011-11-07 13:35:31 UTC
I've added your tested-by to the patch I'll submit. To double-check that things work correctly now, can you please try my swizzling branch at

http://cgit.freedesktop.org/~danvet/drm/log/?h=swizzling

and attach the contents of i915_swizzle_info from debugfs?
Comment 17 Pavel Ondračka 2011-11-08 03:47:43 UTC
(In reply to comment #16)
> I've added your tested-by to the patch I'll submit. To double-check that things
> work correctly now, can you please try my swizzling branch at
> 
> http://cgit.freedesktop.org/~danvet/drm/log/?h=swizzling
> 
> and attach the contents of i915_swizzle_info from debugfs?

$ cat /sys/kernel/debug/dri/0/i915_swizzle_info
bit6 swizzle for X-tiling = bit9/bit10/bit17
bit6 swizzle for Y-tiling = bit9/bit17
DDC = 0x000f0202
C0DRB3 = 0x04020000
C1DRB3 = 0x0e0d0d0d
Comment 18 Pavel Ondračka 2011-11-24 04:29:37 UTC
Hi, what is the current status of this patch. Will it be also included in stable kernels (particularly 3.0.x )?
Comment 19 Daniel Vetter 2011-11-24 05:37:50 UTC
Patch is submitted with Cc stable tag, but not yet reviewed. So I plan to push it to 3.0.x stable series, but it's likely gonna take a little while longer till it's there.
Comment 20 Pavel Ondračka 2012-01-22 02:58:23 UTC
Hi, sorry to bring this up again, but its been almost three moths and the patch which fixes this bug is still not committed. Is there anything I can do (more testing?) to speed things up?
Comment 21 Daniel Vetter 2012-01-22 03:24:32 UTC
> --- Comment #20 from Pavel Ondračka <pavel.ondracka@email.cz> 2012-01-22 02:58:23 PST ---
> Hi, sorry to bring this up again, but its been almost three moths and the patch
> which fixes this bug is still not committed. Is there anything I can do (more
> testing?) to speed things up?

Nope, and my apologies for the delay. We've had a bunch of process
screw-ups here in drm/i915-land, which resulted in this patch (and
quite a few other things) getting delayed for months.

It should land in the new drm-intel-next tree in 1-2 weeks (we still
have a backlog of merging patches).

Yours, Daniel
Comment 22 Daniel Vetter 2012-02-08 02:19:44 UTC
Patch merged to drm-intel-next, on track to get merged to 3.4.
Comment 23 Daniel Vetter 2012-02-08 09:39:48 UTC
*** Bug 21539 has been marked as a duplicate of this bug. ***
Comment 24 Gordon Jin 2012-02-08 16:47:40 UTC
removing the block relationship, assuming there's no plan to backport to 3.2.x or 3.3.x.
Comment 25 Pavel Ondračka 2012-02-09 01:40:13 UTC
(In reply to comment #24)
> removing the block relationship, assuming there's no plan to backport to 3.2.x
> or 3.3.x.

Well, according to comment 19 there was some plan to backport this. The first version of the patch in the danvet swizzle branch was tagged for stable, the version in drm-intel-next however is not. It would be nice to have this backported, but its not a big deal.
Comment 26 Florian Mickler 2012-04-05 06:53:19 UTC
A patch referencing this bug report has been merged in Linux v3.4-rc1:

commit c9c4b6f6c28354f1df9bd288dc33ba7ae0e66aaa
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Dec 14 13:57:15 2011 +0100

    drm/i915: fix swizzle detection for gen3
Comment 27 Chris Wilson 2012-10-03 14:30:47 UTC
*** Bug 55551 has been marked as a duplicate of this bug. ***
Comment 28 Pitxyoki 2012-10-03 15:53:59 UTC
Hi,

Like I said on bug 55551, I'm testing this patch against the Debian 3.2 kernel.
Along with the other two commits mentioned on that bug the issues seem to be gone.

Is it possible to merge the mentioned commit (c9c4b6f6c28354f1df9bd288dc33ba7ae0e66aaa) to the 3.2-stable branch?

Thanks and best regards,
Luís Picciochi
Comment 29 Daniel Vetter 2012-10-03 16:10:43 UTC
On Wed, Oct 3, 2012 at 5:53 PM,  <bugzilla-daemon@freedesktop.org> wrote:
> Is it possible to merge the mentioned commit
> (c9c4b6f6c28354f1df9bd288dc33ba7ae0e66aaa) to the 3.2-stable branch?

Sure, simple send the (upstream) git sha1 to the stable team with a
note that it should be applied to 3.2 and a link to this bug. Also
please cc me, so that I can ack it.
-Daniel

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.