Subject: pkg/36842: Annoying lines on iBook G4 with xorg
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Magnus Henoch <mange@freemail.hu>
List: pkgsrc-bugs
Date: 08/26/2007 10:00:01
>Number:         36842
>Category:       pkg
>Synopsis:       Annoying lines on iBook G4 with xorg
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 26 10:00:00 +0000 2007
>Originator:     Magnus Henoch
>Release:        NetBSD 4.99.28
>Organization:
	
>Environment:
	
	
System: NetBSD zemdatav 4.99.28 NetBSD 4.99.28 (IBOOK) #2: Fri Aug 17 09:58:34 CEST 2007 magnus@zemdatav:/media/e/netbsd/obj/sys/arch/macppc/compile/IBOOK macppc
Architecture: powerpc
Machine: macppc
>Description:
	With modular-xorg-server (specifically xf86-video-ati) on an
	iBook G4, the screen has horizontal lines going down, with
	pixels apparently mirroring what is a bit to the right.
>How-To-Repeat:
	
>Fix:
	NetBSD's XFree86 tree has a fix for this, which consists of
	the option "iBookHacks" for the radeon driver.  See
	xsrc/xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
	The following patch is a minimal adaptation for the xorg driver.

--- src/radeon.h~	Tue Oct  3 16:49:13 2006
+++ src/radeon.h	Sun Aug 26 10:09:21 2007
@@ -144,6 +144,9 @@
     OPTION_REVERSE_DDC,
     OPTION_LVDS_PROBE_PLL,
     OPTION_ACCELMETHOD,
+#ifdef __powerpc__
+    OPTION_IBOOKHACKS,
+#endif
     OPTION_CONSTANTDPI
 } RADEONOpts;
 


--- src/radeon_driver.c.orig	2007-08-26 10:10:48.000000000 +0200
+++ src/radeon_driver.c
@@ -211,6 +211,9 @@ static const OptionInfoRec RADEONOptions
     { OPTION_LVDS_PROBE_PLL, "LVDSProbePLL",     OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_ACCELMETHOD,    "AccelMethod",      OPTV_STRING,  {0}, FALSE },
     { OPTION_CONSTANTDPI,    "ConstantDPI",	 OPTV_BOOLEAN,	{0}, FALSE },
+#ifdef __powerpc__
+    { OPTION_IBOOKHACKS,     "iBookHacks",       OPTV_BOOLEAN, {0}, FALSE },
+#endif
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
@@ -6688,7 +6691,23 @@ static void RADEONRestorePLLRegisters(Sc
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
 
+    /* 
+     * Never do it on Apple iBook to avoid a blank screen.
+     */
+#ifdef __powerpc__
+    if (xf86ReturnOptValBool(info->Options, OPTION_IBOOKHACKS, FALSE))
+        return;
+#endif
+
     if (info->IsMobility) {
+    /* 
+     * Never do it on Apple iBook to avoid a blank screen.
+     */
+#ifdef __powerpc__
+    if (xf86ReturnOptValBool(info->Options, OPTION_IBOOKHACKS, FALSE))
+        return;
+#endif
+
         /* A temporal workaround for the occational blanking on certain laptop panels.
            This appears to related to the PLL divider registers (fail to lock?).
 	   It occurs even when all dividers are the same with their old settings.
@@ -8533,7 +8552,16 @@ static void RADEONInitPLLRegisters(ScrnI
 	       save->post_div));
 
     save->ppll_ref_div   = pll->reference_div;
-    save->ppll_div_3     = (save->feedback_div | (post_div->bitvalue << 16));
+
+    /* 
+     * on iBooks the LCD pannel needs tweaked PLL timings 
+     */
+#ifdef __powerpc__
+    if (xf86ReturnOptValBool(info->Options, OPTION_IBOOKHACKS, FALSE))
+        save->ppll_div_3 = 0x000600ad;
+    else
+#endif
+      save->ppll_div_3   = (save->feedback_div | (post_div->bitvalue << 16));
     save->htotal_cntl    = 0;
 }
 

>Unformatted: