From owner-freebsd-ppc@FreeBSD.ORG Wed Jul 6 15:31:35 2005 Return-Path: X-Original-To: freebsd-ppc@freebsd.org Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5BB1416A420 for ; Wed, 6 Jul 2005 15:31:35 +0000 (GMT) (envelope-from seanmwelch@yahoo.com) Received: from smtp103.mail.sc5.yahoo.com (smtp103.mail.sc5.yahoo.com [66.163.169.222]) by mx1.FreeBSD.org (Postfix) with SMTP id 4455543D49 for ; Wed, 6 Jul 2005 15:31:33 +0000 (GMT) (envelope-from seanmwelch@yahoo.com) Received: (qmail 62223 invoked from network); 6 Jul 2005 15:31:33 -0000 Received: from unknown (HELO NitroPhys.welchsmnet.net) (seanmwelch@66.41.102.215 with plain) by smtp103.mail.sc5.yahoo.com with SMTP; 6 Jul 2005 15:31:32 -0000 Received: from NitroPhys.welchsmnet.net (localhost [127.0.0.1]) by NitroPhys.welchsmnet.net (8.13.1/8.12.10) with ESMTP id j66FU6Ks022661; Wed, 6 Jul 2005 10:30:07 -0500 (CDT) (envelope-from seanmwelch@yahoo.com) Received: (from welchsm@localhost) by NitroPhys.welchsmnet.net (8.13.1/8.13.1/Submit) id j66FU6Xv022660; Wed, 6 Jul 2005 10:30:06 -0500 (CDT) (envelope-from seanmwelch@yahoo.com) Date: Wed, 6 Jul 2005 10:30:05 -0500 From: Sean Welch To: Peter Grehan Message-ID: <20050706153005.GA22632@NitroPhys.welchsmnet.net> References: <20050705163155.GA18493@NitroPhys.welchsmnet.net> <42CB0C67.7030705@freebsd.org> <20050706011247.GA20055@NitroPhys.welchsmnet.net> <42CB3243.2010804@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline In-Reply-To: <42CB3243.2010804@freebsd.org> User-Agent: Mutt/1.5.9i Cc: freebsd-ppc@freebsd.org Subject: Re: Mac Mini and Xorg X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Sean_Welch@alum.wofford.org List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2005 15:31:35 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jul 06, 2005 at 11:22:11AM +1000, Peter Grehan wrote: > >Of course if you want to > >throw together a new snapshot I'd be more than willing to test it > >out for you. ;-) > > Let's do both :) I got the kernel and modules built (pulled in the sound patches as well as the rs6000.c and sysv4.h patches) but I've not tried them yet because I did it remotely. I'll give it a shot when I get home this afternoon. > I think the main changes were #ifdef'd ppc, so if you have success > I'll file a PR. I have to say, the freebsd-x11 guys were *GREAT* in > getting my PR's pulled into the xorg port so quickly. I did a diff -c with the unpatched version of radeon_driver.c and came up with parts that seem to be just out of date in addition to the ifdef'd sections. A few seem to deal with pll stuff (which I think I saw in an OpenBSD forum somewhere was related to this issue?) so I'm not sure exactly what is just updated and what should actually be changed. I've inlined the diff below -- please take a look and let me know which sections are necessary so I can make changes accordingly. (I've also attached it so you can just edit that if you prefer.) Thanks! Sean *** radeon_driver.c Wed Jul 6 10:03:53 2005 --- /usr/radeon_driver.c Thu May 26 04:06:06 2005 *************** *** 164,170 **** OPTION_SUBPIXEL_ORDER, #endif OPTION_SHOWCACHE, ! OPTION_DYNAMIC_CLOCKS } RADEONOpts; static const OptionInfoRec RADEONOptions[] = { --- 164,173 ---- OPTION_SUBPIXEL_ORDER, #endif OPTION_SHOWCACHE, ! OPTION_DYNAMIC_CLOCKS, ! #ifdef __powerpc__ ! OPTION_IBOOKHACKS ! #endif } RADEONOpts; static const OptionInfoRec RADEONOptions[] = { *************** *** 209,214 **** --- 212,220 ---- #endif { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DYNAMIC_CLOCKS, "DynamicClocks", OPTV_BOOLEAN, {0}, FALSE }, + #ifdef __powerpc__ + { OPTION_IBOOKHACKS, "iBookHacks", OPTV_BOOLEAN, {0}, FALSE }, + #endif { -1, NULL, OPTV_NONE, {0}, FALSE } }; *************** *** 5276,5281 **** --- 5282,5295 ---- 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) { /* A temporal workaround for the occational blanking on certain laptop panels. This appears to related to the PLL divider registers (fail to lock?). *************** *** 5748,5754 **** */ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ #else ! vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS); /* Save mode * & fonts & cmap */ #endif --- 5762,5768 ---- */ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ #else ! vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* Save mode * & fonts & cmap */ #endif *************** *** 5818,5824 **** */ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); #else ! vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); #endif vgaHWLock(hwp); } else { --- 5832,5838 ---- */ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); #else ! vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_ALL ); #endif vgaHWLock(hwp); } else { *************** *** 6727,6736 **** } /* Define PLL registers for requested video mode */ ! static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONPLLPtr pll, double dot_clock) { unsigned long freq = dot_clock * 100; struct { int divider; --- 6741,6751 ---- } /* Define PLL registers for requested video mode */ ! static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONInfoPtr info, double dot_clock) { unsigned long freq = dot_clock * 100; + RADEONPLLPtr pll = &info->pll; struct { int divider; *************** *** 6780,6786 **** save->post_div)); save->ppll_ref_div = pll->reference_div; ! save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16)); save->htotal_cntl = 0; } --- 6795,6811 ---- save->post_div)); save->ppll_ref_div = pll->reference_div; ! ! /* ! * 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; } *************** *** 6921,6927 **** return FALSE; dot_clock = (((RADEONMergedDisplayModePtr)mode->Private)->CRT1)->Clock / 1000.0; if (dot_clock) { ! RADEONInitPLLRegisters(save, &info->pll, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; --- 6946,6952 ---- return FALSE; dot_clock = (((RADEONMergedDisplayModePtr)mode->Private)->CRT1)->Clock / 1000.0; if (dot_clock) { ! RADEONInitPLLRegisters(save, info, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; *************** *** 6942,6948 **** save->htotal_cntl = 0; } else ! RADEONInitPLLRegisters(save, &info->pll, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; --- 6967,6973 ---- save->htotal_cntl = 0; } else ! RADEONInitPLLRegisters(save, info, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; *************** *** 7159,7165 **** RADEONDoAdjustFrame(pScrn, x, y, FALSE); } ! RADEONSetFBLocation (pScrn); #ifdef XF86DRI if (info->CPStarted) DRIUnlock(pScrn->pScreen); #endif --- 7184,7190 ---- RADEONDoAdjustFrame(pScrn, x, y, FALSE); } ! /* RADEONSetFBLocation (pScrn); */ #ifdef XF86DRI if (info->CPStarted) DRIUnlock(pScrn->pScreen); #endif --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="radeon.diff" *** radeon_driver.c Wed Jul 6 10:03:53 2005 --- /usr/radeon_driver.c Thu May 26 04:06:06 2005 *************** *** 164,170 **** OPTION_SUBPIXEL_ORDER, #endif OPTION_SHOWCACHE, ! OPTION_DYNAMIC_CLOCKS } RADEONOpts; static const OptionInfoRec RADEONOptions[] = { --- 164,173 ---- OPTION_SUBPIXEL_ORDER, #endif OPTION_SHOWCACHE, ! OPTION_DYNAMIC_CLOCKS, ! #ifdef __powerpc__ ! OPTION_IBOOKHACKS ! #endif } RADEONOpts; static const OptionInfoRec RADEONOptions[] = { *************** *** 209,214 **** --- 212,220 ---- #endif { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DYNAMIC_CLOCKS, "DynamicClocks", OPTV_BOOLEAN, {0}, FALSE }, + #ifdef __powerpc__ + { OPTION_IBOOKHACKS, "iBookHacks", OPTV_BOOLEAN, {0}, FALSE }, + #endif { -1, NULL, OPTV_NONE, {0}, FALSE } }; *************** *** 5276,5281 **** --- 5282,5295 ---- 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) { /* A temporal workaround for the occational blanking on certain laptop panels. This appears to related to the PLL divider registers (fail to lock?). *************** *** 5748,5754 **** */ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ #else ! vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS); /* Save mode * & fonts & cmap */ #endif --- 5762,5768 ---- */ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ #else ! vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* Save mode * & fonts & cmap */ #endif *************** *** 5818,5824 **** */ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); #else ! vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); #endif vgaHWLock(hwp); } else { --- 5832,5838 ---- */ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); #else ! vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_ALL ); #endif vgaHWLock(hwp); } else { *************** *** 6727,6736 **** } /* Define PLL registers for requested video mode */ ! static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONPLLPtr pll, double dot_clock) { unsigned long freq = dot_clock * 100; struct { int divider; --- 6741,6751 ---- } /* Define PLL registers for requested video mode */ ! static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONInfoPtr info, double dot_clock) { unsigned long freq = dot_clock * 100; + RADEONPLLPtr pll = &info->pll; struct { int divider; *************** *** 6780,6786 **** save->post_div)); save->ppll_ref_div = pll->reference_div; ! save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16)); save->htotal_cntl = 0; } --- 6795,6811 ---- save->post_div)); save->ppll_ref_div = pll->reference_div; ! ! /* ! * 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; } *************** *** 6921,6927 **** return FALSE; dot_clock = (((RADEONMergedDisplayModePtr)mode->Private)->CRT1)->Clock / 1000.0; if (dot_clock) { ! RADEONInitPLLRegisters(save, &info->pll, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; --- 6946,6952 ---- return FALSE; dot_clock = (((RADEONMergedDisplayModePtr)mode->Private)->CRT1)->Clock / 1000.0; if (dot_clock) { ! RADEONInitPLLRegisters(save, info, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; *************** *** 6942,6948 **** save->htotal_cntl = 0; } else ! RADEONInitPLLRegisters(save, &info->pll, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; --- 6967,6973 ---- save->htotal_cntl = 0; } else ! RADEONInitPLLRegisters(save, info, dot_clock); } else { save->ppll_ref_div = info->SavedReg.ppll_ref_div; save->ppll_div_3 = info->SavedReg.ppll_div_3; *************** *** 7159,7165 **** RADEONDoAdjustFrame(pScrn, x, y, FALSE); } ! RADEONSetFBLocation (pScrn); #ifdef XF86DRI if (info->CPStarted) DRIUnlock(pScrn->pScreen); #endif --- 7184,7190 ---- RADEONDoAdjustFrame(pScrn, x, y, FALSE); } ! /* RADEONSetFBLocation (pScrn); */ #ifdef XF86DRI if (info->CPStarted) DRIUnlock(pScrn->pScreen); #endif --9jxsPFA5p3P2qPhR--