Bug 16326 - [GEM 965] drawpix run mess
Summary: [GEM 965] drawpix run mess
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: Eric Anholt
QA Contact:
URL:
Whiteboard:
Keywords:
: 16324 16371 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-12 20:37 UTC by liuhaien
Modified: 2008-08-07 23:16 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
drawpix_image (588.55 KB, image/gif)
2008-06-12 20:37 UTC, liuhaien
Details
Xorg.0.log (46.09 KB, text/plain)
2008-06-12 20:41 UTC, liuhaien
Details
xorg conf file (3.57 KB, text/plain)
2008-06-12 20:41 UTC, liuhaien
Details
tiling test app (1.42 KB, application/octet-stream)
2008-06-17 23:37 UTC, Eric Anholt
Details
untile.png (760.66 KB, image/png)
2008-06-18 00:50 UTC, liuhaien
Details
after_change_image (831.23 KB, image/png)
2008-06-18 01:08 UTC, liuhaien
Details

Description liuhaien 2008-06-12 20:37:39 UTC
Created attachment 17088 [details]
drawpix_image

System Environment:
--------------------------
Host:           q965
Arch:           i386
Kernel:         2.6.25
Libdrm_gem: drm-gem branch      500c81d194115fb3c4b97d742519689478eeb4e8
3D driver: drm-gem branch       f5d03af109e0c6fdd7cc6786f8ae40f8ae626f5a
Xserver: drm-gem branch         656d5d98855eb608ec6581f8c574f343a216ea32
2D driver:drm-gem branch        e930c0dc5b5f98d256a4167ed70ba813c88924d2

Bug detailed description:
--------------------------
start X,when run drawpix(mesa demos),the picture looks like mess. and the issue can reprodue on the case "winpos" 

Reproduce steps:
----------------
1.xinit&
2../drawpix
Comment 1 liuhaien 2008-06-12 20:40:47 UTC
attament is the snapshot of drawpix.
Comment 2 liuhaien 2008-06-12 20:41:29 UTC
Created attachment 17089 [details]
Xorg.0.log
Comment 3 liuhaien 2008-06-12 20:41:59 UTC
Created attachment 17090 [details]
xorg conf file
Comment 4 Eric Anholt 2008-06-17 11:19:50 UTC
The specs are wrong about the tile format on 965.  Fix pushed.
Comment 5 liuhaien 2008-06-17 19:51:52 UTC
run drawpix using the latest commit of mesa as you said,but the issue still exists.
-----------------------------------
3D driver: drm-gem branch       64adeb163d7da6d75b5664cd2ee3783cadaf63d8


Comment 6 Eric Anholt 2008-06-17 23:37:25 UTC
Created attachment 17206 [details]
tiling test app

Even if this fix didn't work on your hardware, it should have significantly changed the output.  Could you attach a screenshot produced using the gimp or imagemagick's import or whatever tool, instead of a photograph (where it's hard to discern the patterns of what's happening).

If my change did actually change the output but didn't fix the problem, please revert my change and try running the attached program with no_rast=true set in the environment, and attach a screenshot of the results.
Comment 7 liuhaien 2008-06-18 00:50:35 UTC
Created attachment 17208 [details]
untile.png

your change changed the output but didn't fix the problem, I try to revert your change and run your attached "untile" with no_rast=true.untile.png,which is attached, is the snapshot of the result.
Comment 8 liuhaien 2008-06-18 01:08:08 UTC
Created attachment 17209 [details]
after_change_image

attachment is the snapshot of "drawpix" after using your change,wish it can help you.
Comment 9 Eric Anholt 2008-06-26 15:43:26 UTC
This is a hard issue -- we've now seen 3-4 different formats for the tiling layout, despite the docs only describing one.  We're working on getting the needed documentation on how to determine the layout before giving up and implementing a workaround.
Comment 10 Eric Anholt 2008-06-26 15:50:41 UTC
*** Bug 16324 has been marked as a duplicate of this bug. ***
Comment 11 Eric Anholt 2008-06-26 15:54:33 UTC
*** Bug 16371 has been marked as a duplicate of this bug. ***
Comment 12 Eric Anholt 2008-07-02 10:29:17 UTC
I've added a workaround option to let us continue testing until we get a response on how to properly detect the tile swizzling.  There are now 3 tile swizzling modes in driconf, with no extra swizzling (0) being the default.  I have systems for both modes 1 and mode 2.  For this system, please set mode 1 (bit 6 ^ bit 9 ^ bit 10).  I'm still at a loss as to where those other two misplaced pixels are coming from.

To debug tile swizzling issues with software fallbacks:

1) Run drawpix with mode 0.  If it draws incorrectly, try swizzle modes 1 and 2.  If no mode works, post bug with untile output with mode 0 set.  Otherwise, leave that mode set for further testing.
2) Run the reflect demo.  Press 'd' to get the output of the depthbuffer.  If it looks scrambled (4x4 blocks swapped, things like that), set swizzle mode to 0 and post screenshot.

Comment 13 Shuang He 2008-07-07 22:44:31 UTC
(In reply to comment #12)
> I've added a workaround option to let us continue testing until we get a
> response on how to properly detect the tile swizzling.  There are now 3 tile
> swizzling modes in driconf, with no extra swizzling (0) being the default.  I
> have systems for both modes 1 and mode 2.  For this system, please set mode 1
> (bit 6 ^ bit 9 ^ bit 10).  I'm still at a loss as to where those other two
> misplaced pixels are coming from.
> 
> To debug tile swizzling issues with software fallbacks:
> 
> 1) Run drawpix with mode 0.  If it draws incorrectly, try swizzle modes 1 and
> 2.  If no mode works, post bug with untile output with mode 0 set.  Otherwise,
> leave that mode set for further testing.
> 2) Run the reflect demo.  Press 'd' to get the output of the depthbuffer.  If
> it looks scrambled (4x4 blocks swapped, things like that), set swizzle mode to
> 0 and post screenshot.
> 


for  1) change to use swizzle_mode 1 make drawpix work well.
then 2) reflect's depthbuffer works well in swizzle_mode 1
Comment 14 Eric Anholt 2008-07-12 18:27:45 UTC
This needs to be retested with the current code.  swizzle_mode no longer has an effect and it should be automatic.
Comment 15 Shuang He 2008-07-13 19:13:05 UTC
(In reply to comment #14)
> This needs to be retested with the current code.  swizzle_mode no longer has an
> effect and it should be automatic.
> 

we've repull all components, but failed to build.
for drm/linux-core pci_read_base is used, but we only found pci_read_bases is defined in kernel. is it just a typo or a newly defined functoin?
for mesa, intel_region:tiled is changed into intel_region:tiling, but intel_region:tiled is still used in src/mesa/drivers/dri/i915/intel_pixel_read.c
Comment 16 Shuang He 2008-07-14 19:44:26 UTC
Ooops, we tested this one on wrong drm module.
after change pci_read_base into pci_read_bases, the module can be loaded, but it will report 
[drm:i915_gem_detect_bit_6_swizzle] *ERROR* Couldn't map MCHBAR to determine tile swizzling

Could you tell us how to correctly build the drm module?
Comment 17 Eric Anholt 2008-07-15 13:29:57 UTC
You've correctly built it as far as I know.  That error means "the hardware didn't do what we expected, so we disabled tiling".  I assume the demo works correctly, then?
Comment 18 Shuang He 2008-07-16 01:28:51 UTC
(In reply to comment #17)
> You've correctly built it as far as I know.  That error means "the hardware
> didn't do what we expected, so we disabled tiling".  I assume the demo works
> correctly, then?
> 

We have apply the patch adding pci_read_base() to our kernel.
This demo still can't render correctly.
And just for your information, if we following modification can make drawpix and gearbox work well on our Q965:
 i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 {
@@ -93,6 +94,10 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
        int mchbar_offset;
        volatile char *mchbar;
        int ret;
+       dev_priv->mm.bit_6_swizzle_x = swizzle_x;
+       dev_priv->mm.bit_6_swizzle_y = swizzle_y;
+       return;
+
Comment 19 Eric Anholt 2008-07-16 09:16:41 UTC
That just disables tiling, which will be correct but slower.

What's the value of CHDECMISC that's being read out?  What's the memory configuration on your system?
Comment 20 Shuang He 2008-07-16 18:21:12 UTC
(In reply to comment #19)
> That just disables tiling, which will be correct but slower.
> 
> What's the value of CHDECMISC that's being read out?  What's the memory
> configuration on your system?
> 

CHDECMISC = 0x000000ff
It have 1Gx2 memory. 
Comment 21 Eric Anholt 2008-07-17 15:04:39 UTC
OK, that's the "your bridge isn't decoding the access" value.  You should see this line in dmesg:

[drm:i915_gem_detect_bit_6_swizzle] *ERROR* Couldn't map MCHBAR to determine
tile swizzling

You should see tiling getting disabled as a result

(II) intel(0): 0x01000000-0x01ffffff: depth buffer (16384 kB)
(II) intel(0): 0x02000000-0x02ffffff: back buffer (16384 kB)
(II) intel(0): 0x03000000-0x03ffffff: front buffer (16384 kB)
(none of them say X or Y tiled)

And the demos should work.  Is this not what's happening?
Comment 22 Shuang He 2008-07-17 21:39:34 UTC
*** Bug 16324 has been marked as a duplicate of this bug. ***
Comment 23 Shuang He 2008-07-17 21:40:03 UTC
*** Bug 16371 has been marked as a duplicate of this bug. ***
Comment 24 Eric Anholt 2008-07-25 14:04:05 UTC
If you have commit 78f1fc9cbcb383d42d903a8b9febdcf3c438ea7c this should be fixed.  Is it?
Comment 25 Michael Fu 2008-07-26 02:51:06 UTC
mark as fixed and wait for QA to verify.
Comment 26 liuhaien 2008-07-27 20:27:30 UTC
verified.
Comment 27 Shuang He 2008-08-05 23:34:31 UTC
We've just tried drm-gem for all components except drm module and kernel
from anholt's linux-2.6 tree drm-gem-merge branch. This issue happens again. In dmesg we see:
[drm:i915_gem_detect_bit_6_swizzle] *ERROR* pci_read_base failed: -6
Comment 28 Eric Anholt 2008-08-07 18:43:15 UTC
pci_read_base is entirely gone now and should no longer cause problems.
Comment 29 Shuang He 2008-08-07 23:16:20 UTC
(In reply to comment #28)
> pci_read_base is entirely gone now and should no longer cause problems.
> 

yeah, it's working now with new codes.


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.