From patchwork Fri Aug 7 10:08:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhenyu Wang X-Patchwork-Id: 39853 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n77A8rDH000741 for ; Fri, 7 Aug 2009 10:08:53 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0472EA0879; Fri, 7 Aug 2009 03:08:53 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EE0E9E76D for ; Fri, 7 Aug 2009 03:08:51 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 07 Aug 2009 02:55:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,341,1246863600"; d="asc'?scan'208";a="437005118" Received: from zhen-devel.sh.intel.com (HELO zhen-devel) ([10.239.13.48]) by orsmga002.jf.intel.com with ESMTP; 07 Aug 2009 03:15:27 -0700 Date: Fri, 7 Aug 2009 18:08:49 +0800 From: Zhenyu Wang To: =?iso-8859-1?Q?Ren=E9_Gabri=EBls?= Message-ID: <20090807100849.GC882@zhen-devel.sh.intel.com> Mail-Followup-To: =?iso-8859-1?Q?Ren=E9_Gabri=EBls?= , intel-gfx@lists.freedesktop.org References: <4A7AF2E7.2030409@gmail.com> MIME-Version: 1.0 In-Reply-To: <4A7AF2E7.2030409@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] Patch to fix fdo bug #21064 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: Zhenyu Wang List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org On 2009.08.06 17:12:39 +0200, René Gabriëls wrote: > The attached patch fixes my garbled screen issue on my Intel 855GM notebook. For > some reason the VGA_2X_MODE bit in the VGACNTRL register is set to 1 on my > machine, causing the video chip to scale up the framebuffer, which results in a > funky screen. > > In the patch I forced this bit to zero and the problem is gone. I'm not sure if > there's anybody who's actually using this 2X_MODE on an 855GM. However, before > this bug was introduced (git: db9f5915ce812144ffd9d2aa42e8ba856129c35e), this > bit was forced to zero as well. > > - René > diff --git a/src/i830_display.c b/src/i830_display.c > index 59ededc..d180b2b 100644 > --- a/src/i830_display.c > +++ b/src/i830_display.c > @@ -1096,6 +1096,10 @@ i830_disable_vga_plane (xf86CrtcPtr crtc) > > vgacntrl |= VGA_DISP_DISABLE; > > + /* disable "VGA/Pop-up 2X Centered Mode Scaling" on 855GM platform */ > + if (IS_I855(pI830)) > + vgacntrl &= ~VGA_2X_MODE; > + > OUTREG(VGACNTRL, vgacntrl); > i830WaitForVblank(pScrn); > Looks we brought more problem with VGA mode disable than it has fixed... and sr bit setting should only apply to affected chip, which is a G43 as we originally saw this. So how about following patch? Does it work for you? I would try to test this on origin problematic G43 when I had hands no it, and current kms patch for this on drm-intel-next needs rework too, and I'll test if sr bit affects on new chip or not. diff --git a/src/i830_display.c b/src/i830_display.c index 59ededc..b749252 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -1076,27 +1076,20 @@ i830_disable_vga_plane (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); - uint32_t vgacntrl = INREG(VGACNTRL); uint8_t sr01; - if (vgacntrl & VGA_DISP_DISABLE) - return; - /* Set bit 5 of SR01; Wait 30us; */ - OUTREG8(SRX, 1); - sr01 = INREG8(SRX + 1); - OUTREG8(SRX + 1, sr01 | (1 << 5)); - usleep(30); - /* disable center mode on 965GM and G4X platform */ - if (IS_I965GM(pI830) || IS_G4X(pI830)) - vgacntrl &= ~(3 << 24); - - vgacntrl |= VGA_DISP_DISABLE; + if (IS_G4X(pI830)) { + OUTREG8(SRX, 1); + sr01 = INREG8(SRX + 1); + OUTREG8(SRX + 1, sr01 | (1 << 5)); + usleep(30); + } - OUTREG(VGACNTRL, vgacntrl); + OUTREG(VGACNTRL, VGA_DISP_DISABLE); i830WaitForVblank(pScrn); }