Bug 18586

Summary: [GM45 GEM] tiled glReadPixels fail with L-shaped memory
Product: Mesa Reporter: liuhaien <haien.liu>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: low CC: cheoppy, haihao.xiang, jiewen.lin
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 18841, 20277    
Attachments: xorg.0.log
xorg conf file
readpix-screenshot
gearbox-screenshot

Description liuhaien 2008-11-17 23:01:11 UTC
Created attachment 20391 [details]
xorg.0.log

System Environment:
--------------------------
Host:		x-gm45
Arch:		i386
OSD:		Fedora release 9 (Sulphur)
Kernel:		2.6.28-rc4
Libdrm:		(master)930c0e7cf4f4776f7a69e7acc6fedeed7addb235
Mesa:		(master)80d6379722a1249ce13db79a898d340644936f67
Xserver:		(master)08cd361234ed0410f67342f46ae01120c4fe3331
Xf86_video_intel:		(master)30c29627c859f1f6780aa652d6de4fa985b63dd0

Bug detailed description:
--------------------------
start X,then run readpix and gearbox,we will get a incorrect rendering as is shown in the attached screenshot. there are two memory banks pluged in our laptop.following is the memory information:

[root@x-gm45 ~]# dmidecode |grep -A16  "Memory Device$"
Memory Device
        Array Handle: 0x0010
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 2048 MB
        Form Factor: SODIMM
        Set: None
        Locator: SODIMM1
        Bank Locator: BANK 0
        Type: Unknown
        Type Detail: Unknown
        Speed: 1067 MHz (0.9 ns)

Handle 0x0012, DMI type 20, 19 bytes
Memory Device Mapped Address
        Starting Address: 0x00000000000
--
Memory Device
        Array Handle: 0x0010
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 1024 MB
        Form Factor: SODIMM
        Set: None
        Locator: SODIMM2
        Bank Locator: BANK 1
        Type: Unknown
        Type Detail: Unknown
        Speed: 1067 MHz (0.9 ns)

Handle 0x0014, DMI type 20, 19 bytes
Memory Device Mapped Address
        Starting Address: 0x00080000000

 
Reproduce steps:
----------------
1.xinit&
2../readpix (gearbox)
Comment 1 liuhaien 2008-11-17 23:01:54 UTC
Created attachment 20392 [details]
xorg conf file
Comment 2 liuhaien 2008-11-17 23:03:07 UTC
Created attachment 20393 [details]
readpix-screenshot
Comment 3 liuhaien 2008-11-17 23:03:40 UTC
Created attachment 20394 [details]
gearbox-screenshot
Comment 4 liuhaien 2008-11-17 23:04:52 UTC
GEM_kernel:       (drm-intel-next)4b26c78ab2927ab2fda5acb5881b9faa6c354afc
Comment 5 liuhaien 2008-11-18 00:47:01 UTC
btw,
1.this laptop is sony vgn-z540, we obtained it recently and had few tests on it. 
2.when set the option "tiling" off,readpix and gearbox can render correctly.
3.readpix works well on another machine which have 4 memory slots but only the first and third slot are plugged.
Comment 6 liuhaien 2008-11-18 00:48:51 UTC
(In reply to comment #5)
> btw,
> 1.this laptop is sony vgn-z540, we obtained it recently and had few tests on
> it. 
> 2.when set the option "tiling" off,readpix and gearbox can render correctly.
> 3.readpix works well on another machine which have 4 memory slots but only the
> first and third slot are plugged.
> 

"another machine" which I said is also GM45. 
Comment 7 Gordon Jin 2008-11-18 01:17:27 UTC
Haihao's GM965 SDV has similar issue. See below email for the details:

From: linux-gfx-bounces@linux.intel.com [mailto:linux-gfx-bounces@linux.intel.com] On Behalf Of Xiang, Haihao
Sent: Monday, November 03, 2008 11:19 AM
To: Anholt, Eric
Cc: Linux GFX
Subject: [Linux-gfx] glReadPixels still fails on GM965 with current GEM kernel

Hi, Eric
    Some mesa demos(readpix, gearbox) don't work well with the current
GEM kernel because glReadPixels can't read right pixels from frame
buffer on my box (Crestline, GM965). Many OGL cases also fail too on
this box due to this issue.

system:
   GM965, interleaved memory, channel xor randomization turned on (2x1GB
sticks, dcc=0xf0202)

./intel_stepping:
 Vendor: 0x8086, Device: 0x2a02, Revision: 0x01 (<C0)

./intel_reg_dumper:
(II): DumpRegsBegin
(II):            CHDECMISC: 0x00000000 (none, ch2 enh disabled, ch1 enh
disabled, ch0 enh disabled, flex disabled, ep not present)
(II):               C0DRB0: 0x000f0202 (0x0202)
(II):               C0DRB1: 0x0000000f (0x000f)
(II):               C0DRB2: 0x00000000 (0x0000)
(II):               C0DRB3: 0x0e000000 (0x0000)
(II):               C1DRB0: 0x17cbe000 (0xe000)
(II):               C1DRB1: 0x000017cb (0x17cb)
(II):               C1DRB2: 0x00000000 (0x0000)
(II):               C1DRB3: 0x00000000 (0x0000)
(II):              C0DRA01: 0x00030e00 (0x0e00)
(II):              C0DRA23: 0x000c0003 (0x0003)
(II):              C1DRA01: 0x00000000 (0x0000)
(II):              C1DRA23: 0x00000000 (0x0000)
......
Comment 8 liuhaien 2008-11-18 17:35:34 UTC
I recheck the GM45 which works well ,and find there are just two memory slots on it.but  "dmidecode |grep -A16  "Memory Device$" shows it has 4 slots; following is the output of dmidecode |grep -A16  "Memory Device$":
Memory Device
        Array Handle: 0x0023
        Error Information Handle: 0x0027
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 1024 MB
        Form Factor: SODIMM
        Set: None
        Locator: DIMM0
        Bank Locator: BANK 0
        Type: DDR2
        Type Detail: Synchronous
        Speed: 800 MHz (1.2 ns)
        Manufacturer: Micron
        Serial Number: DE0AA595
        Asset Tag: Unknown
        Part Number: 16HTF12864HY-80EDZ
--
Memory Device
        Array Handle: 0x0023
        Error Information Handle: No Error
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: SODIMM
        Set: None
        Locator: DIMM1
        Bank Locator: BANK 1
        Type: Unknown
        Type Detail: None
        Speed: Unknown
        Manufacturer: Unknown
        Serial Number: Unknown
        Asset Tag: Unknown
        Part Number: <BAD INDEX>
--
Memory Device
        Array Handle: 0x0023
        Error Information Handle: 0x002A
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 1024 MB
        Form Factor: SODIMM
        Set: None
        Locator: DIMM2
        Bank Locator: BANK 2
        Type: DDR2
        Type Detail: Synchronous
        Speed: 800 MHz (1.2 ns)
        Manufacturer: Micron
        Serial Number: DE0AA5D2
        Asset Tag: Unknown
        Part Number: 16HTF12864HY-80EDZ
--
Memory Device
        Array Handle: 0x0023
        Error Information Handle: No Error
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: SODIMM
        Set: None
        Locator: DIMM3
        Bank Locator: BANK 3
        Type: Unknown
        Type Detail: None
        Speed: Unknown
        Manufacturer: Unknown
        Serial Number: Unknown
        Asset Tag: Unknown
        Part Number: <BAD INDEX>
Comment 9 Gordon Jin 2008-11-18 17:46:06 UTC
Eric, to make it clear. We're talking about 2 GM45.
The reported "bad" one is Sony GM45 product.
The "another" one "which works well" is GM45 SDV, which is referenced in comment#8.
Comment 10 Eric Anholt 2008-11-25 14:15:01 UTC
Posted proposed patch to dri-devel, also in for-review.

commit 79723203cd91f40263835c4f308bda701c504ec9
Author: Eric Anholt <eric@anholt.net>
Date:   Tue Nov 25 14:02:05 2008 -0800

    drm/i915: Respect GM965/GM45 bit-17-instead-of-bit-11 option for swizzling.
    
    This fixes readpixels and buffer corruption when swapped out and in by
    disabling tiling on them.
    
    Now that we know that the bit 17 mode isn't just a mistake of older chipsets
    we'll need to work on a clever fix so that we can get the performance of
    tiling on these chipsets, but that will require intrusive changes targeted
    at the next kernel release, not this one.

I found it in the one remaining spec that I apparently had missed in previous reviews.  It's of course not in the published specs.
Comment 11 Eric Anholt 2008-12-01 18:33:33 UTC
g45 side of this patch is wrong.  need specs.
Comment 12 Gordon Jin 2008-12-02 18:18:45 UTC
The patch is also in for-airlied, so at least GM965 has been fixed. Decreasing severity.

pending on GM45 spec side.
Comment 13 Eric Anholt 2008-12-18 09:23:44 UTC
*** Bug 18256 has been marked as a duplicate of this bug. ***
Comment 14 Gordon Jin 2009-02-23 17:39:58 UTC
Eric, any update on GM45 side? I really want this got fixed soon, as this Sony GM45 machine is not useful at all for my testing.
Comment 15 Eric Anholt 2009-03-13 17:06:08 UTC
Please don't mix this bug up with any other bug reports about tiling failure (e.g. the gm965 sdv).

This one is for dealing with L-shaped memory on mobile chips that support interleave.  This requires a specific workaround that I'm not too sure how to make right now.
Comment 16 Eric Anholt 2009-10-30 17:43:00 UTC
commit 7c8bed62e0165a0be3363f7abf81bf9e30341e00
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Oct 30 15:33:11 2009 -0700

    intel: Use GTT mapping when available for swrast.
    
    This improves piglit quick.tests runtime from 19:33 minutes to 6:06 on
    my GM45.  It should also hide most of the A17 swizzling issues, though
    they'll still exist when swapping occurs (which is the kernel's problem
    either way)
Comment 17 fangxun 2009-11-05 06:49:03 UTC
With current driver, rendering is correct when runnig readpix and gearbox, but the screen will flicker sometimes.

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.