Bug 20473

Summary: [855GM] garbled 3D with latest xf86-video-intel git, with tiling on
Product: Mesa Reporter: Kalev Lember <kalevlember>
Component: Drivers/DRI/i915Assignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium CC: aguertin+freedesktop, daniel, remi, wolput
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 20277    
Attachments: Garbled glxgears screenshot
Xorg log
fix link-time breakage of i915_dri.so in latest mesa -master
fix window wider than 512 pixels
debug patch: show driDrawable coords

Description Kalev Lember 2009-03-04 15:38:52 UTC
Created attachment 23539 [details]
Garbled glxgears screenshot

I am getting garbled 3D with latest xf86-video-intel git. I am using xorg-server 1.6, Linux 2.6.29-rc7 with kernel modesetting, libdrm 2.4.5 and Mesa 7.3 on an i686 Gentoo system.

It is an IBM R51 laptop with integrated 855GM video.

A work-around I have found is to disable tiling in xorg.conf.
Comment 1 Kalev Lember 2009-03-04 15:40:19 UTC
Created attachment 23540 [details]
Xorg log
Comment 2 Gordon Jin 2009-03-04 18:17:37 UTC
Is it the same if without kernel modesetting?
Comment 3 Kalev Lember 2009-03-05 15:44:06 UTC
Without kernel modesetting if I have tiling on, the whole screen is garbled (even KDM login screen). With tiling off, everything looks OK.

Anything else I could test?
Comment 4 Kalev Lember 2009-03-20 18:29:53 UTC
I filed a new bug #20781 about whole screen being garbled, as it is probably a different problem.

Coming back to the 3D corruption, I can now confirm that if I have tiling on, glxgears picture is garbled in both KMS and non-KMS cases. And turning tiling off fixes it in both cases.
Comment 5 liuhaien 2009-04-02 23:50:46 UTC
we can reproduce this issue on our 855gm against the latest driver:
Libdrm:            (master)51d6346f9f3c425f49e57d185530c6bcaeb94f5e
Mesa:           (mesa_7_4_branch)7be149cfd131c0b3f7d4337bb83e6fba5f563bf9
Xserver:   (server-1.6-branch) 60c161545af80eb78eb790a05bde79409dfdf16e
Xf86_video_intel:               (2.7)10b5014c42dc055d9559ee112cc7a017e887d813	
Kernel:  (drm-intel-2.6.29) 0e56a4d653b66d4729f944b23935a00c4472f987
Comment 6 Daniel Vetter 2009-04-07 04:00:49 UTC
I seem to have a similar issue on my i855GM (IBM Thinkpad X40). It looks like glxgears renders correctly, but when drawing to the frontbuffer, the tiling is screwed up.

The interesting thing is that with mes-7.3, when a make the glxgears window wider than 512 pixels (height doesn't matter), it looks all right again. My back-of-the-envelope calc shows that this should be that 512 is the max width for a tiled surface (with 4 bytes per pixel). With mesa-7.4, widening the window does not help at all. Additionally, it doesn't render into the whole area but only the upper left corner. But the gears get bigger (still tiled, of course).
Comment 7 Daniel Vetter 2009-04-07 04:34:04 UTC
I tried to bisect my window-wider-than-512-pixel observation. Results:

d0edbbb3f36b569ab0ecce2dd10b8abfb41b8388
Last version of mesa where a window wider than 512 pixels fixes my issue.

e41780fedc2c1f22b43118da30a0103fa68b769f
The version in between. Here I just get a completely black glxgears window. Nothing changes when resizing.

e9f37831698846bbd960b9eac07b0e520d64f799
This is the first commit where a window wider than 512 pixels doesn't fix it. Furthermore it looks like the viewport is somehow not updated. glxgears only ever renders into the upper-left corner of the window with an area the size when it was started.

I've just checked and with -fullscreen, glxgears seems to work even with the bad commits (window is wider than 512 pixels). Looks like an independant problem. Should I file another bug report about this viewport issue?
Comment 8 Daniel Vetter 2009-04-07 07:56:11 UTC
I've just checked the master branch of mesa. Both gallium and non-gallium have the tiling issue. But gallium does not have the viewport issue, i.e. it draws into the whole window and if it's wider than 512 pixels, everything is alright.
Comment 9 Jos van Wolput 2009-04-21 04:10:52 UTC
(In reply to comment #7)

The viewport issue also affects running GoogleEarth, showing only a small map in the upper-left corner of the window (bug 21099).
This seems to be caused by an error in
/mesa-master/src/mesa/drivers/dri/i915/i915_state.c somewhere in "Update the
viewport transformation matrix".
Replacing this file with the one of
mesa-d0edbbb3f36b569ab0ecce2dd10b8abfb41b8388
fixes the glxgears and GoogleEarth issue (using UXA with tiling disabled).





Comment 10 Jos van Wolput 2009-04-22 03:43:37 UTC
(In reply to comment #9)

Also renders glxgears correctly when tiling is enabled.



Comment 11 aguertin+freedesktop 2009-04-24 08:40:12 UTC
This also affects 845G
Comment 12 Jos van Wolput 2009-05-08 22:36:55 UTC
I've just checked the master branch of mesa (Mesa 7.6-devel) and the master branch of the video-intel driver (2.7.99).
I am using Debian kernel 2.6.30-rc4-686, modesetting enabled.
Both issues (garbled 3D and window not wider than 512 pixels) are fixed.
In Mesa 7.5.rc1 the garbled 3D is fixed but the window problem is still present!

Comment 13 Daniel Vetter 2009-05-09 11:23:02 UTC
On Fri, May 08, 2009 at 10:37:03PM -0700, bugzilla-daemon@freedesktop.org wrote:
> --- Comment #12 from Jos van Wolput <wolput@onsneteindhoven.nl>  2009-05-08 22:36:55 PST ---
> I've just checked the master branch of mesa (Mesa 7.6-devel) and the master
> branch of the video-intel driver (2.7.99).
> I am using Debian kernel 2.6.30-rc4-686, modesetting enabled.
> Both issues (garbled 3D and window not wider than 512 pixels) are fixed.
> In Mesa 7.5.rc1 the garbled 3D is fixed but the window problem is still
> present!
I've just retested latest 2d-ddx and mesa (both times master branch). The
problem still exists on my setup (debian, too, and a recent kernel:
v2.6.30-rc2).

- using the gallium drivers I get tiled output and all the effects of the
  broken viewport isse.

- with normal mesa dri (so file lib/i915_dri.so in the mesa tree)
  rendering is fine _but_ this is only due to falling back to software
  rendering. LIBGL_DEBUG=verbose shows

libGL error: dlopen lib/i915_dri.so failed (lib/i915_dri.so: undefined
symbol: intel_generate_mipmap)

This is with the latest libdrm-intel from debian. No compile time errors.

-Daniel
Comment 14 Jos van Wolput 2009-05-09 23:34:45 UTC
(In reply to comment #13)

You're right! I didn't notice the error (lib/i915_dri.so: undefined symbol: intel_generate_mipmap,falling back to software rendering ). Sorry!

Jos v.W.
Comment 15 Daniel Vetter 2009-05-10 10:53:00 UTC
Created attachment 25702 [details] [review]
fix link-time breakage of i915_dri.so in latest mesa -master

This fixes the issue (fallback to software renderer) I mentioned in comment #13. Please check & apply.

-Daniel
Comment 16 Jos van Wolput 2009-05-10 22:45:50 UTC
Created attachment 25714 [details] [review]
fix window wider than 512 pixels

fix window wider than 512 pixels issue of i915_dri.so in latest mesa-master and mesa_7_5_rc1
Comment 17 Daniel Vetter 2009-05-11 01:35:48 UTC
On Sun, May 10, 2009 at 10:45:51PM -0700, bugzilla-daemon@freedesktop.org wrote:
> --- Comment #16 from Jos van Wolput <wolput@onsneteindhoven.nl>  2009-05-10 22:45:50 PST ---
> Created an attachment (id=25714)
>  --> (http://bugs.freedesktop.org/attachment.cgi?id=25714)
> fix window wider than 512 pixels
> 
> fix window wider than 512 pixels issue of i915_dri.so in latest mesa-master and
> mesa_7_5_rc1
I've tested your patch (I've had to recreate it because it was
whitespace-mangled). It results in a run-time linker error (run with
LIBGL_DEBUG=verbose to see) and the resulting fallback to
software-rendering makes the viewport issue disappear.
Comment 18 Daniel Vetter 2009-05-11 02:00:33 UTC
Created attachment 25725 [details] [review]
debug patch: show driDrawable coords

While tinkering around a came up with this debug patch. When using glxgears it shows clearly that the driDrawable in the intel GLContext is not updated when resizing the window. Therefore the transformation matrix calculations right after my printf statement are bogus.

The resulting bogus matrix agrees with what I deduced from looking at the output of glxgears: Statically fixed bottom (when shrinking vertically the gears actually move downwards out of the window) and truncated at a fixed width.

Warning: this patch totally floods stderr.

Can someone with more knowledge of the innards of mesa/dri please look where the driDrawable is not updated, but should be? My grep-fu is no quite up to this task ... ;)

-Daniel
Comment 19 Eric Anholt 2009-05-26 19:51:47 UTC
Thanks for the bisects and the details -- led me pretty quickly to some problems that should have it fixed now.  One was that the kernel tiling code for 8xx was quite broken.  Patch in for-review and on the mailing list:

commit e76a16deb8785317a23cca7204331af053e0fb4e
Author: Eric Anholt <eric@anholt.net>
Date:   Tue May 26 17:44:56 2009 -0700

    drm/i915: Fix tiling pitch handling on 8xx.
    
    The pitch field is an exponent on pre-965, so we were rejecting buffers
    on 8xx that we shouldn't have.  915 got lucky in that the largest legal
    value happened to match (8KB / 512 = 0x10), but 8xx has a smaller tile width
    Additionally, we programmed that bad value into the register on 8xx, so the
    only pitch that would work correctly was 4096 (512-1023 pixels), while other
    would probably give bad rendering or hangs.

Another was that Viewport and DepthRange had been dropped on 8xx since the black-window commit you noted.  Pushed to Mesa master:

commit 0e83e8f51af07a3066519f169f07d9afbf23252e
Author: Eric Anholt <eric@anholt.net>
Date:   Tue May 26 19:48:08 2009 -0700

    i915: Restore the Viewport and DepthRange functions on 8xx.
    
    Fixes failed viewport updates on glxgears (and other apps) resize since
    e41780fedc2c1f22b43118da30a0103fa68b769f.
    
    Bug #20473.
Comment 20 aguertin+freedesktop 2009-05-27 16:55:56 UTC
I can verify this fixes glxgears on my 845. I also no longer get the line
(EE) intel(0): Failed to set tiling on front buffer: Invalid argument
in my Xorg.0.log.
Comment 21 Daniel Vetter 2009-05-28 04:51:53 UTC
I've also tested your patches and glxgears works again (855GM). But the gallium driver is still broken: It still suffers from the viewport-update-issue (tiling is fixed like with the normal dri driver). Should I open a new bug report to track this?

-Daniel
Comment 22 Eric Anholt 2009-05-29 10:47:00 UTC
We don't have anything to do with the gallium driver, so it would only be appropriate in a separate bug report so that someone that cares about Gallium could handle it.
Comment 23 RĂ©mi Cardona 2009-06-01 14:42:29 UTC
(In reply to comment #19)
> Another was that Viewport and DepthRange had been dropped on 8xx since the
> black-window commit you noted.  Pushed to Mesa master:
> 
> commit 0e83e8f51af07a3066519f169f07d9afbf23252e
> Author: Eric Anholt <eric@anholt.net>
> Date:   Tue May 26 19:48:08 2009 -0700
> 
>     i915: Restore the Viewport and DepthRange functions on 8xx.
> 
>     Fixes failed viewport updates on glxgears (and other apps) resize since
>     e41780fedc2c1f22b43118da30a0103fa68b769f.
> 
>     Bug #20473.

Hi Eric, could you nominate this patch for inclusion in mesa's 7.5 branch?

Thanks
Comment 24 Adam Jackson 2009-08-24 12:31:54 UTC
Mass version move, cvs -> git

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.