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

Alex Deucher agd5f at kemper.freedesktop.org
Sun May 13 21:44:17 PDT 2007


 src/radeon.h         |    3 
 src/radeon_display.c |   16 --
 src/radeon_driver.c  |  333 ++++++++++++++-------------------------------------
 src/radeon_probe.h   |    3 
 src/radeon_video.c   |   14 --
 5 files changed, 101 insertions(+), 268 deletions(-)

New commits:
diff-tree 5106c8fe5f74865cac8b00937739a4efde9fc254 (from 224a73e41e9be344d5644203e7ebd5a3a8272604)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 21:48:26 2007 -0400

    RADEON: Further cleanup

diff --git a/src/radeon.h b/src/radeon.h
index 2a2a672..e0b4b9b 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -407,9 +407,6 @@ typedef struct {
     Bool              IsMobility;       /* Mobile chips for laptops */
     Bool              IsIGP;            /* IGP chips */
     Bool              HasSingleDAC;     /* only TVDAC on chip */
-    Bool              IsSecondary;      /* Second Screen                     */
-    Bool	      IsPrimary;        /* Primary Screen */
-    Bool              IsSwitching;      /* Flag for switching mode           */
     Bool              OverlayOnCRTC2;
     Bool              ddc_mode;         /* Validate mode by matching exactly
 					 * the modes supported in DDC data
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index b2b23bc..c82c6ba 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2551,7 +2551,6 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr
     if (!RADEONGetRec(pScrn)) return FALSE;
 
     info               = RADEONPTR(pScrn);
-    info->IsSwitching  = FALSE;
     info->MMIO         = NULL;
 
     info->pEnt         = xf86GetEntityInfo(pScrn->entityList[pScrn->numEntities - 1]);
@@ -3971,7 +3970,6 @@ void RADEONRestoreCommonRegisters(ScrnIn
      * CRT are connected.
      */
     if (pRADEONEnt->HasCRTC2 &&
-	!info->IsSwitching &&
 	info->ChipFamily != CHIP_FAMILY_R200 &&
 	!IS_R300_VARIANT) {
 	CARD32        tmp;
@@ -4598,8 +4596,7 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
     /* Disable all outputs at initial mode set.  the ones we want will
        get set by RADEONEnableDisplay()
      */
-    if (!info->IsSwitching)
-        RADEONDisableDisplays(pScrn);
+    RADEONDisableDisplays(pScrn);
 
     /* When changing mode with Dual-head card, care must be taken for
      * the special order in setting registers. CRTC2 has to be set
@@ -4613,40 +4610,22 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
      * We always restore MemMap first, the saverec should be up to date
      * in all cases
      */
-    if (info->IsSwitching) {
-	RADEONRestoreMemMapRegisters(pScrn, restore);
-	RADEONRestoreCommonRegisters(pScrn, restore);
-	if (pCRTC2->binding == 1) {
-	    RADEONRestoreCrtc2Registers(pScrn, restore);
-	    RADEONRestorePLL2Registers(pScrn, restore);
-	}
+    RADEONRestoreMemMapRegisters(pScrn, restore);
+    RADEONRestoreCommonRegisters(pScrn, restore);
+    if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
+	RADEONRestoreCrtc2Registers(pScrn, restore);
+	RADEONRestorePLL2Registers(pScrn, restore);
+    }
+
+    RADEONRestoreCrtcRegisters(pScrn, restore);
+    RADEONRestorePLLRegisters(pScrn, restore);
+    RADEONRestoreFPRegisters(pScrn, restore);
+    RADEONRestoreDACRegisters(pScrn, restore);
 
-	RADEONRestoreCrtcRegisters(pScrn, restore);
-	RADEONRestorePLLRegisters(pScrn, restore);
-	RADEONRestoreFPRegisters(pScrn, restore);
-	RADEONRestoreDACRegisters(pScrn, restore);
-	RADEONEnableOutputs(pScrn, 0);
-	if (pCRTC2->binding == 1) {
-	    RADEONEnableOutputs(pScrn, 1);
-	}
-    } else {
-	RADEONRestoreMemMapRegisters(pScrn, restore);
-	RADEONRestoreCommonRegisters(pScrn, restore);
-	if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
-	    RADEONRestoreCrtc2Registers(pScrn, restore);
-	    RADEONRestorePLL2Registers(pScrn, restore);
-	}
-
-	RADEONRestoreCrtcRegisters(pScrn, restore);
-	RADEONRestorePLLRegisters(pScrn, restore);
-	RADEONRestoreFPRegisters(pScrn, restore);
-	RADEONRestoreDACRegisters(pScrn, restore);
-
-	RADEONEnableOutputs(pScrn, 0);
+    RADEONEnableOutputs(pScrn, 0);
 
-	if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
-	    RADEONEnableOutputs(pScrn, 1);
-	}
+    if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
+	RADEONEnableOutputs(pScrn, 1);
     }
 
 #if 0
@@ -5475,6 +5454,7 @@ Bool RADEONInitCrtcRegisters(xf86CrtcPtr
     save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
     save->fp_crtc_v_total_disp = save->crtc_v_total_disp;
 
+#if 0
     /* Set following registers for all cases first, if a DFP/LCD is connected on
        internal TMDS/LVDS port, they will be set by RADEONInitFPRegister
     */
@@ -5486,6 +5466,7 @@ Bool RADEONInitCrtcRegisters(xf86CrtcPtr
 				  (RADEON_HORZ_FP_LOOP_STRETCH |
 				  RADEON_HORZ_AUTO_RATIO_INC);
     }
+#endif
 
     /* get the output connected to this CRTC */
     for (i = 0; i < xf86_config->num_output; i++) {
@@ -6025,9 +6006,7 @@ Bool RADEONSwitchMode(int scrnIndex, Dis
 
 	RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg);
     } else {
-	info->IsSwitching = TRUE;
 	ret = xf86SetSingleMode (pScrn, mode, RR_Rotate_0);
-	info->IsSwitching = FALSE;
     }
 
     if (info->tilingEnabled != tilingOld) {
diff-tree 224a73e41e9be344d5644203e7ebd5a3a8272604 (from 9c2f20a83a5fed14225f4c3ebcd8ca41e9d4bd48)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 21:41:59 2007 -0400

    RADEON: remove remnants of "old" multi-head support
    
    The old screen based multi-head code is broken at this point
    and I have no intention of fixing it, so to clean things up
    I've removed it.

diff --git a/src/radeon_display.c b/src/radeon_display.c
index c5caf9c..c3167bc 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1404,22 +1404,10 @@ void RADEONInitDispBandwidth(ScrnInfoPtr
     xf86CrtcPtr crtc;
     int pixel_bytes2 = 0;
 
-    if (pRADEONEnt->pSecondaryScrn) {
-	if (info->IsSecondary) return;
-	info2 = RADEONPTR(pRADEONEnt->pSecondaryScrn);
-    } else if (pRADEONEnt->Controller[1]->binding == 1) info2 = info;
-
     mode1 = info->CurrentLayout.mode;
-    if ((pRADEONEnt->HasSecondary) && info2) {
-	mode2 = info2->CurrentLayout.mode;
-    } else {
-	mode2 = NULL;
-    }
+    mode2 = NULL;
+    pixel_bytes2 = info->CurrentLayout.pixel_bytes;
 
-    if (info2) 
-      pixel_bytes2 = info2->CurrentLayout.pixel_bytes;
-    
-    
     if (xf86_config->num_crtc == 2) {
       pixel_bytes2 = 0;
       mode2 = NULL;
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index dbbf91f..b2b23bc 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -1427,23 +1427,6 @@ static Bool RADEONPreInitVRAM(ScrnInfoPt
     xf86DrvMsg(pScrn->scrnIndex, from,
 	       "Mapped VideoRAM: %d kByte (%d bit %s SDRAM)\n", pScrn->videoRam, info->RamWidth, info->IsDDR?"DDR":"SDR");
 
-    /* FIXME: For now, split FB into two equal sections. This should
-     * be able to be adjusted by user with a config option. */
-    if (info->IsPrimary) {
-        pScrn->videoRam /= 2;
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
-		"Using %dk of videoram for primary head\n",
-		pScrn->videoRam);
-    }
-
-    if (info->IsSecondary) {  
-        pScrn->videoRam /= 2;
-        info->LinearAddr += pScrn->videoRam * 1024;
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
-		"Using %dk of videoram for secondary head\n",
-		pScrn->videoRam);
-    }
-
     pScrn->videoRam  &= ~1023;
     info->FbMapSize  = pScrn->videoRam * 1024;
 
@@ -2078,18 +2061,6 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr
     info->pLibDRMVersion = NULL;
     info->pKernelDRMVersion = NULL;
 
-    if (xf86IsEntityShared(info->pEnt->index)) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		   "Direct Rendering Disabled -- "
-		   "Dual-head configuration is not working with "
-		   "DRI at present.\n"
-		   "Please use the radeon randr 1.2 support option if you "
-		   "want Dual-head with DRI.\n");
-	return FALSE;
-    }
-    if (info->IsSecondary)
-        return FALSE;
-
     if (info->Chipset == PCI_CHIP_RN50_515E ||
 	info->Chipset == PCI_CHIP_RN50_5969) {
     	if (xf86ReturnOptValBool(info->Options, OPTION_DRI, FALSE)) {
@@ -2312,14 +2283,7 @@ static void RADEONPreInitColorTiling(Scr
     }
 #endif /* XF86DRI */
 
-    if ((info->allowColorTiling) && (info->IsSecondary)) {
-	/* can't have tiling on the 2nd head (as long as it can't use drm).
-	 * We'd never get the surface save/restore (vt switching) right...
-	 */
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Color tiling disabled for 2nd head\n");
-	info->allowColorTiling = FALSE;
-    }
-    else if ((info->allowColorTiling) && (info->FBDev)) {
+    if ((info->allowColorTiling) && (info->FBDev)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		   "Color tiling not supported with UseFBDev option\n");
 	info->allowColorTiling = FALSE;
@@ -2525,11 +2489,8 @@ static Bool RADEONPreInitControllers(Scr
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
     int i;
 
-    if (!info->IsSecondary) {
-      
-      if (!RADEONAllocateControllers(pScrn))
-	  return FALSE;
-    }
+    if (!RADEONAllocateControllers(pScrn))
+	return FALSE;
 
     RADEONGetBIOSInfo(pScrn, pInt10);
 
@@ -2590,8 +2551,6 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr
     if (!RADEONGetRec(pScrn)) return FALSE;
 
     info               = RADEONPTR(pScrn);
-    info->IsSecondary  = FALSE;
-    info->IsPrimary     = FALSE;
     info->IsSwitching  = FALSE;
     info->MMIO         = NULL;
 
@@ -2636,30 +2595,6 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr
     RADEONPreInt10Save(pScrn, &int10_save);
 #endif
 
-    if (xf86IsEntityShared(info->pEnt->index)) {
-	if (xf86IsPrimInitDone(info->pEnt->index)) {
-
-	    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
-
-	    info->IsSecondary = TRUE;
-	    if (!pRADEONEnt->HasSecondary) {
-		xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-			   "Only one monitor detected, Second screen "
-			   "will NOT be created\n");
-		goto fail2;
-	    }
-	    pRADEONEnt->pSecondaryScrn = pScrn;
-	} else {
-	    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
-
-	    info->IsPrimary = TRUE;
-
-	    xf86SetPrimInitDone(info->pEnt->index);
-
-	    pRADEONEnt->pPrimaryScrn        = pScrn;
-	}
-    }
-
     if (flags & PROBE_DETECT) {
 	RADEONProbeDDC(pScrn, info->pEnt->index);
 	RADEONPostInt10Check(pScrn, int10_save);
@@ -2874,10 +2809,6 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr
 
 fail:
 				/* Pre-init failed. */
-    if (info->IsSecondary) {
-        RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
-	pRADEONEnt->HasSecondary = FALSE;
-    }
 				/* Free the video bios (if applicable) */
     if (info->VBIOS) {
 	xfree(info->VBIOS);
@@ -3368,7 +3299,6 @@ Bool RADEONScreenInit(int scrnIndex, Scr
     info->accel        = NULL;
 #endif
     pScrn->fbOffset    = info->frontOffset;
-    if (info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024;
     if (!RADEONMapMem(pScrn)) return FALSE;
 
 #ifdef XF86DRI
@@ -3380,7 +3310,7 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 
     RADEONSave(pScrn);
 
-    if ((!info->IsSecondary) && info->IsMobility) {
+    if (info->IsMobility) {
         if (xf86ReturnOptValBool(info->Options, OPTION_DYNAMIC_CLOCKS, FALSE)) {
 	    RADEONSetDynamicClock(pScrn, 1);
         } else {
@@ -3388,8 +3318,8 @@ Bool RADEONScreenInit(int scrnIndex, Scr
         }
     }
 
-    if ((!info->IsSecondary) && (IS_R300_VARIANT || IS_RV100_VARIANT))
-      RADEONForceSomeClocks(pScrn);
+    if (IS_R300_VARIANT || IS_RV100_VARIANT)
+	RADEONForceSomeClocks(pScrn);
 
     if (info->allowColorTiling && (pScrn->virtualX > info->MaxSurfaceWidth)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -3439,15 +3369,13 @@ Bool RADEONScreenInit(int scrnIndex, Scr
      */
     RADEONInitMemoryMap(pScrn);
 
-    if (!info->IsSecondary) {
-	/* empty the surfaces */
-	unsigned char *RADEONMMIO = info->MMIO;
-	unsigned int i;
-	for (i = 0; i < 8; i++) {
-	    OUTREG(RADEON_SURFACE0_INFO + 16 * i, 0);
-	    OUTREG(RADEON_SURFACE0_LOWER_BOUND + 16 * i, 0);
-	    OUTREG(RADEON_SURFACE0_UPPER_BOUND + 16 * i, 0);
-	}
+    /* empty the surfaces */
+    unsigned char *RADEONMMIO = info->MMIO;
+    unsigned int i;
+    for (i = 0; i < 8; i++) {
+	OUTREG(RADEON_SURFACE0_INFO + 16 * i, 0);
+	OUTREG(RADEON_SURFACE0_LOWER_BOUND + 16 * i, 0);
+	OUTREG(RADEON_SURFACE0_UPPER_BOUND + 16 * i, 0);
     }
 
 #ifdef XF86DRI
@@ -3467,10 +3395,8 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 #endif
 
     /* Initial setup of surfaces */
-    if (!info->IsSecondary) {
-	RADEONTRACE(("Setting up initial surfaces\n"));
-	RADEONChangeSurfaces(pScrn);
-    }
+    RADEONTRACE(("Setting up initial surfaces\n"));
+    RADEONChangeSurfaces(pScrn);
 
 				/* Memory manager setup */
 
@@ -3704,10 +3630,8 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 #endif
 
     /* Make sure surfaces are allright since DRI setup may have changed them */
-    if (!info->IsSecondary) {
-	RADEONTRACE(("Setting up final surfaces\n"));
-	RADEONChangeSurfaces(pScrn);
-    }
+    RADEONTRACE(("Setting up final surfaces\n"));
+    RADEONChangeSurfaces(pScrn);
 
     /* Enable aceleration */
     if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) {
@@ -4614,27 +4538,24 @@ void RADEONChangeSurfaces(ScrnInfoPtr pS
 	unsigned int surf_info = swap_pattern;
 	unsigned char *RADEONMMIO = info->MMIO;
 	/* we don't need anything like WaitForFifo, no? */
-	if (!info->IsSecondary) {
-	    if (info->tilingEnabled) {
-		if (IS_R300_VARIANT)
-		   surf_info |= (width_bytes / 8) | color_pattern;
-		else
-		   surf_info |= (width_bytes / 16) | color_pattern;
-	    }
-	    OUTREG(RADEON_SURFACE0_INFO, surf_info);
-	    OUTREG(RADEON_SURFACE0_LOWER_BOUND, 0);
-	    OUTREG(RADEON_SURFACE0_UPPER_BOUND, bufferSize - 1);
+	if (info->tilingEnabled) {
+	    if (IS_R300_VARIANT)
+		surf_info |= (width_bytes / 8) | color_pattern;
+	    else
+		surf_info |= (width_bytes / 16) | color_pattern;
+	}
+	OUTREG(RADEON_SURFACE0_INFO, surf_info);
+	OUTREG(RADEON_SURFACE0_LOWER_BOUND, 0);
+	OUTREG(RADEON_SURFACE0_UPPER_BOUND, bufferSize - 1);
 /*	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"surface0 set to %x, LB 0x%x UB 0x%x\n",
 		surf_info, 0, bufferSize - 1024);*/
-	}
     }
 
     /* Update surface images */
     RADEONSaveSurfaces(pScrn, &info->ModeReg);
 }
 
-// hack, but it's going away soon
 void
 RADEONEnableOutputs(ScrnInfoPtr pScrn, int crtc_num)
 {
@@ -4677,7 +4598,7 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
     /* Disable all outputs at initial mode set.  the ones we want will
        get set by RADEONEnableDisplay()
      */
-    if (!info->IsSwitching && !info->IsSecondary)
+    if (!info->IsSwitching)
         RADEONDisableDisplays(pScrn);
 
     /* When changing mode with Dual-head card, care must be taken for
@@ -4693,30 +4614,20 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
      * in all cases
      */
     if (info->IsSwitching) {
-	if (info->IsSecondary) {
-	    RADEONRestoreMemMapRegisters(pScrn, restore);
-	    RADEONRestoreCommonRegisters(pScrn, restore);
+	RADEONRestoreMemMapRegisters(pScrn, restore);
+	RADEONRestoreCommonRegisters(pScrn, restore);
+	if (pCRTC2->binding == 1) {
 	    RADEONRestoreCrtc2Registers(pScrn, restore);
 	    RADEONRestorePLL2Registers(pScrn, restore);
-	    RADEONRestoreFPRegisters(pScrn, restore);
-	    RADEONRestoreDACRegisters(pScrn, restore);
-	    RADEONEnableOutputs(pScrn, 1);
-	} else {
-	    RADEONRestoreMemMapRegisters(pScrn, restore);
-	    RADEONRestoreCommonRegisters(pScrn, restore);
-	    if (pCRTC2->binding == 1) {
-		RADEONRestoreCrtc2Registers(pScrn, restore);
-		RADEONRestorePLL2Registers(pScrn, restore);
-	    }
+	}
 
-            RADEONRestoreCrtcRegisters(pScrn, restore);
-            RADEONRestorePLLRegisters(pScrn, restore);
-	    RADEONRestoreFPRegisters(pScrn, restore);
-	    RADEONRestoreDACRegisters(pScrn, restore);
-	    RADEONEnableOutputs(pScrn, 0);
-	    if (pCRTC2->binding == 1) {
-	      RADEONEnableOutputs(pScrn, 1);
-	    }
+	RADEONRestoreCrtcRegisters(pScrn, restore);
+	RADEONRestorePLLRegisters(pScrn, restore);
+	RADEONRestoreFPRegisters(pScrn, restore);
+	RADEONRestoreDACRegisters(pScrn, restore);
+	RADEONEnableOutputs(pScrn, 0);
+	if (pCRTC2->binding == 1) {
+	    RADEONEnableOutputs(pScrn, 1);
 	}
     } else {
 	RADEONRestoreMemMapRegisters(pScrn, restore);
@@ -4730,19 +4641,14 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn
 	RADEONRestorePLLRegisters(pScrn, restore);
 	RADEONRestoreFPRegisters(pScrn, restore);
 	RADEONRestoreDACRegisters(pScrn, restore);
-	ErrorF("finished FP restore\n");
 
 	RADEONEnableOutputs(pScrn, 0);
-	ErrorF("enable output1 done\n");
 
 	if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
 	    RADEONEnableOutputs(pScrn, 1);
-	    ErrorF("enable output2 done\n");
 	}
     }
 
-    ErrorF("finished modeset\n");
-
 #if 0
     RADEONRestorePalette(pScrn, &info->SavedReg);
 #endif
@@ -4959,21 +4865,14 @@ static void RADEONSaveMode(ScrnInfoPtr p
 
     RADEONTRACE(("RADEONSaveMode(%p)\n", save));
 
-    if (info->IsSecondary) {
-        RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
-        RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn);
-        memcpy(&info->SavedReg, &info0->SavedReg, sizeof(RADEONSaveRec));
-    } else {
-        RADEONSaveMemMapRegisters(pScrn, save);
-        RADEONSaveCommonRegisters(pScrn, save);
-        RADEONSavePLLRegisters (pScrn, save);
-        RADEONSaveCrtcRegisters (pScrn, save);
-        RADEONSaveFPRegisters (pScrn, save);
-        RADEONSaveCrtc2Registers (pScrn, save);
-        RADEONSavePLL2Registers (pScrn, save);
-	/*RADEONSavePalette(pScrn, save);*/
-	/*memcpy(&info->ModeReg, &info->SavedReg, sizeof(RADEONSaveRec));*/
-    }
+    RADEONSaveMemMapRegisters(pScrn, save);
+    RADEONSaveCommonRegisters(pScrn, save);
+    RADEONSavePLLRegisters (pScrn, save);
+    RADEONSaveCrtcRegisters (pScrn, save);
+    RADEONSaveFPRegisters (pScrn, save);
+    RADEONSaveCrtc2Registers (pScrn, save);
+    RADEONSavePLL2Registers (pScrn, save);
+    /*RADEONSavePalette(pScrn, save);*/
 
     RADEONTRACE(("RADEONSaveMode returns %p\n", save));
 }
@@ -4992,35 +4891,33 @@ static void RADEONSave(ScrnInfoPtr pScrn
 	return;
     }
 
-    if (!info->IsSecondary) {
+
 #ifdef WITH_VGAHW
-        if (info->VGAAccess) {
-           vgaHWPtr hwp = VGAHWPTR(pScrn);
+    if (info->VGAAccess) {
+	vgaHWPtr hwp = VGAHWPTR(pScrn);
 
-            vgaHWUnlock(hwp);
+	vgaHWUnlock(hwp);
 # if defined(__powerpc__)
-           /* temporary hack to prevent crashing on PowerMacs when trying to
-            * read VGA fonts and colormap, will find a better solution
-            * in the future. TODO: Check if there's actually some VGA stuff
-            * setup in the card at all !!
-            */
-           vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */
+	/* temporary hack to prevent crashing on PowerMacs when trying to
+	 * read VGA fonts and colormap, will find a better solution
+	 * in the future. TODO: Check if there's actually some VGA stuff
+	 * setup in the card at all !!
+	 */
+	vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */
 # else
-           /* Save mode * & fonts & cmap */
-           vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS);
+	/* Save mode * & fonts & cmap */
+	vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS);
 # endif
-           vgaHWLock(hwp);
-       }
-#endif
-	save->dp_datatype      = INREG(RADEON_DP_DATATYPE);
-	save->rbbm_soft_reset  = INREG(RADEON_RBBM_SOFT_RESET);
-	save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX);
-	RADEONPllErrataAfterIndex(info);
+	vgaHWLock(hwp);
     }
+#endif
+    save->dp_datatype      = INREG(RADEON_DP_DATATYPE);
+    save->rbbm_soft_reset  = INREG(RADEON_RBBM_SOFT_RESET);
+    save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX);
+    RADEONPllErrataAfterIndex(info);
 
     RADEONSaveMode(pScrn, save);
-    if (!info->IsSecondary)
-	RADEONSaveSurfaces(pScrn, save);
+    RADEONSaveSurfaces(pScrn, save);
 }
 
 /* Restore the original (text) mode */
@@ -5060,8 +4957,7 @@ void RADEONRestore(ScrnInfoPtr pScrn)
 #endif
 
     RADEONRestoreMode(pScrn, restore);
-    if (!info->IsSecondary)
-	RADEONRestoreSurfaces(pScrn, restore);
+    RADEONRestoreSurfaces(pScrn, restore);
 
 #if 1
     /* Temp fix to "solve" VT switch problems.  When switching VTs on
@@ -5075,34 +4971,16 @@ void RADEONRestore(ScrnInfoPtr pScrn)
 #ifdef WITH_VGAHW
     if (info->VGAAccess) {
        vgaHWPtr hwp = VGAHWPTR(pScrn);
-        if (!info->IsSecondary) {
-            vgaHWUnlock(hwp);
+       vgaHWUnlock(hwp);
 # if defined(__powerpc__)
-           /* Temporary hack to prevent crashing on PowerMacs when trying to
-            * write VGA fonts, will find a better solution in the future
-            */
-           vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE );
+       /* Temporary hack to prevent crashing on PowerMacs when trying to
+	* write VGA fonts, will find a better solution in the future
+	*/
+       vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE );
 # else
-           vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
+       vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
 # endif
-           vgaHWLock(hwp);
-        } else {
-            RADEONEntPtr  pRADEONEnt = RADEONEntPriv(pScrn);
-           ScrnInfoPtr   pScrn0 = pRADEONEnt->pPrimaryScrn;
-            RADEONInfoPtr info0 = RADEONPTR(pScrn0);
-           vgaHWPtr      hwp0;
-
-           if (info0->VGAAccess) {
-               hwp0 = VGAHWPTR(pScrn0);
-               vgaHWUnlock(hwp0);
-#if defined(__powerpc__)
-               vgaHWRestore(pScrn0, &hwp0->SavedReg, VGA_SR_MODE);
-#else
-               vgaHWRestore(pScrn0, &hwp0->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
-#endif
-               vgaHWLock(hwp0);
-           }
-       }
+       vgaHWLock(hwp);
     }
 #endif
 #if 0
@@ -6244,7 +6122,7 @@ 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 (crtc2 || info->IsSecondary) {
+    if (crtc2) {
 	reg = RADEON_CRTC2_OFFSET;
 	regcntl = RADEON_CRTC2_OFFSET_CNTL;
 	xytilereg = R300_CRTC2_TILE_X0_Y0;
@@ -6301,7 +6179,7 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
 	/* can't get at sarea in a semi-sane way? */
 	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
 
-	if (crtc2 || info->IsSecondary) {
+	if (crtc2) {
 	    pSAREAPriv->crtc2_base = Base;
 	}
 	else {
@@ -6401,7 +6279,7 @@ Bool RADEONEnterVT(int scrnIndex, int fl
 	{
 	    xf86CrtcPtr	crtc = xf86_config->crtc[i];
 	    RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
-	    radeon_crtc->binding = info->IsSecondary ? 2 : 1;
+	    radeon_crtc->binding = 1;
 	    /* Mark that we'll need to re-set the mode for sure */
 	    memset(&crtc->mode, 0, sizeof(crtc->mode));
 	    if (!crtc->desiredMode.CrtcHDisplay) {
@@ -6418,8 +6296,7 @@ Bool RADEONEnterVT(int scrnIndex, int fl
 	}
     }
 
-    if (!info->IsSecondary)
-	RADEONRestoreSurfaces(pScrn, &info->ModeReg);
+    RADEONRestoreSurfaces(pScrn, &info->ModeReg);
 #ifdef XF86DRI
     if (info->directRenderingEnabled) {
     	if (info->cardType == CARD_PCIE && info->pKernelDRMVersion->version_minor >= 19 && info->FbSecureSize)
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 818a2dd..6887388 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -179,9 +179,6 @@ typedef struct
     Bool IsSecondaryRestored;
     Bool RestorePrimary;
 
-    ScrnInfoPtr pSecondaryScrn;
-    ScrnInfoPtr pPrimaryScrn;
-
     Bool ReversedDAC;	  /* TVDAC used as primary dac */
     Bool ReversedTMDS;    /* DDC_DVI is used for external TMDS */
     xf86CrtcPtr pCrtc[RADEON_MAX_CRTC];
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 97724eb..6d085cc 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -1333,7 +1333,7 @@ RADEONAllocAdaptor(ScrnInfoPtr pScrn)
      */
 
     /* Figure out which head we are on */
-    if ((info->OverlayOnCRTC2) || info->IsSecondary)
+    if (info->OverlayOnCRTC2)
 	dot_clock = info->ModeReg.dot_clock_freq_2;
     else
 	dot_clock = info->ModeReg.dot_clock_freq;
@@ -2454,7 +2454,7 @@ RADEONDisplayVideo(
        workarounds for chip erratas */
 
     /* Figure out which head we are on for dot clock */
-    if (info->OverlayOnCRTC2 || info->IsSecondary)
+    if (info->OverlayOnCRTC2)
         dot_clock = info->ModeReg.dot_clock_freq_2;
     else
         dot_clock = info->ModeReg.dot_clock_freq;
@@ -2575,14 +2575,6 @@ RADEONDisplayVideo(
 	offset5 += ((left >> 16) & ~7) << 1;
 	offset6 += ((left >> 16) & ~7) << 1;
     }
-    if (info->IsSecondary) {
-	offset1 += info->FbMapSize;
-	offset2 += info->FbMapSize;
-	offset3 += info->FbMapSize;
-	offset4 += info->FbMapSize;
-	offset5 += info->FbMapSize;
-	offset6 += info->FbMapSize;
-    }
 
     tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3);
     p1_h_accum_init = ((tmp <<  4) & 0x000f8000) |
@@ -2641,7 +2633,7 @@ RADEONDisplayVideo(
      * rendering for the second head.
      */
 
-    if (info->OverlayOnCRTC2 || info->IsSecondary) {
+    if (info->OverlayOnCRTC2) {
         x_off = 0;
         OUTREG(RADEON_OV1_Y_X_START, ((dstBox->x1 + x_off) |
                                       ((dstBox->y1*y_mult) << 16)));
diff-tree 9c2f20a83a5fed14225f4c3ebcd8ca41e9d4bd48 (from e187321ab8dd58d2b2fe92c062d070ba4820a2bf)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Sun May 13 21:13:23 2007 -0400

    RADEON: additional cleanups

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index ceea69d..dbbf91f 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2536,7 +2536,6 @@ static Bool RADEONPreInitControllers(Scr
     if (!RADEONSetupConnectors(pScrn)) {
 	return FALSE;
     }
-
       
     RADEONMapControllers(pScrn);
 
@@ -5295,7 +5294,6 @@ static void RADEONInitLVDSRegisters(xf86
     ScrnInfoPtr pScrn = output->scrn;
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
 
-/* XXX saved but never used??? */
     if (IsPrimary)
 	save->lvds_gen_cntl = info->SavedReg.lvds_gen_cntl &
 				~RADEON_LVDS_SEL_CRTC2;
@@ -6150,7 +6148,7 @@ Bool RADEONSwitchMode(int scrnIndex, Dis
 	RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg);
     } else {
 	info->IsSwitching = TRUE;
-	ret = TRUE; //RADEONModeInit(xf86Screens[scrnIndex], mode);
+	ret = xf86SetSingleMode (pScrn, mode, RR_Rotate_0);
 	info->IsSwitching = FALSE;
     }
 
@@ -6327,16 +6325,16 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
 	OUTREG(regcntl, crtcoffsetcntl);
     }
 
-    if (crtc2)
-	OUTREG(reg, Base);
-    else
-	OUTREG(reg, Base);
+    OUTREG(reg, Base);
 }
 
 void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags)
 {
     ScrnInfoPtr    pScrn      = xf86Screens[scrnIndex];
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
+    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(pScrn);
+    xf86OutputPtr  output = config->output[config->compat_output];
+    xf86CrtcPtr	crtc = output->crtc;
 
 #ifdef XF86DRI
     if (info->CPStarted && pScrn->pScreen) DRILock(pScrn->pScreen, 0);
@@ -6345,12 +6343,17 @@ void RADEONAdjustFrame(int scrnIndex, in
     if (info->accelOn)
         RADEON_SYNC(info, pScrn);
 
-    if (info->FBDev) {
-	fbdevHWAdjustFrame(scrnIndex, x, y, flags);
-    } else {
-	RADEONDoAdjustFrame(pScrn, x, y, FALSE);
+    if (crtc && crtc->enabled) {
+	if (info->FBDev) {
+	    fbdevHWAdjustFrame(scrnIndex, crtc->desiredX + x, crtc->desiredY + y, flags);
+	} else {
+	    RADEONDoAdjustFrame(pScrn, crtc->desiredX + x, crtc->desiredY + y, FALSE);
+	}
+	crtc->x = output->initial_x + x;
+	crtc->y = output->initial_y + y;
     }
 
+
 #ifdef XF86DRI
 	if (info->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen);
 #endif


More information about the xorg-commit mailing list