xf86-video-intel: Branch 'modesetting' - src/i830_cursor.c src/i830_display.c src/i830_dri.c src/i830_driver.c src/i830.h src/i830_modes.c src/i830_randr.c

Keith Packard keithp at kemper.freedesktop.org
Fri Nov 3 22:55:56 EET 2006


 src/i830.h         |   28 +++++-------
 src/i830_cursor.c  |   35 ++++++++-------
 src/i830_display.c |  119 ++++++++++++++++++++---------------------------------
 src/i830_dri.c     |    2 
 src/i830_driver.c  |   35 ++++-----------
 src/i830_modes.c   |   21 ---------
 src/i830_randr.c   |   31 ++++++-------
 7 files changed, 101 insertions(+), 170 deletions(-)

New commits:
diff-tree 9681602177124e84a817a1e1d428f1779f2a45c9 (from 2c9ab6e0594769274f2dbcdf7c00fe297fc385d5)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Fri Nov 3 12:55:25 2006 -0800

    Create I830PipeRec to hold pipe-specific data. Remove unused I830 members.
    
    I830 contained six parallel arrays for pipe-specific data; these
    have been moved to a I830PipeRec structure instead.
    
    I830 also contained several unused members:
    
       unsigned int bios_version;
       Bool newPipeSwitch;
       Bool fakeSwitch;
       int fixedPipe;
    
    These have been removed, along with the code that set them.

diff --git a/src/i830.h b/src/i830.h
index bb17f3f..b4b17de 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -287,31 +287,29 @@ struct _I830OutputRec {
    void *dev_priv;
 };
 
+typedef struct _I830PipeRec {
+   Bool		  gammaEnabled;
+   int		  x;
+   int		  y;
+   Bool		  cursorInRange;
+   Bool		  cursorShown;
+   Bool		  planeEnabled;
+   DisplayModeRec curMode;
+} I830PipeRec, *I830PipePtr;
+
 typedef struct _I830Rec {
    unsigned char *MMIOBase;
    unsigned char *FbBase;
    int cpp;
 
-   unsigned int bios_version;
-
-   Bool newPipeSwitch;
-
-   Bool fakeSwitch;
-   
-   int fixedPipe;
-
    DisplayModePtr currentMode;
    /* Mode saved during randr reprobe, which will need to be freed at the point
     * of the next SwitchMode, when we lose this last reference to it.
     */
    DisplayModePtr savedCurrentMode;
 
-   Bool gammaEnabled[MAX_DISPLAY_PIPES];
-
-   int pipeX[MAX_DISPLAY_PIPES];
-   int pipeY[MAX_DISPLAY_PIPES];
-   Bool cursorInRange[MAX_DISPLAY_PIPES];
-   Bool cursorShown[MAX_DISPLAY_PIPES];
+   I830PipeRec	  pipes[MAX_DISPLAY_PIPES];
+   
    Bool Clone;
    int CloneRefresh;
    int CloneHDisplay;
@@ -478,8 +476,6 @@ typedef struct _I830Rec {
    /* [0] is Pipe A, [1] is Pipe B. */
    int availablePipes;
    /* [0] is display plane A, [1] is display plane B. */
-   int planeEnabled[MAX_DISPLAY_PIPES];
-   DisplayModeRec pipeCurMode[MAX_DISPLAY_PIPES];
 
    /* Driver phase/state information */
    Bool preinit;
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 92239f1..0b7e772 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -105,14 +105,15 @@ void
 I830SetPipeCursor (ScrnInfoPtr pScrn, int pipe, Bool force)
 {
    I830Ptr pI830 = I830PTR(pScrn);
+   I830PipePtr pI830Pipe = &pI830->pipes[pipe];
    CARD32 temp;
     Bool show;
     
-    if (!pI830->planeEnabled[pipe])
+    if (!pI830Pipe->planeEnabled)
 	return;
 
-    show = pI830->cursorOn && pI830->cursorInRange[pipe];
-    if (show && (force || !pI830->cursorShown[pipe]))
+    show = pI830->cursorOn && pI830Pipe->cursorInRange;
+    if (show && (force || !pI830Pipe->cursorShown))
     {
 	if (IS_MOBILE(pI830) || IS_I9XX(pI830)) {
 	    int	cursor_control;
@@ -124,7 +125,7 @@ I830SetPipeCursor (ScrnInfoPtr pScrn, in
 	    temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
 	    if (pI830->CursorIsARGB) {
 		temp |= CURSOR_MODE_64_ARGB_AX;
-		if (pI830->gammaEnabled[pipe])
+		if (pI830Pipe->gammaEnabled)
 		    temp |= MCURSOR_GAMMA_ENABLE;
 	    } else
 		temp |= CURSOR_MODE_64_4C_AX;
@@ -138,15 +139,15 @@ I830SetPipeCursor (ScrnInfoPtr pScrn, in
 	    temp |= CURSOR_ENABLE;
 	    if (pI830->CursorIsARGB) {
 		temp |= CURSOR_FORMAT_ARGB;
-		if (pI830->gammaEnabled[pipe])
+		if (pI830Pipe->gammaEnabled)
 		    temp |= CURSOR_GAMMA_ENABLE;
 	    } else
 		temp |= CURSOR_FORMAT_3C;
 	    OUTREG(CURSOR_CONTROL, temp);
 	}
-	pI830->cursorShown[pipe] = TRUE;
+	pI830Pipe->cursorShown = TRUE;
     }
-    else if (!show && (force || pI830->cursorShown[pipe]))
+    else if (!show && (force || pI830Pipe->cursorShown))
     {
 	if (IS_MOBILE(pI830) || IS_I9XX(pI830)) 
 	{
@@ -164,7 +165,7 @@ I830SetPipeCursor (ScrnInfoPtr pScrn, in
 	    temp &= ~(CURSOR_ENABLE|CURSOR_GAMMA_ENABLE);
 	    OUTREG(CURSOR_CONTROL, temp);
 	}
-	pI830->cursorShown[pipe] = FALSE;
+	pI830Pipe->cursorShown = FALSE;
     }
 
     /* Flush cursor changes. */
@@ -179,7 +180,8 @@ I830InitHWCursor(ScrnInfoPtr pScrn)
    int i;
 
    DPRINTF(PFX, "I830InitHWCursor\n");
-   for (i = 0; i < MAX_DISPLAY_PIPES; i++) pI830->cursorShown[i] = FALSE;
+   for (i = 0; i < MAX_DISPLAY_PIPES; i++) 
+      pI830->pipes[i].cursorShown = FALSE;
    /* Initialise the HW cursor registers, leaving the cursor hidden. */
    if (IS_MOBILE(pI830) || IS_I9XX(pI830)) {
       for (i = 0; i < MAX_DISPLAY_PIPES; i++)
@@ -484,11 +486,12 @@ I830SetCursorPosition(ScrnInfoPtr pScrn,
 
     for (pipe = 0; pipe < MAX_DISPLAY_PIPES; pipe++)
     {
-	DisplayModePtr	mode = &pI830->pipeCurMode[pipe];
-	int		thisx = x - pI830->pipeX[pipe];
-	int		thisy = y - pI830->pipeY[pipe];
+	I830PipePtr	pI830Pipe = &pI830->pipes[pipe];
+	DisplayModePtr	mode = &pI830Pipe->curMode;
+	int		thisx = x - pI830Pipe->x;
+	int		thisy = y - pI830Pipe->y;
 
-	if (!pI830->planeEnabled[pipe])
+	if (!pI830Pipe->planeEnabled)
 	    continue;
 
 	/*
@@ -524,7 +527,7 @@ I830SetCursorPosition(ScrnInfoPtr pScrn,
 	if (pipe == 1)
 	    OUTREG(CURSOR_B_POSITION, temp);
 
-	pI830->cursorInRange[pipe] = inrange;
+	pI830Pipe->cursorInRange = inrange;
 	
         I830SetPipeCursor (pScrn, pipe, FALSE);
     }
@@ -577,14 +580,14 @@ I830SetCursorColors(ScrnInfoPtr pScrn, i
 
    DPRINTF(PFX, "I830SetCursorColors\n");
 
-   if (pI830->planeEnabled[0])
+   if (pI830->pipes[0].planeEnabled)
    {
        OUTREG(CURSOR_A_PALETTE0, bg & 0x00ffffff);
        OUTREG(CURSOR_A_PALETTE1, fg & 0x00ffffff);
        OUTREG(CURSOR_A_PALETTE2, fg & 0x00ffffff);
        OUTREG(CURSOR_A_PALETTE3, bg & 0x00ffffff);
    }
-   if (pI830->planeEnabled[1])
+   if (pI830->pipes[1].planeEnabled)
    {
       OUTREG(CURSOR_B_PALETTE0, bg & 0x00ffffff);
       OUTREG(CURSOR_B_PALETTE1, fg & 0x00ffffff);
diff --git a/src/i830_display.c b/src/i830_display.c
index 4716e86..1175cf1 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -237,6 +237,7 @@ void
 i830PipeSetBase(ScrnInfoPtr pScrn, int pipe, int x, int y)
 {
     I830Ptr pI830 = I830PTR(pScrn);
+    I830PipePtr pI830Pipe = &pI830->pipes[pipe];
     unsigned long Start;
     int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE);
     int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
@@ -255,8 +256,8 @@ i830PipeSetBase(ScrnInfoPtr pScrn, int p
 	OUTREG(dspbase, Start + ((y * pScrn->displayWidth + x) * pI830->cpp));
     }
 
-    pI830->pipeX[pipe] = x;
-    pI830->pipeY[pipe] = y;
+    pI830Pipe->x = x;
+    pI830Pipe->y = y;
 }
 
 /**
@@ -363,6 +364,7 @@ Bool
 i830PipeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, int pipe)
 {
     I830Ptr pI830 = I830PTR(pScrn);
+    I830PipePtr pI830Pipe = &pI830->pipes[pipe];
     int m1 = 0, m2 = 0, n = 0, p1 = 0, p2 = 0;
     CARD32 dpll = 0, fp = 0, temp;
     CARD32 htot, hblank, hsync, vtot, vblank, vsync, dspcntr;
@@ -391,7 +393,7 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
     else
 	outputs = (pI830->operatingDevices >> 8) & 0xff;
 
-    if (I830ModesEqual(&pI830->pipeCurMode[pipe], pMode))
+    if (I830ModesEqual(&pI830Pipe->curMode, pMode))
 	return TRUE;
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Requested pix clock: %d\n",
@@ -576,7 +578,7 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
 	FatalError("unknown display bpp\n");
     }
 
-    if (pI830->gammaEnabled[pipe]) {
+    if (pI830Pipe->gammaEnabled) {
  	dspcntr |= DISPPLANE_GAMMA_ENABLE;
     }
 
@@ -626,7 +628,7 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
     OUTREG(dspstride_reg, pScrn->displayWidth * pI830->cpp);
     OUTREG(dspsize_reg, dspsize);
     OUTREG(dsppos_reg, 0);
-    i830PipeSetBase(pScrn, pipe, pI830->pipeX[pipe], pI830->pipeX[pipe]);
+    i830PipeSetBase(pScrn, pipe, pI830Pipe->x, pI830Pipe->y);
     OUTREG(pipesrc_reg, pipesrc);
 
     /* Then, turn the pipe on first */
@@ -636,7 +638,7 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
     /* And then turn the plane on */
     OUTREG(dspcntr_reg, dspcntr);
 
-    pI830->pipeCurMode[pipe] = *pMode;
+    pI830Pipe->curMode = *pMode;
 
     return TRUE;
 }
@@ -658,63 +660,49 @@ i830DisableUnusedFunctions(ScrnInfoPtr p
      * internal TV) should have no outputs trying to pull data out of it, so
      * we're ready to turn those off.
      */
-    if (!pI830->planeEnabled[0]) {
-	CARD32 dspcntr, pipeconf, dpll;
+    for (i = 0; i < MAX_DISPLAY_PIPES; i++) {
+	I830PipePtr pI830Pipe = &pI830->pipes[i];
+	int	    dspcntr_reg = pipe == 0 ? DSPACNTR : DSPBCNTR;
+	int	    pipeconf_reg = pipe == 0 ? PIPEACONF : PIPEBCONF;
+	int	    dpll_reg = pipe == 0 ? DPLL_A : DPLL_B;
+	CARD32	    dspcntr, pipeconf, dpll;
+	char	    *pipe_name = pipe == 0 ? "A" : "B";
 
-	dspcntr = INREG(DSPACNTR);
+	if (pI830Pipe->planeEnabled)
+	    continue;
+	
+	dspcntr = INREG(dspcntr_reg);
 	if (dspcntr & DISPLAY_PLANE_ENABLE) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling plane A\n");
-	    OUTREG(DSPACNTR, dspcntr & ~DISPLAY_PLANE_ENABLE);
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling plane %s\n",
+		       pipe_name);
+	    
+	    OUTREG(dspcntr_reg, dspcntr & ~DISPLAY_PLANE_ENABLE);
 
 	    /* Wait for vblank for the disable to take effect */
 	    i830WaitForVblank(pScrn);
 	}
 
-	pipeconf = INREG(PIPEACONF);
+	pipeconf = INREG(pipeconf_reg);
 	if (pipeconf & PIPEACONF_ENABLE) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling pipe A\n");
-	   OUTREG(PIPEACONF, pipeconf & ~PIPEACONF_ENABLE);
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling pipe %s\n",
+		       pipe_name);
+	   OUTREG(pipeconf_reg, pipeconf & ~PIPEACONF_ENABLE);
 	}
 
-	dpll = INREG(DPLL_A);
+	dpll = INREG(dpll_reg);
 	if (dpll & DPLL_VCO_ENABLE) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DPLL A\n");
-	    OUTREG(DPLL_A, dpll & ~DPLL_VCO_ENABLE);
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DPLL %s\n",
+		       pipe_name);
+	    OUTREG(dpll_reg, dpll & ~DPLL_VCO_ENABLE);
 	}
 
-	memset(&pI830->pipeCurMode[0], 0, sizeof(pI830->pipeCurMode[0]));
-    }
-
-    if (!pI830->planeEnabled[1]) {
-	CARD32 dspcntr, pipeconf, dpll;
-
-	dspcntr = INREG(DSPBCNTR);
-	if (dspcntr & DISPLAY_PLANE_ENABLE) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling plane B\n");
-	    OUTREG(DSPBCNTR, dspcntr & ~DISPLAY_PLANE_ENABLE);
-
-	    /* Wait for vblank for the disable to take effect */
-	    i830WaitForVblank(pScrn);
-	}
-
-	pipeconf = INREG(PIPEBCONF);
-	if (pipeconf & PIPEBCONF_ENABLE) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling pipe B\n");
-	   OUTREG(PIPEBCONF, pipeconf & ~PIPEBCONF_ENABLE);
-	}
-
-	dpll = INREG(DPLL_B);
-	if (dpll & DPLL_VCO_ENABLE) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DPLL B\n");
-	    OUTREG(DPLL_B, dpll & ~DPLL_VCO_ENABLE);
-	}
-
-	memset(&pI830->pipeCurMode[1], 0, sizeof(pI830->pipeCurMode[1]));
+	memset(&pI830Pipe->curMode, 0, sizeof(pI830Pipe->curMode));
     }
 }
 
 /**
- * This function sets the given mode on the active pipes.
+ * This function configures the screens in clone mode on
+ * all active outputs using a mode similar to the specified mode.
  */
 Bool
 i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
@@ -732,31 +720,17 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
     didLock = I830DRILock(pScrn);
 #endif
 
-    if (pI830->operatingDevices & 0xff) {
-	pI830->planeEnabled[0] = 1;
-    } else {
-	pI830->planeEnabled[0] = 0;
-    }
+    pI830->pipes[0].planeEnabled = (pI830->operatingDevices & 0xff) != 0;
+    pI830->pipes[1].planeEnabled = (pI830->operatingDevices & 0xff00) != 0;
 
-    if (pI830->operatingDevices & 0xff00) {
-	pI830->planeEnabled[1] = 1;
-    } else {
-	pI830->planeEnabled[1] = 0;
-    }
-
-    for (i = 0; i < pI830->num_outputs; i++) {
+    for (i = 0; i < pI830->num_outputs; i++)
 	pI830->output[i].pre_set_mode(pScrn, &pI830->output[i], pMode);
-    }
 
-    if (pI830->planeEnabled[0]) {
-	ok = i830PipeSetMode(pScrn, i830PipeFindClosestMode(pScrn, 0, pMode),
-			     0);
-	if (!ok)
-	    goto done;
-    }
-    if (pI830->planeEnabled[1]) {
-	ok = i830PipeSetMode(pScrn, i830PipeFindClosestMode(pScrn, 1, pMode),
-			     1);
+    for (i = 0; i < MAX_DISPLAY_PIPES; i++)
+    {
+	if (pI830->pipes[i].planeEnabled)
+	    ok = i830PipeSetMode(pScrn, i830PipeFindClosestMode(pScrn, i, pMode),
+				 i);
 	if (!ok)
 	    goto done;
     }
@@ -776,13 +750,10 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
 	/* If we might have enabled/disabled some pipes, we need to reset
 	 * cloning mode support.
 	 */
-	if ((pI830->operatingDevices & 0x00ff) &&
-	    (pI830->operatingDevices & 0xff00))
-	{
+	if (pI830->pipes[0].planeEnabled && pI830->pipes[1].planeEnabled)
 	    pI830->Clone = TRUE;
-	} else {
+	else
 	    pI830->Clone = FALSE;
-	}
 
 	/* If HW cursor currently showing, reset cursor state */
 	if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn)
@@ -821,7 +792,7 @@ i830DescribeOutputConfiguration(ScrnInfo
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "  Display plane %c is now %s and connected to pipe %c.\n",
 		   'A' + i,
-		   pI830->planeEnabled[i] ? "enabled" : "disabled",
+		   pI830->pipes[i].planeEnabled ? "enabled" : "disabled",
 		   dspcntr & DISPPLANE_SEL_PIPE_MASK ? 'B' : 'A');
     }
 
diff --git a/src/i830_dri.c b/src/i830_dri.c
index c9b52c4..41ea21c 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1485,7 +1485,7 @@ I830DRISetVBlankInterrupt (ScrnInfoPtr p
 
     if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) {
 	if (on) {
-	    if (pI830->planeEnabled[1])
+	    if (pI830->pipes[1].planeEnabled)
 		pipe.pipe = DRM_I830_VBLANK_PIPE_B;
 	    else
 		pipe.pipe = DRM_I830_VBLANK_PIPE_A;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 4fb8ac2..3b21974 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -640,6 +640,7 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
    pI830 = I830PTR(pScrn);
 
    for(p=0; p < pI830->availablePipes; p++) {
+      I830PipePtr pI830Pipe = &pI830->pipes[p];
 
       if (p == 0) {
          palreg = PALETTE_A;
@@ -653,10 +654,10 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
 	 dspsurf = DSPBSURF;
       }
 
-      if (pI830->planeEnabled[p] == 0)
+      if (pI830Pipe->planeEnabled == 0)
 	 continue;  
 
-      pI830->gammaEnabled[p] = 1;
+      pI830Pipe->gammaEnabled = 1;
       
       /* To ensure gamma is enabled we need to turn off and on the plane */
       temp = INREG(dspreg);
@@ -1265,16 +1266,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags
          pI830->LinearAlloc = 0;
    }
 
-   pI830->fixedPipe = -1;
-   if ((s = xf86GetOptValString(pI830->Options, OPTION_FIXEDPIPE)) &&
-      I830IsPrimary(pScrn)) {
-
-      if (strstr(s, "A") || strstr(s, "a") || strstr(s, "0"))
-         pI830->fixedPipe = 0;
-      else if (strstr(s, "B") || strstr(s, "b") || strstr(s, "1"))
-         pI830->fixedPipe = 1;
-   }
-
    I830PreInitDDC(pScrn);
 
    pI830->MonType1 = PIPE_NONE;
@@ -1681,16 +1672,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags
       }
    }
 
-   if (IS_I9XX(pI830))
-      pI830->newPipeSwitch = TRUE;
-   else
-   if (pI830->availablePipes == 2 && pI830->bios_version >= 3062) {
-      /* BIOS build 3062 changed the pipe switching functionality */
-      pI830->newPipeSwitch = TRUE;
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using new Pipe switch code\n");
-   } else
-      pI830->newPipeSwitch = FALSE;
-
    PrintDisplayDeviceInfo(pScrn);
 
    if (xf86IsEntityShared(pScrn->entityList[0])) {
@@ -3400,7 +3381,8 @@ static Bool
 I830EnterVT(int scrnIndex, int flags)
 {
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-   I830Ptr pI830 = I830PTR(pScrn);
+   I830Ptr  pI830 = I830PTR(pScrn);
+   int	    i;
 
    DPRINTF(PFX, "Enter VT\n");
 
@@ -3431,7 +3413,8 @@ I830EnterVT(int scrnIndex, int flags)
    SetHWOperatingState(pScrn);
 
    /* Mark that we'll need to re-set the mode for sure */
-   memset(pI830->pipeCurMode, 0, sizeof(pI830->pipeCurMode));
+   for (i = 0; i < MAX_DISPLAY_PIPES; i++)
+      memset(&pI830->pipes[i].curMode, 0, sizeof(pI830->pipes[i].curMode));
 
    if (!i830SetMode(pScrn, pScrn->currentMode))
       return FALSE;
@@ -3584,7 +3567,7 @@ I830SaveScreen(ScreenPtr pScreen, int mo
 	    base = DSPBADDR;
 	    surf = DSPBSURF;
         }
-        if (pI830->planeEnabled[i]) {
+        if (pI830->pipes[i].planeEnabled) {
 	   temp = INREG(ctrl);
 	   if (on)
 	      temp |= DISPLAY_PLANE_ENABLE;
@@ -3633,7 +3616,7 @@ I830DisplayPowerManagementSet(ScrnInfoPt
          ctrl = DSPBCNTR;
          base = DSPBADDR;
       }
-      if (pI830->planeEnabled[i]) {
+      if (pI830->pipes[i].planeEnabled) {
 	   temp = INREG(ctrl);
 	   if (PowerManagementMode == DPMSModeOn)
 	      temp |= DISPLAY_PLANE_ENABLE;
diff --git a/src/i830_modes.c b/src/i830_modes.c
index 0bb17a5..b6867c3 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -385,27 +385,6 @@ i830GetModeListTail(DisplayModePtr pMode
 }
 
 /**
- * Appends a list of modes to another mode list, without duplication.
- */
-static void
-i830AppendModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
-		DisplayModePtr addModes)
-{
-    DisplayModePtr first = *modeList;
-    DisplayModePtr last = i830GetModeListTail(first);
-
-    if (addModes == NULL)
-      return;
-
-    if (first == NULL) {
-	*modeList = addModes;
-    } else {
-	last->next = addModes;
-	addModes->prev = last;
-    }
-}
-
-/**
  * This function removes a mode from a list of modes.  It should probably be
  * moved to xf86Mode.c.
  *
diff --git a/src/i830_randr.c b/src/i830_randr.c
index 59ebcc0..67641d6 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -489,12 +489,13 @@ I830RandRCrtcNotify (RRCrtcPtr	crtc)
     struct _I830OutputRec   *output;
     RROutputPtr		rrout;
     int			pipe = (int) crtc->devPrivate;
+    I830PipePtr		pI830Pipe = &pI830->pipes[pipe];
     int			i, j;
-    DisplayModePtr	pipeMode = &pI830->pipeCurMode[pipe];
+    DisplayModePtr	pipeMode = &pI830Pipe->curMode;
     int			pipe_type;
 
-    x = pI830->pipeX[pipe];
-    y = pI830->pipeY[pipe];
+    x = pI830Pipe->x;
+    y = pI830Pipe->y;
     rotation = RR_Rotate_0;
     numOutputs = 0;
     for (i = 0; i < pI830->num_outputs; i++)
@@ -550,6 +551,7 @@ I830RandRCrtcSet (ScreenPtr	pScreen,
     ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
     I830Ptr		pI830 = I830PTR(pScrn);
     int			pipe = (int) (crtc->devPrivate);
+    I830PipePtr		pI830Pipe = &pI830->pipes[pipe];
     DisplayModePtr	display_mode = mode ? mode->devPrivate : NULL;
 
     /* Sync the engine before adjust mode */
@@ -560,7 +562,7 @@ I830RandRCrtcSet (ScreenPtr	pScreen,
 
     if (display_mode != randrp->modes[pipe])
     {
-	pI830->planeEnabled[pipe] = mode != NULL;
+	pI830Pipe->planeEnabled = mode != NULL;
 	if (display_mode)
 	{
 	    if (!i830PipeSetMode (pScrn, display_mode, pipe))
@@ -833,18 +835,15 @@ I830RandRCreateScreenResources12 (Screen
     {
 	int mmWidth, mmHeight;
 
-	if (mode->HDisplay == pScreen->width &&
-	    mode->VDisplay == pScreen->height)
-	{
-	    mmWidth = pScrn->widthmm;
-	    mmHeight = pScrn->heightmm;
-	}
-	else
-	{
-#define MMPERINCH 25.4
-	    mmWidth = (double) mode->HDisplay / pScrn->xDpi * MMPERINCH;
-	    mmHeight = (double) mode->VDisplay / pScrn->yDpi * MMPERINCH;
-	}
+	mmWidth = pScreen->mmWidth;
+	mmHeight = pScreen->mmHeight;
+	if (mode->HDisplay != pScreen->width)
+	    mmWidth = mmWidth * mode->HDisplay / pScreen->width;
+	if (mode->VDisplay == pScreen->height)
+	    mmHeight = mmHeight * mode->VDisplay / pScreen->height;
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "Setting screen physical size to %d x %d\n",
+		   mmWidth, mmHeight);
 	I830RandRScreenSetSize (pScreen,
 				mode->HDisplay,
 				mode->VDisplay,



More information about the xorg-commit mailing list