xf86-video-ati: Branch 'randr-1.2' - 6 commits

Alex Deucher agd5f at kemper.freedesktop.org
Sun May 13 11:25:16 PDT 2007


 src/radeon.h         |   11 
 src/radeon_bios.c    |  127 +++++-----
 src/radeon_display.c |  603 +++++++++++++++++----------------------------------
 src/radeon_driver.c  |  285 ++++++++++++++++++------
 src/radeon_modes.c   |   54 ++--
 src/radeon_probe.h   |   12 -
 6 files changed, 525 insertions(+), 567 deletions(-)

New commits:
diff-tree 66e8e6c8348d007930730e90295588efe8108844 (from 1c16c2ce9c5b02b03d23da965127d82eea4c4039)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 14:25:03 2007 -0400

    RADEON: several fixes
    
    - give better DDC names
    - disable DAC if connector is DVI-D
    - fix indentation in ProbeDDCModes()

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 779e8ab..cafcb0e 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -2473,7 +2473,7 @@ void RADEONInitConnector(xf86OutputPtr o
     ScrnInfoPtr	    pScrn = output->scrn;
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
     int DDCReg = 0;
-    char* name = "DDC Bus";//OutputType[radeon_output->type];
+    char* name = OutputType[radeon_output->type];
 
     switch(radeon_output->DDCType) {
     case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break;
@@ -2732,10 +2732,15 @@ Bool RADEONSetupConnectors(ScrnInfoPtr p
 	    return FALSE;
 	}
 	radeon_output->MonType = MT_UNKNOWN;
+	radeon_output->ConnectorType = info->BiosConnector[i].ConnectorType;
+	if ((info->IsAtomBios && radeon_output->ConnectorType == CONNECTOR_DVI_D_ATOM) ||
+	    radeon_output->ConnectorType == CONNECTOR_DVI_D)
+	    radeon_output->DACType = DAC_UNKNOWN;
+	else
+	    radeon_output->DACType = info->BiosConnector[i].DACType;
 	radeon_output->DDCType = info->BiosConnector[i].DDCType;
-	radeon_output->DACType = info->BiosConnector[i].DACType;
 	radeon_output->TMDSType = info->BiosConnector[i].TMDSType;
-	radeon_output->ConnectorType = info->BiosConnector[i].ConnectorType;
+
 	RADEONSetOutputType(pScrn, radeon_output);
 	output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]);
 	if (!output) {
diff --git a/src/radeon_modes.c b/src/radeon_modes.c
index 4555856..bc069ea 100644
--- a/src/radeon_modes.c
+++ b/src/radeon_modes.c
@@ -284,45 +284,43 @@ RADEONProbeOutputModes(xf86OutputPtr out
 
 
     if (radeon_output->type == OUTPUT_DVI || radeon_output->type == OUTPUT_VGA) {
-      edid_mon = xf86OutputGetEDID (output, radeon_output->pI2CBus);
-      xf86OutputSetEDID (output, edid_mon);
+	edid_mon = xf86OutputGetEDID (output, radeon_output->pI2CBus);
+	xf86OutputSetEDID (output, edid_mon);
       
-      modes = xf86OutputGetEDIDModes (output);
-      return modes;
+	modes = xf86OutputGetEDIDModes (output);
+	return modes;
     }
     if (radeon_output->type == OUTPUT_LVDS) {
-      /* okay we got DDC info */
-      if (output->MonInfo) {
-	/* Debug info for now, at least */
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %d\n", radeon_output->num);
-	xf86PrintEDID(output->MonInfo);
+	/* okay we got DDC info */
+	if (output->MonInfo) {
+	    /* Debug info for now, at least */
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %d\n", radeon_output->num);
+	    xf86PrintEDID(output->MonInfo);
 	
-	modes = xf86DDCGetModes(pScrn->scrnIndex, output->MonInfo);
+	    modes = xf86DDCGetModes(pScrn->scrnIndex, output->MonInfo);
 	
-	for (mode = modes; mode != NULL; mode = mode->next) {
-	  if (mode->Flags & V_DBLSCAN) {
-	    if ((mode->CrtcHDisplay >= 1024) || (mode->CrtcVDisplay >= 768))
-	    mode->status = MODE_CLOCK_RANGE;
-	  }
-	}
-	xf86PruneInvalidModes(pScrn, &modes, TRUE);
+	    for (mode = modes; mode != NULL; mode = mode->next) {
+		if (mode->Flags & V_DBLSCAN) {
+		    if ((mode->CrtcHDisplay >= 1024) || (mode->CrtcVDisplay >= 768))
+			mode->status = MODE_CLOCK_RANGE;
+		}
+	    }
+	    xf86PruneInvalidModes(pScrn, &modes, TRUE);
 	
-	/* do some physcial size stuff */
-      }
-      
+	    /* do some physcial size stuff */
+	}
       
-      if (modes == NULL) {
-	MonRec fixed_mon;
-
-	RADEONValidateFPModes(output, pScrn->display->modes, &modes);
-      }
+	if (modes == NULL) {
+	    RADEONValidateFPModes(output, pScrn->display->modes, &modes);
+	}
     }
     
     if (modes) {
-      xf86ValidateModesUserConfig(pScrn, modes);
-      xf86PruneInvalidModes(pScrn, &modes,
-				  FALSE);
+	xf86ValidateModesUserConfig(pScrn, modes);
+	xf86PruneInvalidModes(pScrn, &modes,
+			      FALSE);
     }
+
     return modes;
 }
 
diff-tree 1c16c2ce9c5b02b03d23da965127d82eea4c4039 (from 7c66e903368f77ecc4d3bd1c9f08d2adbd85e83c)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 13:54:04 2007 -0400

    RADEON: fix VT switch

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 8e8f7a2..0616b32 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -4643,7 +4643,7 @@ RADEONEnableOutputs(ScrnInfoPtr pScrn, i
     RADEONInfoPtr      info = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    xf86CrtcPtr crtc = pRADEONEnt->pCrtc[0];
+    xf86CrtcPtr crtc = pRADEONEnt->pCrtc[crtc_num];
     int i;
 
     /* get the output connected to this CRTC */
@@ -4702,7 +4702,7 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
 	    RADEONRestorePLL2Registers(pScrn, restore);
 	    RADEONRestoreFPRegisters(pScrn, restore);
 	    RADEONRestoreDACRegisters(pScrn, restore);
-	    RADEONEnableOutputs(pScrn, 2);
+	    RADEONEnableOutputs(pScrn, 1);
 	} else {
 	    RADEONRestoreMemMapRegisters(pScrn, restore);
 	    RADEONRestoreCommonRegisters(pScrn, restore);
@@ -4715,9 +4715,9 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
             RADEONRestorePLLRegisters(pScrn, restore);
 	    RADEONRestoreFPRegisters(pScrn, restore);
 	    RADEONRestoreDACRegisters(pScrn, restore);
-	    RADEONEnableOutputs(pScrn, 1);
+	    RADEONEnableOutputs(pScrn, 0);
 	    if (pCRTC2->binding == 1) {
-	      RADEONEnableOutputs(pScrn, 2);
+	      RADEONEnableOutputs(pScrn, 1);
 	    }
 	}
     } else {
@@ -4734,11 +4734,11 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
 	RADEONRestoreDACRegisters(pScrn, restore);
 	ErrorF("finished FP restore\n");
 
-	RADEONEnableOutputs(pScrn, 1);
+	RADEONEnableOutputs(pScrn, 0);
 	ErrorF("enable output1 done\n");
 
 	if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
-	    RADEONEnableOutputs(pScrn, 2);
+	    RADEONEnableOutputs(pScrn, 1);
 	    ErrorF("enable output2 done\n");
 	}
     }
diff-tree 7c66e903368f77ecc4d3bd1c9f08d2adbd85e83c (from aec078eb0740651fba8ec602e8239bd679efc8ad)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 13:37:59 2007 -0400

    RADEON: move crtc offset handling into init/save/restore functions

diff --git a/src/radeon.h b/src/radeon.h
index 8c3b700..762376a 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -240,6 +240,7 @@ typedef struct {
     CARD32            disp_merge_cntl;
     CARD32            grph_buffer_cntl;
     CARD32            crtc_more_cntl;
+    CARD32            crtc_tile_x0_y0;
 
 				/* CRTC2 registers */
     CARD32            crtc2_gen_cntl;
@@ -257,6 +258,8 @@ typedef struct {
     CARD32            crtc2_offset;
     CARD32            crtc2_offset_cntl;
     CARD32            crtc2_pitch;
+    CARD32            crtc2_tile_x0_y0;
+
 				/* Flat panel registers */
     CARD32            fp_crtc_h_total_disp;
     CARD32            fp_crtc_v_total_disp;
@@ -784,7 +787,7 @@ extern void        RADEONWaitForIdleCP(S
 #endif
 
 extern void        RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y,
-				       int clone);
+				       Bool clone);
 
 extern void        RADEONEngineReset(ScrnInfoPtr pScrn);
 extern void        RADEONEngineFlush(ScrnInfoPtr pScrn);
diff --git a/src/radeon_display.c b/src/radeon_display.c
index f64b6f6..779e8ab 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -2042,7 +2042,6 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
 
 	if (output->crtc == crtc) {
 	    montype = radeon_output->MonType;
-	    radeon_output->crtc_num = radeon_crtc->crtc_id + 1;
 	}
     }
     
@@ -2054,7 +2053,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
     switch (radeon_crtc->crtc_id) {
     case 0:
 	ErrorF("init crtc1\n");
-	RADEONInitCrtcRegisters(crtc, &info->ModeReg, adjusted_mode, info);
+	RADEONInitCrtcRegisters(crtc, &info->ModeReg, adjusted_mode, x, y);
         dot_clock = adjusted_mode->Clock / 1000.0;
         if (dot_clock) {
 	    ErrorF("init pll1\n");
@@ -2067,7 +2066,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
 	break;
     case 1:
 	ErrorF("init crtc2\n");
-        RADEONInitCrtc2Registers(crtc, &info->ModeReg, adjusted_mode, info);
+        RADEONInitCrtc2Registers(crtc, &info->ModeReg, adjusted_mode, x, y);
         dot_clock = adjusted_mode->Clock / 1000.0;
         if (dot_clock) {
 	    ErrorF("init pll2\n");
@@ -2083,16 +2082,12 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
 
     switch (radeon_crtc->crtc_id) {
     case 0:
-	ErrorF("adjustframe 1\n");
-	RADEONDoAdjustFrame(pScrn, x, y, FALSE);
 	ErrorF("restore crtc1\n");
 	RADEONRestoreCrtcRegisters(pScrn, &info->ModeReg);
 	ErrorF("restore pll1\n");
 	RADEONRestorePLLRegisters(pScrn, &info->ModeReg);
 	break;
     case 1:
-	ErrorF("adjustframe 2\n");
-	RADEONDoAdjustFrame(pScrn, x, y, TRUE);
 	ErrorF("restore crtc2\n");
 	RADEONRestoreCrtc2Registers(pScrn, &info->ModeReg);
 	ErrorF("restore pll2\n");
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index edc59bb..8e8f7a2 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -4147,8 +4147,11 @@ void RADEONRestoreCrtcRegisters(ScrnInfo
     OUTREG(RADEON_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
     OUTREG(RADEON_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp);
 
-    OUTREG(RADEON_CRTC_OFFSET,          restore->crtc_offset);
+    if (IS_R300_VARIANT)
+	OUTREG(R300_CRTC_TILE_X0_Y0, restore->crtc_tile_x0_y0);
     OUTREG(RADEON_CRTC_OFFSET_CNTL,     restore->crtc_offset_cntl);
+    OUTREG(RADEON_CRTC_OFFSET,          restore->crtc_offset);
+
     OUTREG(RADEON_CRTC_PITCH,           restore->crtc_pitch);
     OUTREG(RADEON_DISP_MERGE_CNTL,      restore->disp_merge_cntl);
     OUTREG(RADEON_CRTC_MORE_CNTL,       restore->crtc_more_cntl);
@@ -4196,8 +4199,11 @@ void RADEONRestoreCrtc2Registers(ScrnInf
     OUTREG(RADEON_FP_H2_SYNC_STRT_WID,   restore->fp_h2_sync_strt_wid);
     OUTREG(RADEON_FP_V2_SYNC_STRT_WID,   restore->fp_v2_sync_strt_wid);
 
-    OUTREG(RADEON_CRTC2_OFFSET,          restore->crtc2_offset);
+    if (IS_R300_VARIANT)
+	OUTREG(R300_CRTC2_TILE_X0_Y0, restore->crtc2_tile_x0_y0);
     OUTREG(RADEON_CRTC2_OFFSET_CNTL,     restore->crtc2_offset_cntl);
+    OUTREG(RADEON_CRTC2_OFFSET,          restore->crtc2_offset);
+
     OUTREG(RADEON_CRTC2_PITCH,           restore->crtc2_pitch);
     OUTREG(RADEON_DISP2_MERGE_CNTL,      restore->disp2_merge_cntl);
 
@@ -4827,6 +4833,9 @@ static void RADEONSaveCrtcRegisters(Scrn
     save->disp_merge_cntl      = INREG(RADEON_DISP_MERGE_CNTL);
     save->crtc_more_cntl       = INREG(RADEON_CRTC_MORE_CNTL);
 
+    if (IS_R300_VARIANT)
+	save->crtc_tile_x0_y0 =  INREG(R300_CRTC_TILE_X0_Y0);
+
     if (info->IsDellServer) {
 	save->tv_dac_cntl      = INREG(RADEON_TV_DAC_CNTL);
 	save->dac2_cntl        = INREG(RADEON_DAC_CNTL2);
@@ -4880,6 +4889,9 @@ static void RADEONSaveCrtc2Registers(Scr
     save->crtc2_offset_cntl     = INREG(RADEON_CRTC2_OFFSET_CNTL);
     save->crtc2_pitch           = INREG(RADEON_CRTC2_PITCH);
 
+    if (IS_R300_VARIANT)
+	save->crtc2_tile_x0_y0 =  INREG(R300_CRTC2_TILE_X0_Y0);
+
     save->fp_h2_sync_strt_wid   = INREG (RADEON_FP_H2_SYNC_STRT_WID);
     save->fp_v2_sync_strt_wid   = INREG (RADEON_FP_V2_SYNC_STRT_WID);
 
@@ -5449,18 +5461,23 @@ static void RADEONInitOutputRegisters(Sc
 
 /* Define CRTC registers for requested video mode */
 Bool RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save,
-				  DisplayModePtr mode, RADEONInfoPtr info)
+				  DisplayModePtr mode, int x, int y)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
+    RADEONInfoPtr  info       = RADEONPTR(pScrn);
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
-    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+    //RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
     int    format;
     int    hsync_start;
     int    hsync_wid;
     int    vsync_wid;
-    int i;
-
+    int i, Base;
+#ifdef XF86DRI
+    RADEONSAREAPrivPtr pSAREAPriv;
+    XF86DRISAREAPtr pSAREA;
+#endif
 
     switch (info->CurrentLayout.pixel_code) {
     case 4:  format = 1; break;
@@ -5603,6 +5620,79 @@ Bool RADEONInitCrtcRegisters(xf86CrtcPtr
 	}
     }
 
+    Base = pScrn->fbOffset;
+
+    if (info->tilingEnabled) {
+        if (IS_R300_VARIANT) {
+	/* On r300/r400 when tiling is enabled crtc_offset is set to the address of
+	 * the surface.  the x/y offsets are handled by the X_Y tile reg for each crtc
+	 * Makes tiling MUCH easier.
+	 */
+             save->crtc_tile_x0_y0 = x | (y << 16);
+             Base &= ~0x7ff;
+         } else {
+	     /* note we cannot really simply use the info->ModeReg.crtc_offset_cntl value, since the
+		drm might have set FLIP_CNTL since we wrote that. Unfortunately FLIP_CNTL causes
+		flickering when scrolling vertically in a virtual screen, possibly because crtc will
+		pick up the new offset value at the end of each scanline, but the new offset_cntl value
+		only after a vsync. We'd probably need to wait (in drm) for vsync and only then update
+		OFFSET and OFFSET_CNTL, if the y coord has changed. Seems hard to fix. */
+	     save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL) & ~0xf;
+#if 0
+	     /* try to get rid of flickering when scrolling at least for 2d */
+#ifdef XF86DRI
+	     if (!info->have3DWindows)
+#endif
+		 save->crtc_offset_cntl &= ~RADEON_CRTC_OFFSET_FLIP_CNTL;
+#endif
+	     
+             int byteshift = info->CurrentLayout.bitsPerPixel >> 4;
+             /* crtc uses 256(bytes)x8 "half-tile" start addresses? */
+             int tile_addr = (((y >> 3) * info->CurrentLayout.displayWidth + x) >> (8 - byteshift)) << 11;
+             Base += tile_addr + ((x << byteshift) % 256) + ((y % 8) << 8);
+             save->crtc_offset_cntl = save->crtc_offset_cntl | (y % 16);
+         }
+    }
+    else {
+       int offset = y * info->CurrentLayout.displayWidth + x;
+       switch (info->CurrentLayout.pixel_code) {
+       case 15:
+       case 16: offset *= 2; break;
+       case 24: offset *= 3; break;
+       case 32: offset *= 4; break;
+       }
+       Base += offset;
+    }
+
+    Base &= ~7;                 /* 3 lower bits are always 0 */
+
+
+#ifdef XF86DRI
+    if (info->directRenderingInited) {
+	/* note cannot use pScrn->pScreen since this is unitialized when called from
+	   RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */
+        /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
+	 *** pageflipping!
+	 ***/
+	pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]);
+	/* can't get at sarea in a semi-sane way? */
+	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
+
+	pSAREA->frame.x = (Base  / info->CurrentLayout.pixel_bytes)
+	    % info->CurrentLayout.displayWidth;
+	pSAREA->frame.y = (Base / info->CurrentLayout.pixel_bytes)
+	    / info->CurrentLayout.displayWidth;
+	pSAREA->frame.width = pScrn->frameX1 - x + 1;
+	pSAREA->frame.height = pScrn->frameY1 - y + 1;
+
+	if (pSAREAPriv->pfCurrentPage == 1) {
+	    Base += info->backOffset - info->frontOffset;
+	}
+    }
+#endif
+    save->crtc_offset = Base;
+
+
     if (info->IsDellServer) {
 	save->dac2_cntl = info->SavedReg.dac2_cntl;
 	save->tv_dac_cntl = info->SavedReg.tv_dac_cntl;
@@ -5625,17 +5715,23 @@ Bool RADEONInitCrtcRegisters(xf86CrtcPtr
 
 /* Define CRTC2 registers for requested video mode */
 Bool RADEONInitCrtc2Registers(xf86CrtcPtr crtc, RADEONSavePtr save,
-				     DisplayModePtr mode, RADEONInfoPtr info)
+				     DisplayModePtr mode, int x, int y)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
+    RADEONInfoPtr  info       = RADEONPTR(pScrn);
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
-    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+    //RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
     int    format;
     int    hsync_start;
     int    hsync_wid;
     int    vsync_wid;
-    int i;
+    int i, Base;
+#ifdef XF86DRI
+    RADEONSAREAPrivPtr pSAREAPriv;
+    XF86DRISAREAPtr pSAREA;
+#endif
 
     switch (info->CurrentLayout.pixel_code) {
     case 4:  format = 1; break;
@@ -5735,6 +5831,73 @@ Bool RADEONInitCrtc2Registers(xf86CrtcPt
 	}
     }
 
+    Base = pScrn->fbOffset;
+
+    if (info->tilingEnabled) {
+        if (IS_R300_VARIANT) {
+	/* On r300/r400 when tiling is enabled crtc_offset is set to the address of
+	 * the surface.  the x/y offsets are handled by the X_Y tile reg for each crtc
+	 * Makes tiling MUCH easier.
+	 */
+             save->crtc2_tile_x0_y0 = x | (y << 16);
+             Base &= ~0x7ff;
+         } else {
+	     /* note we cannot really simply use the info->ModeReg.crtc_offset_cntl value, since the
+		drm might have set FLIP_CNTL since we wrote that. Unfortunately FLIP_CNTL causes
+		flickering when scrolling vertically in a virtual screen, possibly because crtc will
+		pick up the new offset value at the end of each scanline, but the new offset_cntl value
+		only after a vsync. We'd probably need to wait (in drm) for vsync and only then update
+		OFFSET and OFFSET_CNTL, if the y coord has changed. Seems hard to fix. */
+	     save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL) & ~0xf;
+#if 0
+	     /* try to get rid of flickering when scrolling at least for 2d */
+#ifdef XF86DRI
+	     if (!info->have3DWindows)
+#endif
+		 save->crtc2_offset_cntl &= ~RADEON_CRTC_OFFSET_FLIP_CNTL;
+#endif
+
+             int byteshift = info->CurrentLayout.bitsPerPixel >> 4;
+             /* crtc uses 256(bytes)x8 "half-tile" start addresses? */
+             int tile_addr = (((y >> 3) * info->CurrentLayout.displayWidth + x) >> (8 - byteshift)) << 11;
+             Base += tile_addr + ((x << byteshift) % 256) + ((y % 8) << 8);
+             save->crtc2_offset_cntl = save->crtc_offset_cntl | (y % 16);
+         }
+    }
+    else {
+       int offset = y * info->CurrentLayout.displayWidth + x;
+       switch (info->CurrentLayout.pixel_code) {
+       case 15:
+       case 16: offset *= 2; break;
+       case 24: offset *= 3; break;
+       case 32: offset *= 4; break;
+       }
+       Base += offset;
+    }
+
+    Base &= ~7;                 /* 3 lower bits are always 0 */
+    save->crtc2_offset = Base;
+
+#ifdef XF86DRI
+    if (info->directRenderingInited) {
+	/* note cannot use pScrn->pScreen since this is unitialized when called from
+	   RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */
+        /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
+	 *** pageflipping!
+	 ***/
+	pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]);
+	/* can't get at sarea in a semi-sane way? */
+	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
+
+	pSAREAPriv->crtc2_base = Base;
+
+	if (pSAREAPriv->pfCurrentPage == 1) {
+	    Base += info->backOffset - info->frontOffset;
+	}
+    }
+#endif
+    save->crtc2_offset = Base;
+
     /* We must set SURFACE_CNTL properly on the second screen too */
     save->surface_cntl = 0;
 #if X_BYTE_ORDER == X_BIG_ENDIAN
@@ -6226,11 +6389,11 @@ ModeStatus RADEONValidMode(int scrnIndex
 /* Adjust viewport into virtual desktop such that (0,0) in viewport
  * space is (x,y) in virtual space.
  */
-void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int clone)
+void RADEONDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, Bool crtc2)
 {
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
-    int            Base, regcntl, crtcoffsetcntl, xytilereg, crtcxytile = 0;
+    int            Base, reg, regcntl, crtcoffsetcntl, xytilereg, crtcxytile = 0;
 #ifdef XF86DRI
     RADEONSAREAPrivPtr pSAREAPriv;
     XF86DRISAREAPtr pSAREA;
@@ -6257,10 +6420,12 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
      pick up the new offset value at the end of each scanline, but the new offset_cntl value
      only after a vsync. We'd probably need to wait (in drm) for vsync and only then update
      OFFSET and OFFSET_CNTL, if the y coord has changed. Seems hard to fix. */
-    if (clone || info->IsSecondary) {
+    if (crtc2 || info->IsSecondary) {
+	reg = RADEON_CRTC2_OFFSET;
 	regcntl = RADEON_CRTC2_OFFSET_CNTL;
 	xytilereg = R300_CRTC2_TILE_X0_Y0;
     } else {
+	reg = RADEON_CRTC_OFFSET;
 	regcntl = RADEON_CRTC_OFFSET_CNTL;
 	xytilereg = R300_CRTC_TILE_X0_Y0;
     }
@@ -6312,7 +6477,7 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
 	/* can't get at sarea in a semi-sane way? */
 	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
 
-	if (clone || info->IsSecondary) {
+	if (crtc2 || info->IsSecondary) {
 	    pSAREAPriv->crtc2_base = Base;
 	}
 	else {
@@ -6331,15 +6496,15 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
 #endif
 
     if (IS_R300_VARIANT) {
-        OUTREG(xytilereg, crtcxytile);
+	OUTREG(xytilereg, crtcxytile);
     } else {
-        OUTREG(regcntl, crtcoffsetcntl);
+	OUTREG(regcntl, crtcoffsetcntl);
     }
 
-    if (clone)
-        info->ModeReg.crtc2_offset = Base;
+    if (crtc2)
+	OUTREG(reg, Base);
     else
-        info->ModeReg.crtc_offset = Base;
+	OUTREG(reg, Base);
 }
 
 void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags)
@@ -6457,7 +6622,7 @@ Bool RADEONEnterVT(int scrnIndex, int fl
     }
 #endif
 
-    pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+    //    pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
 
     return TRUE;
 }
diff-tree aec078eb0740651fba8ec602e8239bd679efc8ad (from 0550c37ecc434b8075fb3c367d100ff27625bb64)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 11:57:57 2007 -0400

    RADEON: fix up DDCConnected()

diff --git a/src/radeon_display.c b/src/radeon_display.c
index cf1d1fe..f64b6f6 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -566,7 +566,7 @@ RADEONCrtIsPhysicallyConnected(ScrnInfoP
 }
 
 
-static RADEONMonitorType RADEONDisplayDDCConnected(ScrnInfoPtr pScrn, RADEONDDCType DDCType, xf86OutputPtr output)
+static RADEONMonitorType RADEONDisplayDDCConnected(ScrnInfoPtr pScrn, xf86OutputPtr output)
 {
     RADEONInfoPtr info = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
@@ -574,9 +574,9 @@ static RADEONMonitorType RADEONDisplayDD
     RADEONMonitorType MonType = MT_NONE;
     xf86MonPtr* MonInfo = &output->MonInfo;
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
+    RADEONDDCType DDCType = radeon_output->DDCType;
     int i, j;
 
-
     DDCReg = radeon_output->DDCReg;
 
     /* Read and output monitor info using DDC2 over I2C bus */
@@ -645,21 +645,13 @@ static RADEONMonitorType RADEONDisplayDD
 	   ~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1));
 
     if (*MonInfo) {
+	/* if it's digital */
 	if ((*MonInfo)->rawData[0x14] & 0x80) {
-	    /* Note some laptops have a DVI output that uses internal TMDS,
-	     * when its DVI is enabled by hotkey, LVDS panel is not used.
-	     * In this case, the laptop is configured as DVI+VGA as a normal 
-	     * desktop card.
-	     * Also for laptop, when X starts with lid closed (no DVI connection)
-	     * both LDVS and TMDS are disable, we still need to treat it as a LVDS panel.
-	     */
-	    if (radeon_output->TMDSType == TMDS_EXT) MonType = MT_DFP;
-	    else {
-		if (INREG(RADEON_FP_GEN_CNTL) & RADEON_FP_EN_TMDS)
-		    MonType = MT_DFP;
-		else
-		    MonType = MT_LCD;
-	    }
+	    if ((info->IsAtomBios && radeon_output->ConnectorType == CONNECTOR_LVDS_ATOM) ||
+		radeon_output->ConnectorType == CONNECTOR_PROPRIETARY)
+		MonType = MT_LCD;
+	    else
+		MonType = MT_DFP;
 	} else MonType = MT_CRT;
     } else MonType = MT_NONE;
 
@@ -979,9 +971,7 @@ void RADEONConnectorFindMonitor(ScrnInfo
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
     
     if (radeon_output->MonType == MT_UNKNOWN) {
-      if ((radeon_output->MonType = RADEONDisplayDDCConnected(pScrn,
-						     radeon_output->DDCType,
-						     output)));
+      if ((radeon_output->MonType = RADEONDisplayDDCConnected(pScrn, output)));
       else if((radeon_output->MonType = RADEONPortCheckNonDDC(pScrn, output)));
       else if (radeon_output->DACType == DAC_PRIMARY) 
 	  radeon_output->MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(radeon_output->DACType));
diff-tree 0550c37ecc434b8075fb3c367d100ff27625bb64 (from 117220527de9fd3158f600645bcfcaf46847f45f)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 11:44:50 2007 -0400

    RADEON: don't need to pass pScrn to EnableDisplay()

diff --git a/src/radeon.h b/src/radeon.h
index 4f674ed..8c3b700 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -846,7 +846,7 @@ extern Bool        RADEONI2cInit(ScrnInf
 extern void        RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag);
 extern Bool        RADEONSetupConnectors(ScrnInfoPtr pScrn);
 extern Bool        RADEONMapControllers(ScrnInfoPtr pScrn);
-extern void        RADEONEnableDisplay(ScrnInfoPtr pScrn, xf86OutputPtr pPort, BOOL bEnable);
+extern void        RADEONEnableDisplay(xf86OutputPtr pPort, BOOL bEnable);
 extern void        RADEONDisableDisplays(ScrnInfoPtr pScrn);
 extern void        RADEONGetPanelInfo(ScrnInfoPtr pScrn);
 extern void        RADEONGetTVDacAdjInfo(xf86OutputPtr output);
diff --git a/src/radeon_display.c b/src/radeon_display.c
index 897db27..cf1d1fe 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1370,8 +1370,9 @@ void RADEONDisableDisplays(ScrnInfoPtr p
 }
 
 /* This is to be used enable/disable displays dynamically */
-void RADEONEnableDisplay(ScrnInfoPtr pScrn, xf86OutputPtr output, BOOL bEnable)
+void RADEONEnableDisplay(xf86OutputPtr output, BOOL bEnable)
 {
+    ScrnInfoPtr pScrn = output->scrn;
     RADEONInfoPtr info = RADEONPTR(pScrn);
     RADEONSavePtr save = &info->ModeReg;
     unsigned char * RADEONMMIO = info->MMIO;
@@ -2216,13 +2217,13 @@ radeon_dpms(xf86OutputPtr output, int mo
 
     switch(mode) {
     case DPMSModeOn:
-	RADEONEnableDisplay(pScrn, output, TRUE);
+	RADEONEnableDisplay(output, TRUE);
 	/*      RADEONDPMSSetOn(output);*/
 	break;
     case DPMSModeOff:
     case DPMSModeSuspend:
     case DPMSModeStandby:
-	RADEONEnableDisplay(pScrn, output, FALSE);
+	RADEONEnableDisplay(output, FALSE);
 	/*RADEONDPMSSetOff(output);*/
 	break;
     }
@@ -2314,7 +2315,7 @@ radeon_mode_set(xf86OutputPtr output, Di
 	RADEONRestoreDACRegisters(pScrn, &info->ModeReg);
     }
 
-    RADEONEnableDisplay(pScrn, output, TRUE);
+    RADEONEnableDisplay(output, TRUE);
 }
 
 static void
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index a261d0d..edc59bb 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -4644,7 +4644,7 @@ RADEONEnableOutputs(ScrnInfoPtr pScrn, i
     for (i = 0; i < xf86_config->num_output; i++) {
 	xf86OutputPtr output = xf86_config->output[i];
 	if (output->crtc == crtc) {
-	    RADEONEnableDisplay(pScrn, output, TRUE);
+	    RADEONEnableDisplay(output, TRUE);
 	}
     }
 }
diff-tree 117220527de9fd3158f600645bcfcaf46847f45f (from 7e5c29961ac2a9e9dbe5d6d2d73d11cd018d62b5)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 11:37:35 2007 -0400

    RADEON: remove hardcoded output limit and PortInfo stuff

diff --git a/src/radeon.h b/src/radeon.h
index e58747a..4f674ed 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -763,7 +763,7 @@ typedef struct {
 
     CARD32            tv_dac_adj;
 
-  int               max_connectors;
+    RADEONBIOSConnector BiosConnector[RADEON_MAX_BIOS_CONNECTOR];
 
     CreateScreenResourcesProcPtr CreateScreenResources;
 } RADEONInfoRec, *RADEONInfoPtr;
@@ -844,7 +844,7 @@ extern Bool        RADEONGetHardCodedEDI
 extern void        RADEONInitDispBandwidth(ScrnInfoPtr pScrn);
 extern Bool        RADEONI2cInit(ScrnInfoPtr pScrn);
 extern void        RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag);
-extern void        RADEONSetupConnectors(ScrnInfoPtr pScrn);
+extern Bool        RADEONSetupConnectors(ScrnInfoPtr pScrn);
 extern Bool        RADEONMapControllers(ScrnInfoPtr pScrn);
 extern void        RADEONEnableDisplay(ScrnInfoPtr pScrn, xf86OutputPtr pPort, BOOL bEnable);
 extern void        RADEONDisableDisplays(ScrnInfoPtr pScrn);
diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index 4b3ec56..6e08f24 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -148,49 +148,49 @@ Bool RADEONGetConnectorInfoFromBIOS (Scr
 			    /* sharing same port with id[0] */
 			    if (((portinfo>>8) & 0xf) == id[0]) {
 				if (i == 3) 
-				    pRADEONEnt->PortInfo[0]->TMDSType = TMDS_INT;
+				    info->BiosConnector[0].TMDSType = TMDS_INT;
 				else if (i == 7)
-				    pRADEONEnt->PortInfo[0]->TMDSType = TMDS_EXT;
+				    info->BiosConnector[0].TMDSType = TMDS_EXT;
 
-				if (pRADEONEnt->PortInfo[0]->DACType == DAC_UNKNOWN)
-				    pRADEONEnt->PortInfo[0]->DACType = (portinfo & 0xf) - 1;
+				if (info->BiosConnector[0].DACType == DAC_UNKNOWN)
+				    info->BiosConnector[0].DACType = (portinfo & 0xf) - 1;
 				continue;
 			    }
 			}
 
 			id[crtc] = (portinfo>>8) & 0xf; 
-			pRADEONEnt->PortInfo[crtc]->DACType = (portinfo & 0xf) - 1;
-			pRADEONEnt->PortInfo[crtc]->ConnectorType = (portinfo>>4) & 0xf;
+			info->BiosConnector[crtc].DACType = (portinfo & 0xf) - 1;
+			info->BiosConnector[crtc].ConnectorType = (portinfo>>4) & 0xf;
 			if (i == 3) 
-			    pRADEONEnt->PortInfo[crtc]->TMDSType = TMDS_INT;
+			    info->BiosConnector[crtc].TMDSType = TMDS_INT;
 			else if (i == 7)
-			    pRADEONEnt->PortInfo[crtc]->TMDSType = TMDS_EXT;
+			    info->BiosConnector[crtc].TMDSType = TMDS_EXT;
 			
 			if((tmp0 = RADEON_BIOS16 (info->MasterDataStart + 24)) && id[crtc]) {
 			    switch (RADEON_BIOS16 (tmp0 + 4 + 27 * id[crtc]) * 4) 
 			    {
 			    case RADEON_GPIO_MONID:
-				pRADEONEnt->PortInfo[crtc]->DDCType = DDC_MONID;
+				info->BiosConnector[crtc].DDCType = DDC_MONID;
 				break;
 			    case RADEON_GPIO_DVI_DDC:
-				pRADEONEnt->PortInfo[crtc]->DDCType = DDC_DVI;
+				info->BiosConnector[crtc].DDCType = DDC_DVI;
 				break;
 			    case RADEON_GPIO_VGA_DDC:
-				pRADEONEnt->PortInfo[crtc]->DDCType = DDC_VGA;
+				info->BiosConnector[crtc].DDCType = DDC_VGA;
 				break;
 			    case RADEON_GPIO_CRT2_DDC:
-				pRADEONEnt->PortInfo[crtc]->DDCType = DDC_CRT2;
+				info->BiosConnector[crtc].DDCType = DDC_CRT2;
 				break;
 			    case RADEON_LCD_GPIO_MASK:
-				pRADEONEnt->PortInfo[crtc]->DDCType = DDC_LCD;
+				info->BiosConnector[crtc].DDCType = DDC_LCD;
 				break;
 			    default:
-				pRADEONEnt->PortInfo[crtc]->DDCType = DDC_NONE_DETECTED;
+				info->BiosConnector[crtc].DDCType = DDC_NONE_DETECTED;
 				break;
 			    }
 
 			} else {
-			    pRADEONEnt->PortInfo[crtc]->DDCType = DDC_NONE_DETECTED;
+			    info->BiosConnector[crtc].DDCType = DDC_NONE_DETECTED;
 			}
 			crtc++;
 		    } else {
@@ -200,22 +200,22 @@ Bool RADEONGetConnectorInfoFromBIOS (Scr
 			for (j=0; j<2; j++) {
 			    if (((portinfo>>8) & 0xf) == id[j]) {
 				if (i == 3) 
-				    pRADEONEnt->PortInfo[j]->TMDSType = TMDS_INT;
+				    info->BiosConnector[j].TMDSType = TMDS_INT;
 				else if (i == 7)
-				    pRADEONEnt->PortInfo[j]->TMDSType = TMDS_EXT;
+				    info->BiosConnector[j].TMDSType = TMDS_EXT;
 
-				if (pRADEONEnt->PortInfo[j]->DACType == DAC_UNKNOWN)
-				    pRADEONEnt->PortInfo[j]->DACType = (portinfo & 0xf) - 1;
+				if (info->BiosConnector[j].DACType == DAC_UNKNOWN)
+				    info->BiosConnector[j].DACType = (portinfo & 0xf) - 1;
 			    }
 			}
 		    }
 		}
 	    }
-
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bios Connector table: \n");
 	    for (i=0; i<2; i++) {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Port%d: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
-			   i, pRADEONEnt->PortInfo[i]->DDCType, pRADEONEnt->PortInfo[i]->DACType,
-			   pRADEONEnt->PortInfo[i]->TMDSType, pRADEONEnt->PortInfo[i]->ConnectorType);
+			   i, info->BiosConnector[i].DDCType, info->BiosConnector[i].DACType,
+			   info->BiosConnector[i].TMDSType, info->BiosConnector[i].ConnectorType);
 	    }	    
 	} else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n");
@@ -242,25 +242,27 @@ Bool RADEONGetConnectorInfoFromBIOS (Scr
 		tmp0 = RADEON_BIOS16(tmp + i*2);
 		if (((tmp0 >> 12) & 0x0f) == 0) continue;     /* no connector */
 		if (connector_found > 0) {
-		    if (pRADEONEnt->PortInfo[tmp1]->DDCType == ((tmp0 >> 8) & 0x0f))
+		    if (info->BiosConnector[tmp1].DDCType == ((tmp0 >> 8) & 0x0f))
 			continue;                             /* same connector */
 		}
 
 		/* internal DDC_DVI port will get assigned to PortInfo[0], or if there is no DDC_DVI (like in some IGPs). */
 		tmp1 = ((((tmp0 >> 8) & 0xf) == DDC_DVI) || (tmp1 == 1)) ? 0 : 1; /* determine port info index */
 		
-		pRADEONEnt->PortInfo[tmp1]->DDCType        = (tmp0 >> 8) & 0x0f;
-		if (pRADEONEnt->PortInfo[tmp1]->DDCType > DDC_CRT2) pRADEONEnt->PortInfo[tmp1]->DDCType = DDC_NONE_DETECTED;
-		pRADEONEnt->PortInfo[tmp1]->DACType        = (tmp0 & 0x01) ? DAC_TVDAC : DAC_PRIMARY;
-		pRADEONEnt->PortInfo[tmp1]->ConnectorType  = (tmp0 >> 12) & 0x0f;
-		if (pRADEONEnt->PortInfo[tmp1]->ConnectorType > CONNECTOR_UNSUPPORTED) pRADEONEnt->PortInfo[tmp1]->ConnectorType = CONNECTOR_UNSUPPORTED;
-		pRADEONEnt->PortInfo[tmp1]->TMDSType       = ((tmp0 >> 4) & 0x01) ? TMDS_EXT : TMDS_INT;
+		info->BiosConnector[tmp1].DDCType        = (tmp0 >> 8) & 0x0f;
+		if (info->BiosConnector[tmp1].DDCType > DDC_CRT2)
+		    info->BiosConnector[tmp1].DDCType = DDC_NONE_DETECTED;
+		info->BiosConnector[tmp1].DACType        = (tmp0 & 0x01) ? DAC_TVDAC : DAC_PRIMARY;
+		info->BiosConnector[tmp1].ConnectorType  = (tmp0 >> 12) & 0x0f;
+		if (info->BiosConnector[tmp1].ConnectorType > CONNECTOR_UNSUPPORTED)
+		    info->BiosConnector[tmp1].ConnectorType = CONNECTOR_UNSUPPORTED;
+		info->BiosConnector[tmp1].TMDSType       = ((tmp0 >> 4) & 0x01) ? TMDS_EXT : TMDS_INT;
 
 		/* some sanity checks */
-		if (((pRADEONEnt->PortInfo[tmp1]->ConnectorType != CONNECTOR_DVI_D) &&
-		     (pRADEONEnt->PortInfo[tmp1]->ConnectorType != CONNECTOR_DVI_I)) &&
-		    pRADEONEnt->PortInfo[tmp1]->TMDSType == TMDS_INT)
-		    pRADEONEnt->PortInfo[tmp1]->TMDSType = TMDS_UNKNOWN;
+		if (((info->BiosConnector[tmp1].ConnectorType != CONNECTOR_DVI_D) &&
+		     (info->BiosConnector[tmp1].ConnectorType != CONNECTOR_DVI_I)) &&
+		    info->BiosConnector[tmp1].TMDSType == TMDS_INT)
+		    info->BiosConnector[tmp1].TMDSType = TMDS_UNKNOWN;
 		
 		connector_found += (tmp1 + 1);
 	    }
@@ -270,19 +272,20 @@ Bool RADEONGetConnectorInfoFromBIOS (Scr
 	}
 
 	if (info->IsMobility) {
+#if 0
 	    /* For the cases where only one VGA connector is found, 
 	       we assume LVDS is not listed in the connector table, 
 	       add it in here as the first port.
 	    */
-	    if ((connector_found < 3) && (pRADEONEnt->PortInfo[tmp1]->ConnectorType == CONNECTOR_CRT)) {
+	    if ((connector_found < 3) && (info->BiosConnector[tmp1]->ConnectorType == CONNECTOR_CRT)) {
 		if (connector_found == 1) {
-		    memcpy (&pRADEONEnt->PortInfo[1], &pRADEONEnt->PortInfo[0], 
-			    sizeof (pRADEONEnt->PortInfo[0]));
+		    memcpy (&info->BiosConnector[1], &info->BiosConnector[0], 
+			    sizeof (info->BiosConnector));
 		}
-		pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
-		pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
-		pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED;
-		pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_PROPRIETARY;
+		info->BiosConnector[0].DACType = DAC_TVDAC;
+		info->BiosConnector[0].TMDSType = TMDS_UNKNOWN;
+		info->BiosConnector[0].DDCType = DDC_NONE_DETECTED;
+		info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY;
 
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "LVDS port is not in connector table, added in.\n");
 		if (connector_found == 0) connector_found = 1;
@@ -290,54 +293,54 @@ Bool RADEONGetConnectorInfoFromBIOS (Scr
 	    }
 
 	    /* some bioses seem to list the LVDS port as DVI hack around that here */
-	    if (pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_DVI_D) {
-		pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_PROPRIETARY;
+	    if (info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_D) {
+		info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY;
 	    }
-
+#endif
 	    if ((tmp = RADEON_BIOS16(info->ROMHeaderStart + 0x42))) {
 	        if ((tmp0 = RADEON_BIOS16(tmp + 0x15))) {
 		    if ((tmp1 = RADEON_BIOS8(tmp0+2) & 0x07)) {	    
-			pRADEONEnt->PortInfo[0]->DDCType	= tmp1;      
-			if (pRADEONEnt->PortInfo[0]->DDCType > DDC_LCD) {
+			info->BiosConnector[0].DDCType	= tmp1;      
+			if (info->BiosConnector[0].DDCType > DDC_LCD) {
 			    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 				       "Unknown DDCType %d found\n",
-				       pRADEONEnt->PortInfo[0]->DDCType);
-			    pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED;
+				       info->BiosConnector[0].DDCType);
+			    info->BiosConnector[0].DDCType = DDC_NONE_DETECTED;
 			}
 			xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "LCD DDC Info Table found!\n");
 		    }
 		}
 	    } 
 	} else if (connector_found == 2) {
-	    memcpy (&pRADEONEnt->PortInfo[0], &pRADEONEnt->PortInfo[1], 
-		    sizeof (pRADEONEnt->PortInfo[0]));	
-	    pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
-	    pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
-	    pRADEONEnt->PortInfo[1]->DDCType = DDC_NONE_DETECTED;
-	    pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_NONE;
+	    memcpy (&info->BiosConnector[0], &info->BiosConnector[1], 
+		    sizeof (info->BiosConnector[0]));	
+	    info->BiosConnector[1].DACType = DAC_UNKNOWN;
+	    info->BiosConnector[1].TMDSType = TMDS_UNKNOWN;
+	    info->BiosConnector[1].DDCType = DDC_NONE_DETECTED;
+	    info->BiosConnector[1].ConnectorType = CONNECTOR_NONE;
 	    connector_found = 1;
 	}
 
 	if (connector_found == 0) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No connector found in Connector Info Table.\n");
 	} else {
-	    xf86DrvMsg(0, X_INFO, "Connector0: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
-		       pRADEONEnt->PortInfo[0]->DDCType, pRADEONEnt->PortInfo[0]->DACType,
-		       pRADEONEnt->PortInfo[0]->TMDSType, pRADEONEnt->PortInfo[0]->ConnectorType);
+	    xf86DrvMsg(0, X_INFO, "Bios Connector0: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
+		       info->BiosConnector[0].DDCType, info->BiosConnector[0].DACType,
+		       info->BiosConnector[0].TMDSType, info->BiosConnector[0].ConnectorType);
 	}
 	if (connector_found == 3) {
-	    xf86DrvMsg(0, X_INFO, "Connector1: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
-		       pRADEONEnt->PortInfo[1]->DDCType, pRADEONEnt->PortInfo[1]->DACType,
-		       pRADEONEnt->PortInfo[1]->TMDSType, pRADEONEnt->PortInfo[1]->ConnectorType);
+	    xf86DrvMsg(0, X_INFO, "Bios Connector1: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
+		       info->BiosConnector[1].DDCType, info->BiosConnector[1].DACType,
+		       info->BiosConnector[1].TMDSType, info->BiosConnector[1].ConnectorType);
 	}
 
 #if 0
 /* External TMDS Table, not used now */
         if ((tmp0 = RADEON_BIOS16(info->ROMHeaderStart + 0x58))) {
 
-            //pRADEONEnt->PortInfo[1]->DDCType = (RADEON_BIOS8(tmp0 + 7) & 0x07);
-            //pRADEONEnt->PortInfo[1]->ConnectorType  = CONNECTOR_DVI_I;
-            //pRADEONEnt->PortInfo[1]->TMDSType = TMDS_EXT;
+            //info->BiosConnector[1].DDCType = (RADEON_BIOS8(tmp0 + 7) & 0x07);
+            //info->BiosConnector[1].ConnectorType  = CONNECTOR_DVI_I;
+            //info->BiosConnector[1].TMDSType = TMDS_EXT;
             xf86DrvMsg(pScrn->scrnIndex, X_INFO, "External TMDS found.\n");
 
         } else {
diff --git a/src/radeon_display.c b/src/radeon_display.c
index c77ff64..897db27 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -871,7 +871,7 @@ static Bool RADEONGetLVDSInfo (xf86Outpu
 		tmp_mode = tmp_mode->next;
 	    }
 	}
-	if ((radeon_output->DotClock == 0) && !pRADEONEnt->pOutput[0]->MonInfo) {
+	if ((radeon_output->DotClock == 0) && !output->MonInfo) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "Panel size is not correctly detected.\n"
 		       "Please try to use PanelSize option for correct settings.\n");
@@ -934,283 +934,14 @@ void RADEONGetTVDacAdjInfo(xf86OutputPtr
 
 static void RADEONSwapOutputs(ScrnInfoPtr pScrn)
 {
-    RADEONEntPtr pRADEONEnt  = RADEONEntPriv(pScrn);
-    xf86OutputPtr connector;
-    RADEONOutputPrivatePtr conn_priv;
+    RADEONInfoPtr info       = RADEONPTR(pScrn);
+    RADEONBIOSConnector tmp;
     
-    connector = pRADEONEnt->pOutput[0];
-    pRADEONEnt->pOutput[0] = pRADEONEnt->pOutput[1];
-    pRADEONEnt->pOutput[1] = connector;
+    tmp = info->BiosConnector[0];
+    info->BiosConnector[0] = info->BiosConnector[1];
+    info->BiosConnector[1] = tmp;
     
-    conn_priv = pRADEONEnt->PortInfo[0];
-    pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
-    pRADEONEnt->PortInfo[1] = conn_priv;
 }
-#if 0
-/*
- * initialise the static data sos we don't have to re-do at randr change */
-void RADEONSetupConnectors(ScrnInfoPtr pScrn)
-{
-    RADEONInfoPtr info       = RADEONPTR(pScrn);
-    RADEONEntPtr pRADEONEnt  = RADEONEntPriv(pScrn);
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    xf86OutputPtr output;
-    const char *s;
-    int i = 0, second = 0, max_mt = 5;
-
-    /* We first get the information about all connectors from BIOS.
-     * This is how the card is phyiscally wired up.
-     * The information should be correct even on a OEM card.
-     * If not, we may have problem -- need to use MonitorLayout option.
-     */
-    for (i = 0; i < info->max_connectors; i++) {
-	pRADEONEnt->PortInfo[i]->MonType = MT_UNKNOWN;
-	pRADEONEnt->PortInfo[i]->DDCType = DDC_NONE_DETECTED;
-	pRADEONEnt->PortInfo[i]->DACType = DAC_UNKNOWN;
-	pRADEONEnt->PortInfo[i]->TMDSType = TMDS_UNKNOWN;
-	pRADEONEnt->PortInfo[i]->ConnectorType = CONNECTOR_NONE;
-    }
-
-    if (!RADEONGetConnectorInfoFromBIOS(pScrn) ||
-        ((pRADEONEnt->PortInfo[0]->DDCType == 0) &&
-        (pRADEONEnt->PortInfo[1]->DDCType == 0))) {
-	/* Below is the most common setting, but may not be true */
-	pRADEONEnt->PortInfo[0]->MonType = MT_UNKNOWN;
-	pRADEONEnt->PortInfo[0]->DDCType = DDC_DVI;
-	pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
-	pRADEONEnt->PortInfo[0]->TMDSType = TMDS_INT;
-	pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_DVI_I;
-
-	pRADEONEnt->PortInfo[1]->MonType = MT_UNKNOWN;
-	pRADEONEnt->PortInfo[1]->DDCType = DDC_VGA;
-	pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
-	pRADEONEnt->PortInfo[1]->TMDSType = TMDS_EXT;
-	pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_CRT;
-
-
-       /* Some cards have the DDC lines swapped and we have no way to
-        * detect it yet (Mac cards)
-        */
-       if (xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DDC, FALSE)) {
-           pRADEONEnt->PortInfo[0]->DDCType = DDC_VGA;
-           pRADEONEnt->PortInfo[1]->DDCType = DDC_DVI;
-        }
-    }
-
-    /* always make TMDS_INT port first*/
-    if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) {
-	RADEONSwapOutputs(pScrn);
-    } else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
-                pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
-        /* no TMDS_INT port, make primary DAC port first */
-	/* On my Inspiron 8600 both internal and external ports are
-	   marked DAC_PRIMARY in BIOS. So be extra careful - only
-	   swap when the first port is not DAC_PRIMARY */
-        if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) &&  (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
-	     (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
-	    RADEONSwapOutputs(pScrn);
-        }
-    }
-
-    if (info->HasSingleDAC) {
-        /* For RS300/RS350/RS400 chips, there is no primary DAC. Force VGA port to use TVDAC*/
-        if (pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_CRT) {
-            pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
-            pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
-        } else {
-            pRADEONEnt->PortInfo[1]->DACType = DAC_TVDAC;
-            pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY;
-        }
-    } else if (!pRADEONEnt->HasCRTC2) {
-        pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY;
-    }
-
-    /*
-     * MonitorLayout option takes a string for two monitors connected in following format:
-     * Option "MonitorLayout" "primary-port-display, secondary-port-display"
-     * primary and secondary port displays can have one of following:
-     *    NONE, CRT, LVDS, TMDS
-     * With this option, driver will bring up monitors as specified,
-     * not using auto-detection routines to probe monitors.
-     *
-     * This option can be used when the false monitor detection occurs.
-     *
-     * This option can also be used to disable one connected display.
-     * For example, if you have a laptop connected to an external CRT
-     * and you want to disable the internal LCD panel, you can specify
-     * Option "MonitorLayout" "NONE, CRT"
-     *
-     * This option can also used to disable Clone mode. One there is only
-     * one monitor is specified, clone mode will be turned off automatically
-     * even you have two monitors connected.
-     *
-     * Another usage of this option is you want to config the server
-     * to start up with a certain monitor arrangement even one monitor
-     * is not plugged in when server starts.
-     * For example, you can config your laptop with 
-     * Option "MonitorLayout" "LVDS, CRT"
-     * Option "CloneHSync" "40-150"
-     * Option "CloneVRefresh" "60-120"
-     * With these options, you can connect in your CRT monitor later
-     * after the X server has started.
-     */
-    if ((s = xf86GetOptValString(info->Options, OPTION_MONITOR_LAYOUT))) {
-        char s1[5], s2[5];
-        i = 0;
-        /* When using user specified monitor types, we will not do DDC detection
-         *
-         */
-        do {
-            switch(*s) {
-            case ',':
-                s1[i] = '\0';
-                i = 0;
-                second = 1;
-                break;
-            case ' ':
-            case '\t':
-            case '\n':
-            case '\r':
-                break;
-            default:
-                if (second)
-                    s2[i] = *s;
-                else
-                    s1[i] = *s;
-                i++;
-                break;
-            }
-            if (i > 4) i = 4;
-        } while(*s++);
-        s2[i] = '\0';
-
-        for (i = 0; i < max_mt; i++)
-        {
-            if (strcmp(s1, MonTypeName[i]) == 0) 
-            {
-                pRADEONEnt->PortInfo[0]->MonType = MonTypeID[i];
-                break;
-            }
-        }
-        if (i ==  max_mt)
-            xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-                       "Invalid Monitor type specified for 1st port \n"); 
-
-        for (i = 0; i < max_mt; i++)
-        {
-            if (strcmp(s2, MonTypeName[i]) == 0) 
-            {
-                pRADEONEnt->PortInfo[1]->MonType = MonTypeID[i];
-                break;
-            }
-
-        }
-        if (i ==  max_mt)
-            xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-                       "Invalid Monitor type specified for 2nd port \n"); 
-
-	if (i ==  max_mt)
-	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		       "Invalid Monitor type specified for 2nd port \n");
-
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-		   "MonitorLayout Option: \n\tMonitor1--Type %s, Monitor2--Type %s\n\n", s1, s2);
-#if 0
-	if (pRADEONEnt->PortInfo[1]->MonType == MT_CRT) {
-	    pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
-	    pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
-	    pRADEONEnt->PortInfo[1]->DDCType = DDC_VGA;
-	    pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_CRT;
-	    pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
-	    pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
-	    pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED;
-	    pRADEONEnt->PortInfo[0]->ConnectorType = pRADEONEnt->PortInfo[0]->MonType+1;
-	    pRADEONEnt->PortInfo[0]->MonInfo = NULL;
-        }
-#endif
-
-        /* some thinkpads and powerbooks use lvds and internal tmds 
-	 * at the same time.  --AGD
-	 */
-	if ((pRADEONEnt->PortInfo[0]->MonType  == MT_LCD) &&
-	    (pRADEONEnt->PortInfo[1]->MonType == MT_DFP)) {
-	    pRADEONEnt->PortInfo[1]->DDCType = DDC_DVI;
-	    pRADEONEnt->PortInfo[0]->DDCType = DDC_MONID;
-            pRADEONEnt->PortInfo[1]->TMDSType = TMDS_INT;
-            pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_DVI_I;
-            pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
-	}
-    }
-
-#if 1
-    if (info->IsMobility) {
-        pRADEONEnt->PortInfo[2]->DDCType = DDC_DVI;
-        pRADEONEnt->PortInfo[2]->TMDSType = TMDS_INT;
-        pRADEONEnt->PortInfo[2]->ConnectorType = CONNECTOR_DVI_D;
-        pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
-	if (pRADEONEnt->PortInfo[0]->DDCType == DDC_DVI) {
-	    pRADEONEnt->PortInfo[0]->DDCType = DDC_MONID;
-	}
-	if (pRADEONEnt->PortInfo[0]->TMDSType == TMDS_INT) {
-	    pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
-	}
-    }
-#endif
-
-    //    for (i = 0; i < xf86_config->num_output; i++) {
-    for (i = 0 ; i < info->max_connectors; i++) {
-	RADEONOutputPrivatePtr radeon_output = pRADEONEnt->PortInfo[i];
-
-	int DDCReg = 0;
-	char *names[] = { "DDC1", "DDC2", "DDC3" };
-
-	RADEONSetOutputType(pScrn, radeon_output);
-
-	pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]);
-	if (!pRADEONEnt->pOutput[i])
-	    return FALSE;
-	
-	pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i];
-	pRADEONEnt->PortInfo[i]->num = i;
-
-	pRADEONEnt->pOutput[i]->possible_crtcs = 1;
-	if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS)
- 	    pRADEONEnt->pOutput[i]->possible_crtcs |= 2;
-
-	pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/;
-
-	switch(radeon_output->DDCType) {
-	case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break;
-	case DDC_DVI  : DDCReg = RADEON_GPIO_DVI_DDC; break;
-	case DDC_VGA: DDCReg = RADEON_GPIO_VGA_DDC; break;
-	case DDC_CRT2: DDCReg = RADEON_GPIO_CRT2_DDC; break;
-	default: break;
-	}
-
-	if (DDCReg) {
-	    radeon_output->DDCReg = DDCReg;
-	    RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, names[i]);
-	}
-
-	if (radeon_output->type == OUTPUT_LVDS) {
-	    RADEONGetLVDSInfo(output);
-	}
-
-	if (radeon_output->type == OUTPUT_DVI) {
-	    RADEONGetTMDSInfo(output);
-
-	    if (i == 0)
-		RADEONGetHardCodedEDIDFromBIOS(output);
-
-	    /*RADEONUpdatePanelSize(output);*/
-	}
-
-	if (radeon_output->DACType == DAC_TVDAC) {
-	    RADEONGetTVDacAdjInfo(output);
-	}
-    }
-}
-#endif
 
 static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, xf86OutputPtr output)
 {
@@ -1266,6 +997,7 @@ void RADEONConnectorFindMonitor(ScrnInfo
     }
 }
 
+#if 0
 void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn)
 {
 
@@ -1362,6 +1094,7 @@ void RADEONQueryConnectedDisplays(ScrnIn
 
     return;
 }
+#endif
 
 Bool RADEONMapControllers(ScrnInfoPtr pScrn)
 {
@@ -2330,7 +2063,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
     switch (radeon_crtc->crtc_id) {
     case 0:
 	ErrorF("init crtc1\n");
-	RADEONInitCrtcRegisters(pScrn, &info->ModeReg, adjusted_mode, info);
+	RADEONInitCrtcRegisters(crtc, &info->ModeReg, adjusted_mode, info);
         dot_clock = adjusted_mode->Clock / 1000.0;
         if (dot_clock) {
 	    ErrorF("init pll1\n");
@@ -2343,7 +2076,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
 	break;
     case 1:
 	ErrorF("init crtc2\n");
-        RADEONInitCrtc2Registers(pScrn, &info->ModeReg, adjusted_mode, info);
+        RADEONInitCrtc2Registers(crtc, &info->ModeReg, adjusted_mode, info);
         dot_clock = adjusted_mode->Clock / 1000.0;
         if (dot_clock) {
 	    ErrorF("init pll2\n");
@@ -2684,6 +2417,7 @@ Bool RADEONAllocateControllers(ScrnInfoP
     return TRUE;
 }
 
+#if 0
 Bool RADEONAllocatePortInfo(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr      info = RADEONPTR(pScrn);
@@ -2711,6 +2445,7 @@ Bool RADEONAllocatePortInfo(ScrnInfoPtr 
     }
     return TRUE;
 }
+#endif
 
 void RADEONSetOutputType(ScrnInfoPtr pScrn, RADEONOutputPrivatePtr radeon_output)
 {
@@ -2747,113 +2482,133 @@ void RADEONSetOutputType(ScrnInfoPtr pSc
     radeon_output->type = output;
 }
 
-Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
+void RADEONInitConnector(xf86OutputPtr output)
 {
-    RADEONInfoPtr      info = RADEONPTR(pScrn);
-    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
-    int i;
+    ScrnInfoPtr	    pScrn = output->scrn;
+    RADEONOutputPrivatePtr radeon_output = output->driver_private;
+    int DDCReg = 0;
+    char* name = "DDC Bus";//OutputType[radeon_output->type];
 
-    if (pRADEONEnt->pOutput[0])
-        return TRUE;
+    switch(radeon_output->DDCType) {
+    case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break;
+    case DDC_DVI  : DDCReg = RADEON_GPIO_DVI_DDC; break;
+    case DDC_VGA: DDCReg = RADEON_GPIO_VGA_DDC; break;
+    case DDC_CRT2: DDCReg = RADEON_GPIO_CRT2_DDC; break;
+    default: break;
+    }
+    
+    if (DDCReg) {
+	radeon_output->DDCReg = DDCReg;
+	RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, name);
+    }
 
-    /* for now always allocate max connectors */
-    for (i = 0 ; i < info->max_connectors; i++) {
+    if (radeon_output->type == OUTPUT_LVDS) {
+	RADEONGetLVDSInfo(output);
+    }
 
-	pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]);
-	if (!pRADEONEnt->pOutput[i])
-	    return FALSE;
-	
-	pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i];
-	pRADEONEnt->PortInfo[i]->num = i;
+    if (radeon_output->type == OUTPUT_DVI) {
+	RADEONGetTMDSInfo(output);
 
-	pRADEONEnt->pOutput[i]->possible_crtcs = 1;
-	if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS)
- 	    pRADEONEnt->pOutput[i]->possible_crtcs |= 2;
+	// FIXME
+	/*if (i == 0)
+	  RADEONGetHardCodedEDIDFromBIOS(output);*/
 
-	pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/;
+	/*RADEONUpdatePanelSize(output);*/
+    }
+
+    if (radeon_output->DACType == DAC_TVDAC) {
+	RADEONGetTVDacAdjInfo(output);
     }
 
-    return TRUE;
 }
 
 /*
  * initialise the static data sos we don't have to re-do at randr change */
-void RADEONSetupConnectors(ScrnInfoPtr pScrn)
+Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info       = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt  = RADEONEntPriv(pScrn);
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     xf86OutputPtr output;
     const char *s;
     int i = 0, second = 0, max_mt = 5;
 
+
     /* We first get the information about all connectors from BIOS.
      * This is how the card is phyiscally wired up.
      * The information should be correct even on a OEM card.
      * If not, we may have problem -- need to use MonitorLayout option.
      */
-    for (i = 0; i < info->max_connectors; i++) {
-	pRADEONEnt->PortInfo[i]->MonType = MT_UNKNOWN;
-	pRADEONEnt->PortInfo[i]->DDCType = DDC_NONE_DETECTED;
-	pRADEONEnt->PortInfo[i]->DACType = DAC_UNKNOWN;
-	pRADEONEnt->PortInfo[i]->TMDSType = TMDS_UNKNOWN;
-	pRADEONEnt->PortInfo[i]->ConnectorType = CONNECTOR_NONE;
+    for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
+	info->BiosConnector[i].DDCType = DDC_NONE_DETECTED;
+	info->BiosConnector[i].DACType = DAC_UNKNOWN;
+	info->BiosConnector[i].TMDSType = TMDS_UNKNOWN;
+	info->BiosConnector[i].ConnectorType = CONNECTOR_NONE;
     }
 
     if (!RADEONGetConnectorInfoFromBIOS(pScrn) ||
-        ((pRADEONEnt->PortInfo[0]->DDCType == 0) &&
-        (pRADEONEnt->PortInfo[1]->DDCType == 0))) {
-	/* Below is the most common setting, but may not be true */
-	pRADEONEnt->PortInfo[0]->MonType = MT_UNKNOWN;
-	pRADEONEnt->PortInfo[0]->DDCType = DDC_DVI;
-	pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
-	pRADEONEnt->PortInfo[0]->TMDSType = TMDS_INT;
-	pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_DVI_I;
-
-	pRADEONEnt->PortInfo[1]->MonType = MT_UNKNOWN;
-	pRADEONEnt->PortInfo[1]->DDCType = DDC_VGA;
-	pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
-	pRADEONEnt->PortInfo[1]->TMDSType = TMDS_EXT;
-	pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_CRT;
-
+        ((info->BiosConnector[0].DDCType == 0) &&
+        (info->BiosConnector[1].DDCType == 0))) {
+	if (info->IsMobility) {
+	    /* Below is the most common setting, but may not be true */
+	    info->BiosConnector[0].DDCType = DDC_LCD;
+	    info->BiosConnector[0].DACType = DAC_UNKNOWN;
+	    info->BiosConnector[0].TMDSType = TMDS_UNKNOWN;
+	    info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY;
+
+	    info->BiosConnector[1].DDCType = DDC_VGA;
+	    info->BiosConnector[1].DACType = DAC_PRIMARY;
+	    info->BiosConnector[1].TMDSType = TMDS_EXT;
+	    info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
+	} else {
+	    /* Below is the most common setting, but may not be true */
+	    info->BiosConnector[0].DDCType = DDC_DVI;
+	    info->BiosConnector[0].DACType = DAC_TVDAC;
+	    info->BiosConnector[0].TMDSType = TMDS_INT;
+	    info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_I;
+
+	    info->BiosConnector[1].DDCType = DDC_VGA;
+	    info->BiosConnector[1].DACType = DAC_PRIMARY;
+	    info->BiosConnector[1].TMDSType = TMDS_EXT;
+	    info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
+	}
 
        /* Some cards have the DDC lines swapped and we have no way to
         * detect it yet (Mac cards)
         */
        if (xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DDC, FALSE)) {
-           pRADEONEnt->PortInfo[0]->DDCType = DDC_VGA;
-           pRADEONEnt->PortInfo[1]->DDCType = DDC_DVI;
+           info->BiosConnector[0].DDCType = DDC_VGA;
+           info->BiosConnector[1].DDCType = DDC_DVI;
         }
     }
 
     /* always make TMDS_INT port first*/
-    if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) {
+    if (info->BiosConnector[1].TMDSType == TMDS_INT) {
 	RADEONSwapOutputs(pScrn);
-    } else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
-                pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
+    } else if ((info->BiosConnector[0].TMDSType != TMDS_INT &&
+                info->BiosConnector[1].TMDSType != TMDS_INT)) {
         /* no TMDS_INT port, make primary DAC port first */
 	/* On my Inspiron 8600 both internal and external ports are
 	   marked DAC_PRIMARY in BIOS. So be extra careful - only
 	   swap when the first port is not DAC_PRIMARY */
-        if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) &&  (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
-	     (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
+        if ((!(info->BiosConnector[0].ConnectorType == CONNECTOR_PROPRIETARY)) &&  (info->BiosConnector[1].DACType == DAC_PRIMARY) &&
+	     (info->BiosConnector[0].DACType != DAC_PRIMARY)) {
 	    RADEONSwapOutputs(pScrn);
         }
     }
 
     if (info->HasSingleDAC) {
         /* For RS300/RS350/RS400 chips, there is no primary DAC. Force VGA port to use TVDAC*/
-        if (pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_CRT) {
-            pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
-            pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
+        if (info->BiosConnector[0].ConnectorType == CONNECTOR_CRT) {
+            info->BiosConnector[0].DACType = DAC_TVDAC;
+            info->BiosConnector[1].DACType = DAC_PRIMARY;
         } else {
-            pRADEONEnt->PortInfo[1]->DACType = DAC_TVDAC;
-            pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY;
+            info->BiosConnector[1].DACType = DAC_TVDAC;
+            info->BiosConnector[0].DACType = DAC_PRIMARY;
         }
     } else if (!pRADEONEnt->HasCRTC2) {
-        pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY;
+        info->BiosConnector[0].DACType = DAC_PRIMARY;
     }
-
+#if 0
     /*
      * MonitorLayout option takes a string for two monitors connected in following format:
      * Option "MonitorLayout" "primary-port-display, secondary-port-display"
@@ -2971,7 +2726,6 @@ void RADEONSetupConnectors(ScrnInfoPtr p
 	}
     }
 
-#if 1
     if (info->IsMobility) {
         pRADEONEnt->PortInfo[2]->DDCType = DDC_DVI;
         pRADEONEnt->PortInfo[2]->TMDSType = TMDS_INT;
@@ -2986,61 +2740,117 @@ void RADEONSetupConnectors(ScrnInfoPtr p
     }
 #endif
 
-    //    for (i = 0; i < xf86_config->num_output; i++) {
-    for (i = 0 ; i < info->max_connectors; i++) {
-	RADEONOutputPrivatePtr radeon_output = pRADEONEnt->PortInfo[i];
-
-	int DDCReg = 0;
-	char *names[] = { "DDC1", "DDC2", "DDC3" };
-
+    for (i = 0 ; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
+	RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1);
+	if (!radeon_output) {
+	    return FALSE;
+	}
+	radeon_output->MonType = MT_UNKNOWN;
+	radeon_output->DDCType = info->BiosConnector[i].DDCType;
+	radeon_output->DACType = info->BiosConnector[i].DACType;
+	radeon_output->TMDSType = info->BiosConnector[i].TMDSType;
+	radeon_output->ConnectorType = info->BiosConnector[i].ConnectorType;
 	RADEONSetOutputType(pScrn, radeon_output);
+	output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]);
+	if (!output) {
+	    return FALSE;
+	}
+	output->driver_private = radeon_output;
+	output->possible_crtcs = 1;
+	if (radeon_output->type != OUTPUT_LVDS)
+ 	    output->possible_crtcs |= 2;
 
-	pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]);
-	/*if (!pRADEONEnt->pOutput[i])
-	  return FALSE;*/
-	
-	pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i];
-	pRADEONEnt->PortInfo[i]->num = i;
+	output->possible_clones = 0 /*1|2*/;
 
-	pRADEONEnt->pOutput[i]->possible_crtcs = 1;
-	if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS)
- 	    pRADEONEnt->pOutput[i]->possible_crtcs |= 2;
+	RADEONInitConnector(output);
+    }
 
-	pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/;
+    /* if it's a mobility make sure we have a LVDS port */
+    if (info->IsMobility) {
+	if (info->IsAtomBios) {
+	    if (info->BiosConnector[0].ConnectorType != CONNECTOR_LVDS_ATOM &&
+		info->BiosConnector[1].ConnectorType != CONNECTOR_LVDS_ATOM) {
+		/* add LVDS port */
+		RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1);
+		if (!radeon_output) {
+		    return FALSE;
+		}
+		radeon_output->MonType = MT_UNKNOWN;
+		radeon_output->DDCType = DDC_LCD;
+		radeon_output->DACType = DAC_UNKNOWN;
+		radeon_output->TMDSType = TMDS_UNKNOWN;
+		radeon_output->ConnectorType = CONNECTOR_LVDS_ATOM;
+		RADEONSetOutputType(pScrn, radeon_output);
+		output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]);
+		if (!output) {
+		    return FALSE;
+		}
+		output->driver_private = radeon_output;
+		output->possible_crtcs = 1;
+		output->possible_clones = 0 /*1|2*/;
 
-	output = pRADEONEnt->pOutput[i];
+		RADEONInitConnector(output);
 
-	switch(radeon_output->DDCType) {
-	case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break;
-	case DDC_DVI  : DDCReg = RADEON_GPIO_DVI_DDC; break;
-	case DDC_VGA: DDCReg = RADEON_GPIO_VGA_DDC; break;
-	case DDC_CRT2: DDCReg = RADEON_GPIO_CRT2_DDC; break;
-	default: break;
-	}
+	    }
+	} else {
+	    if (info->BiosConnector[0].ConnectorType != CONNECTOR_PROPRIETARY &&
+		info->BiosConnector[1].ConnectorType != CONNECTOR_PROPRIETARY) {
+		/* add LVDS port */
+		RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1);
+		if (!radeon_output) {
+		    return FALSE;
+		}
+		radeon_output->MonType = MT_UNKNOWN;
+		radeon_output->DDCType = DDC_LCD;
+		radeon_output->DACType = DAC_UNKNOWN;
+		radeon_output->TMDSType = TMDS_UNKNOWN;
+		radeon_output->ConnectorType = CONNECTOR_PROPRIETARY;
+		RADEONSetOutputType(pScrn, radeon_output);
+		output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]);
+		if (!output) {
+		    return FALSE;
+		}
+		output->driver_private = radeon_output;
+		output->possible_crtcs = 1;
+		output->possible_clones = 0 /*1|2*/;
 
-	if (DDCReg) {
-	    radeon_output->DDCReg = DDCReg;
-	    RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, names[i]);
+		RADEONInitConnector(output);
+	    }
 	}
+    }
+    return TRUE;
+}
 
-	if (radeon_output->type == OUTPUT_LVDS) {
-	    RADEONGetLVDSInfo(output);
-	}
+#if 0
+Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr      info = RADEONPTR(pScrn);
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+    int i;
+
+    if (pRADEONEnt->pOutput[0])
+        return TRUE;
 
-	if (radeon_output->type == OUTPUT_DVI) {
-	    RADEONGetTMDSInfo(output);
+    /* for now always allocate max connectors */
+    for (i = 0 ; i < info->max_connectors; i++) {
 
-	    if (i == 0)
-		RADEONGetHardCodedEDIDFromBIOS(output);
+	pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]);
+	if (!pRADEONEnt->pOutput[i])
+	    return FALSE;
+	
+	pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i];
+	pRADEONEnt->PortInfo[i]->num = i;
 
-	    /*RADEONUpdatePanelSize(output);*/
-	}
+	pRADEONEnt->pOutput[i]->possible_crtcs = 1;
+	if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS)
+ 	    pRADEONEnt->pOutput[i]->possible_crtcs |= 2;
 
-	if (radeon_output->DACType == DAC_TVDAC) {
-	    RADEONGetTVDacAdjInfo(output);
-	}
+	pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/;
     }
+
+    return TRUE;
 }
+#endif
 
 #if 0
 xf86OutputPtr RADEONGetCrtcConnector(ScrnInfoPtr pScrn, int crtc_num)
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index d5cd60e..a261d0d 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -117,7 +117,7 @@ static Bool RADEONCloseScreen(int scrnIn
 static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode);
 static void RADEONSave(ScrnInfoPtr pScrn);
 //static void RADEONRestore(ScrnInfoPtr pScrn);
-static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+//static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
 
 static void RADEONSetDynamicClock(ScrnInfoPtr pScrn, int mode);
 static void RADEONForceSomeClocks(ScrnInfoPtr pScrn);
@@ -2528,28 +2528,20 @@ static Bool RADEONPreInitControllers(Scr
 
     if (!info->IsSecondary) {
       
-      if (!RADEONAllocatePortInfo(pScrn))
-	return FALSE;
-
       if (!RADEONAllocateControllers(pScrn))
 	  return FALSE;
     }
 
-    /*    if (!info->IsSecondary) {
-      if (!RADEONAllocateConnectors(pScrn))
-	return FALSE;
-	}*/
-
     RADEONGetBIOSInfo(pScrn, pInt10);
 
-    RADEONSetupConnectors(pScrn);
+    if (!RADEONSetupConnectors(pScrn)) {
+	return FALSE;
+    }
 
       
     RADEONMapControllers(pScrn);
 
     RADEONGetClockInfo(pScrn);
-    /*    RADEONGetPanelInfo(pScrn);
-	  RADEONGetTVDacAdjInfo(pScrn);*/
 
     for (i = 0; i < config->num_output; i++) 
     {
@@ -4638,21 +4630,23 @@ void RADEONChangeSurfaces(ScrnInfoPtr pS
     RADEONSaveSurfaces(pScrn, &info->ModeReg);
 }
 
+// hack, but it's going away soon
 void
 RADEONEnableOutputs(ScrnInfoPtr pScrn, int crtc_num)
 {
     RADEONInfoPtr      info = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    xf86CrtcPtr crtc = pRADEONEnt->pCrtc[0];
     int i;
-    xf86OutputPtr output;
 
-    for (i = 0; i < info->max_connectors; i++) {
-        if (pRADEONEnt->PortInfo[i]->crtc_num == crtc_num) {
-	    output = pRADEONEnt->pOutput[i];
-            RADEONEnableDisplay(pScrn, output, TRUE);
-        }
+    /* get the output connected to this CRTC */
+    for (i = 0; i < xf86_config->num_output; i++) {
+	xf86OutputPtr output = xf86_config->output[i];
+	if (output->crtc == crtc) {
+	    RADEONEnableDisplay(pScrn, output, TRUE);
+	}
     }
-
 }
 
 /* Write out state to define a new video mode */
@@ -4702,7 +4696,7 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
 	    RADEONRestorePLL2Registers(pScrn, restore);
 	    RADEONRestoreFPRegisters(pScrn, restore);
 	    RADEONRestoreDACRegisters(pScrn, restore);
-	    RADEONEnableOuputs(pScrn, 2);
+	    RADEONEnableOutputs(pScrn, 2);
 	} else {
 	    RADEONRestoreMemMapRegisters(pScrn, restore);
 	    RADEONRestoreCommonRegisters(pScrn, restore);
@@ -4715,9 +4709,9 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
             RADEONRestorePLLRegisters(pScrn, restore);
 	    RADEONRestoreFPRegisters(pScrn, restore);
 	    RADEONRestoreDACRegisters(pScrn, restore);
-	    RADEONEnableOuputs(pScrn, 1);
+	    RADEONEnableOutputs(pScrn, 1);
 	    if (pCRTC2->binding == 1) {
-	      RADEONEnableOuputs(pScrn, 2);
+	      RADEONEnableOutputs(pScrn, 2);
 	    }
 	}
     } else {
@@ -5454,15 +5448,18 @@ static void RADEONInitOutputRegisters(Sc
 }
 
 /* Define CRTC registers for requested video mode */
-Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
+Bool RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save,
 				  DisplayModePtr mode, RADEONInfoPtr info)
 {
+    ScrnInfoPtr pScrn = crtc->scrn;
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     int    format;
     int    hsync_start;
     int    hsync_wid;
     int    vsync_wid;
     int i;
-    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
 
 
     switch (info->CurrentLayout.pixel_code) {
@@ -5599,19 +5596,12 @@ Bool RADEONInitCrtcRegisters(ScrnInfoPtr
     }
 
     /* get the output connected to this CRTC */
-    for (i = 0; i < info->max_connectors; i++) {
-      if (pRADEONEnt->PortInfo[i]->crtc_num == 1) {
-	ErrorF("init output for crtc1\n");
-        RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[i], 1);
-      }
-    }
-#if 0
-    if (pRADEONEnt->PortInfo[0]->crtc_num == 1) {
-	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[0], 1);
-    } else if (pRADEONEnt->PortInfo[1]->crtc_num == 1) {
-	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[1], 1);
+    for (i = 0; i < xf86_config->num_output; i++) {
+	xf86OutputPtr output = xf86_config->output[i];
+	if (output->crtc == crtc) {
+	    RADEONInitOutputRegisters(pScrn, save, mode, output, 1);
+	}
     }
-#endif
 
     if (info->IsDellServer) {
 	save->dac2_cntl = info->SavedReg.dac2_cntl;
@@ -5634,19 +5624,18 @@ Bool RADEONInitCrtcRegisters(ScrnInfoPtr
 }
 
 /* Define CRTC2 registers for requested video mode */
-Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save,
+Bool RADEONInitCrtc2Registers(xf86CrtcPtr crtc, RADEONSavePtr save,
 				     DisplayModePtr mode, RADEONInfoPtr info)
 {
+    ScrnInfoPtr pScrn = crtc->scrn;
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     int    format;
     int    hsync_start;
     int    hsync_wid;
     int    vsync_wid;
     int i;
-    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
-    RADEONInfoPtr info0 = NULL;
-
-    if (info->IsSecondary)
-	info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn);
 
     switch (info->CurrentLayout.pixel_code) {
     case 4:  format = 1; break;
@@ -5739,19 +5728,12 @@ Bool RADEONInitCrtc2Registers(ScrnInfoPt
     save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid;
 
     /* get the output connected to this CRTC */
-    for (i = 0; i < info->max_connectors; i++) {
-      if (pRADEONEnt->PortInfo[i]->crtc_num == 2) {
-	ErrorF("init output for crtc2\n");
-        RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[i], 2);
-      }
-    }
-#if 0
-    if (pRADEONEnt->PortInfo[0]->crtc_num == 2) {
-	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[0], 2);
-    } else if (pRADEONEnt->PortInfo[1]->crtc_num == 2) {
-	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[1], 2);
+    for (i = 0; i < xf86_config->num_output; i++) {
+	xf86OutputPtr output = xf86_config->output[i];
+	if (output->crtc == crtc) {
+	    RADEONInitOutputRegisters(pScrn, save, mode, output, 2);
+	}
     }
-#endif
 
     /* We must set SURFACE_CNTL properly on the second screen too */
     save->surface_cntl = 0;
@@ -5925,6 +5907,7 @@ static void RADEONInitPalette(RADEONSave
 }
 #endif
 
+#if 0
 /* Define registers for a requested video mode */
 Bool RADEONInit2(ScrnInfoPtr pScrn, DisplayModePtr crtc1,
 		 DisplayModePtr crtc2, int crtc_mask,
@@ -6095,6 +6078,7 @@ static Bool RADEONModeInit(ScrnInfoPtr p
 
     return TRUE;
 }
+#endif
 
 static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode)
 {
@@ -6177,7 +6161,7 @@ Bool RADEONSwitchMode(int scrnIndex, Dis
 	RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg);
     } else {
 	info->IsSwitching = TRUE;
-	ret = RADEONModeInit(xf86Screens[scrnIndex], mode);
+	ret = TRUE; //RADEONModeInit(xf86Screens[scrnIndex], mode);
 	info->IsSwitching = FALSE;
     }
 
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 9a4a52d..3e18b05 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -132,6 +132,13 @@ typedef struct _RADEONCrtcPrivateRec {
     Bool              UseBiosDividers;
 } RADEONCrtcPrivateRec, *RADEONCrtcPrivatePtr;
 
+typedef struct {
+    RADEONDDCType DDCType;
+    RADEONDacType DACType;
+    RADEONTmdsType TMDSType;
+    RADEONConnectorType ConnectorType;
+} RADEONBIOSConnector;
+
 typedef struct _RADEONOutputPrivateRec {
     int num;
     RADEONOutputType type;
@@ -160,8 +167,8 @@ typedef struct _RADEONOutputPrivateRec {
     RADEONTMDSPll     tmds_pll[4];
 } RADEONOutputPrivateRec, *RADEONOutputPrivatePtr;
 
-#define RADEON_MAX_CONNECTOR 3 /* actually 4: DVI/VGA, DVI on docks, TV, LVDS */
 #define RADEON_MAX_CRTC 2
+#define RADEON_MAX_BIOS_CONNECTOR 2
 
 typedef struct
 {
@@ -179,9 +186,6 @@ typedef struct
 
     Bool ReversedDAC;	  /* TVDAC used as primary dac */
     Bool ReversedTMDS;    /* DDC_DVI is used for external TMDS */
-    xf86OutputPtr pOutput[RADEON_MAX_CONNECTOR];
-    RADEONOutputPrivatePtr PortInfo[RADEON_MAX_CONNECTOR];
-
     xf86CrtcPtr pCrtc[RADEON_MAX_CRTC];
     RADEONCrtcPrivatePtr Controller[RADEON_MAX_CRTC];
 


More information about the xorg-commit mailing list