Bug 21064 - [855GM] garbled screen with intel 2.6.x driver (with tiling off)
Summary: [855GM] garbled screen with intel 2.6.x driver (with tiling off)
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: 7.4 (2008.09)
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: ykzhao
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-04-05 12:23 UTC by René Gabriëls
Modified: 2009-08-17 19:13 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Server log when using intel driver 2.5.1 with tiling option enabled (51.84 KB, text/plain)
2009-04-05 12:24 UTC, René Gabriëls
no flags Details
Server log when using intel driver 2.6.99 with the tiled option enabled (64.99 KB, text/plain)
2009-04-05 12:25 UTC, René Gabriëls
no flags Details
Screenshot of currupted screen (101.99 KB, image/jpeg)
2009-06-08 13:54 UTC, René Gabriëls
no flags Details
Only set the bit 5 of SR01 on G4x platform in course of disable VGA (960 bytes, patch)
2009-08-04 23:39 UTC, ykzhao
no flags Details | Splinter Review
Disable VGA_2X_MODE in VGACNTRL register (444 bytes, patch)
2009-08-05 02:29 UTC, René Gabriëls
no flags Details | Splinter Review
new patch to disable vga plane (1.74 KB, patch)
2009-08-09 19:16 UTC, Wang Zhenyu
no flags Details | Splinter Review

Description René Gabriëls 2009-04-05 12:23:12 UTC
When using Intel driver version 2.6.{1,2,3} or any newer driver from git results in a garbled screen.  It looks like the upper left and upper right quadrants of the screen are stretched to full-screen size and then alpha-blended onto each other. Really funky! When I make a screenshot, the output is fine though.

I had to set the option "Tiling" to "false" in order to get the X server to start (otherwise I would get an error from the intel driver that it couldn't allocate some buffer).

Driver 2.5.1 doesn't have this problem and works fine regardless of how the tiling option is set.

I tried kernels: 2.6.28 and 2.6.29 (no KMS): same results
I tried xorg-server: 1.5 and 1.6: same results

I also tried KMS but this doesn't work at all, same symptoms as http://bugs.freedesktop.org/show_bug.cgi?id=20115

I have attached the output of the X server with "ModeDebug" option enabled.
Comment 1 René Gabriëls 2009-04-05 12:24:44 UTC
Created attachment 24585 [details]
Server log when using intel driver 2.5.1 with tiling option enabled
Comment 2 René Gabriëls 2009-04-05 12:25:35 UTC
Created attachment 24586 [details]
Server log when using intel driver 2.6.99 with the tiled option enabled
Comment 3 Gordon Jin 2009-04-06 04:03:48 UTC
The problem you met with tiling enabled is likely bug#18974?
Comment 4 René Gabriëls 2009-04-06 11:12:47 UTC
(In reply to comment #3)
> The problem you met with tiling enabled is likely bug#18974?
 
Yes. Although for me the problem showed up only at 2.6.x, while 2.5.1 is working OK (using that one right now).
Comment 5 René Gabriëls 2009-06-08 13:47:07 UTC
I managed to do a succefull git bisect of 2.6.0 (bad) and 2.5.0 (good), fixing compile errors of intermediate versions whenever they arrived. Anyway, the patch that screwed my display turned out to be: 	

commit db9f5915ce812144ffd9d2aa42e8ba856129c35e
Author: Ma Ling <ling.ma@intel.com>
Date:   Wed Jan 14 14:46:52 2009 +0800

    Disable VGA plane reliably
    
    This fixes #17235, VGA random hang on recent G45/43 board.
    From spec, SR01 bit 5 should be set before VGA plane disable through
    control register, otherwise we might get random crash and lockups.

URL: http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/commit/?id=db9f5915ce812144ffd9d2aa42e8ba856129c35e

I then reversed this patch for version 2.6.0 of the driver, after which my display was fine! I haven't tried with current head yet, because it requires xorg-server 1.6.0 while I'm currently using 1.5.3, but I guess the results would be the same.
Comment 6 René Gabriëls 2009-06-08 13:54:33 UTC
Created attachment 26564 [details]
Screenshot of currupted screen

In the attached screenshot, the upper left and upper right quadrants of the screen are somehow scan line interleaved into a full screen picture.
Comment 7 René Gabriëls 2009-06-09 13:20:50 UTC
Today I dug a little deeper into the problem. It seems that bit 31 in the VGACNTRL register is (for some reason) enabled by default on my machine.  This bit controls VGA_2X_MODE. I have no clue what this is supposed to do, but if I set this bit to 0, everything is OK.

The patch above that introduced this bug did this because the old code simply cleared the whole VGACNTRL register and set the msb to 1, while the new code only sets the msb to 1, keeping the other bits intact.  The following patch fixes this problem by forcing this bit to 0, whenever 'i830_disable_vga_plane' is called:

diff --git a/src/i830_display.c b/src/i830_display.c
index 8ecb5e5..ac32ac4 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -807,6 +807,7 @@ i830_disable_vga_plane (xf86CrtcPtr crtc)
     usleep(30);
 
     vgacntrl |= VGA_DISP_DISABLE;
+    vgacntrl &= 0xbfffffff;
 
     OUTREG(VGACNTRL, vgacntrl);
     i830WaitForVblank(pScrn);


I'm not sure if this is the right place to fix this problem, but hey, it works!
Comment 8 Arthur Spitzer 2009-06-19 09:12:00 UTC
Hi,

I think I'm having exactly the same issues, when using UXA acceleration, without KMS. Using KMS is not possible, since it produces just a black screen (bug#20115
). 
The UXA issue is present for kernel versions 2.6.29 and 2.6.30.
And a gentoo system configuration:
- xorg-server-1.5.3-r6 and xorg-server-1.6.1.901-r3
- xf86-video-intel-2.7.1
- mesa-7.4.2
- libdrm-2.4.11
- libpciaccess-0.10.6


The above line fixed the issue for me, using kernel 2.6.30 and xorg-server-1.6.1.901-r3. I haven't tested the other three configurations.
Comment 9 Michael Fu 2009-08-04 01:41:54 UTC
db9f5915ce812144ffd9d2aa42e8ba856129c35e has an updated version...
Comment 10 René Gabriëls 2009-08-04 03:25:27 UTC
(In reply to comment #9)
> db9f5915ce812144ffd9d2aa42e8ba856129c35e has an updated version...
 
That's the patch that introduced the problem! The thing is that this patch exposes a problem that the old code was hiding. There's nothing wrong with the patch itself I think.

The real question is: what it VGA_2X_MODE (defined in src/i810_reg.h) and why is it enabled on my machine by default? Is this the BIOS's fault?
Comment 11 ykzhao 2009-08-04 23:39:56 UTC
Created attachment 28361 [details] [review]
Only set the bit 5 of SR01 on G4x platform in course of disable VGA

Will you please try the debug patch on the latest driver and see whether the issue still exists?
Thanks.
Comment 12 René Gabriëls 2009-08-05 01:58:28 UTC
(In reply to comment #11)
> Created an attachment (id=28361) [details]
> Only set the bit 5 of SR01 on G4x platform in course of disable VGA
> 
> Will you please try the debug patch on the latest driver and see whether the
> issue still exists?
> Thanks.
> 

The problem is still there. I don't know the behavior of the hardware, but it seems a bit strange to try to write to another register (SR01) to fix something that is in another one (VGACNTRL).(In reply to comment #11)
Comment 13 René Gabriëls 2009-08-05 02:29:53 UTC
Created attachment 28363 [details] [review]
Disable VGA_2X_MODE in VGACNTRL register

This patch fixes the problem for me in a slightly less ad-hoc manner than my previous patch.
Comment 14 ykzhao 2009-08-06 07:24:10 UTC
(In reply to comment #13)
> Created an attachment (id=28363) [details]
> Disable VGA_2X_MODE in VGACNTRL register
> This patch fixes the problem for me in a slightly less ad-hoc manner than my
> previous patch.
Good job.
Will you please send the patch to intel-gfx mailing list?
Thanks.

Comment 15 René Gabriëls 2009-08-06 07:33:05 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > Created an attachment (id=28363) [details] [details]
> > Disable VGA_2X_MODE in VGACNTRL register
> > This patch fixes the problem for me in a slightly less ad-hoc manner than my
> > previous patch.
> Good job.
> Will you please send the patch to intel-gfx mailing list?
> Thanks.
> 

OK I'll send it to the mailoing list. I'm still not sure about this 2X mode: people with an 855GM who need this mode are screwed when using this patch. On the other hand, nobody complained about the old code (before the bug was introduced), so I guess it's safe.
Comment 16 Wang Zhenyu 2009-08-09 19:16:32 UTC
Created attachment 28464 [details] [review]
new patch to disable vga plane 

As Rene has sent to mail list, and he tested my suggested patch on ML too. This is just a copy here to note the status. Thanks.
Comment 17 Wang Zhenyu 2009-08-17 19:13:49 UTC
Pushed the patch. Close.
commit 376397c21eb9a7e4ea79d349af41da81c1af861f
Author: Zhenyu Wang <zhenyuw@linux.intel.com>
Date:   Tue Aug 18 10:01:12 2009 +0800

    Fix VGA plane disabling
    
    Only apply on G4X with SR01 bit5 workaround for VGA plane disable, and
    restore behavior back for other chips to make sure other modes got disabled
    too.
    
    For bug #17235, #19715, #21064, #23178
    
    Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>


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.