Mac Mini and Xorg

Sean Welch Sean_Welch at alum.wofford.org
Wed Jul 6 15:31:35 GMT 2005


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

-------------- next part --------------
*** 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


More information about the freebsd-ppc mailing list