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

Eric Anholt anholt at kemper.freedesktop.org
Thu Nov 9 05:56:46 EET 2006


 src/i830.h         |    4 ++--
 src/i830_crt.c     |   24 +++++++++++++-----------
 src/i830_cursor.c  |    8 ++++----
 src/i830_display.c |   50 +++++++++++++++++++++-----------------------------
 src/i830_dri.c     |    2 +-
 src/i830_driver.c  |   18 +++++++++---------
 src/i830_randr.c   |    6 +++---
 7 files changed, 53 insertions(+), 59 deletions(-)

New commits:
diff-tree 713c5b0899428edfea7cea0780244488115dbe1d (from ff77e9d84f2037b99a8e4ac55da0b0ac92ed6b9b)
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Nov 8 19:55:31 2006 -0800

    Change the output and pipe "is it on/off" field name to "enabled".

diff --git a/src/i830.h b/src/i830.h
index 9de7394..6a8e36e 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -184,7 +184,7 @@ enum detect_status {
 struct _I830OutputRec {
    int type;
    int pipe;
-   Bool disabled;
+   Bool enabled;
    /**
     * Marks that the output and associated pipe is temporarily enabled for
     * load detection.
@@ -273,12 +273,12 @@ struct _I830OutputRec {
 };
 
 typedef struct _I830PipeRec {
+   Bool		  enabled;
    Bool		  gammaEnabled;
    int		  x;
    int		  y;
    Bool		  cursorInRange;
    Bool		  cursorShown;
-   Bool		  planeEnabled;
    DisplayModeRec curMode;
 } I830PipeRec, *I830PipePtr;
 
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 6b0e58c..bf35d4e 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -109,7 +109,7 @@ I830SetPipeCursor (ScrnInfoPtr pScrn, in
    CARD32 temp;
     Bool show;
     
-    if (!pI830Pipe->planeEnabled)
+    if (!pI830Pipe->enabled)
 	return;
 
     show = pI830->cursorOn && pI830Pipe->cursorInRange;
@@ -491,7 +491,7 @@ I830SetCursorPosition(ScrnInfoPtr pScrn,
 	int		thisx = x - pI830Pipe->x;
 	int		thisy = y - pI830Pipe->y;
 
-	if (!pI830Pipe->planeEnabled)
+	if (!pI830Pipe->enabled)
 	    continue;
 
 	/*
@@ -580,14 +580,14 @@ I830SetCursorColors(ScrnInfoPtr pScrn, i
 
    DPRINTF(PFX, "I830SetCursorColors\n");
 
-   if (pI830->pipes[0].planeEnabled)
+   if (pI830->pipes[0].enabled)
    {
        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->pipes[1].planeEnabled)
+   if (pI830->pipes[1].enabled)
    {
       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 72037c4..c81f454 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -70,7 +70,7 @@ i830PipeHasType (ScrnInfoPtr pScrn, int 
     int	    i;
 
     for (i = 0; i < pI830->num_outputs; i++)
-	if (!pI830->output[i].disabled && pI830->output[i].pipe == pipe)
+	if (pI830->output[i].enabled && pI830->output[i].pipe == pipe)
 	{
 	    if (pI830->output[i].type == type)
 		return TRUE;
@@ -297,7 +297,7 @@ i830PipeFindClosestMode(ScrnInfoPtr pScr
     /* Assume that there's only one output connected to the given CRTC. */
     for (i = 0; i < pI830->num_outputs; i++) {
 	if (pI830->output[i].pipe == pipe &&
-	    !pI830->output[i].disabled &&
+	    pI830->output[i].enabled &&
 	    pI830->output[i].probed_modes != NULL)
 	{
 	    pScan = pI830->output[i].probed_modes;
@@ -418,7 +418,7 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
 	       pMode->Clock);
 
     for (i = 0; i < pI830->num_outputs; i++) {
-	if (pI830->output[i].pipe != pipe || pI830->output[i].disabled)
+	if (pI830->output[i].pipe != pipe || !pI830->output[i].enabled)
 	    continue;
 
 	switch (pI830->output[i].type) {
@@ -671,7 +671,7 @@ i830DisableUnusedFunctions(ScrnInfoPtr p
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling unused functions\n");
 
     for (i = 0; i < pI830->num_outputs; i++) {
-	if (pI830->output[i].disabled)
+	if (!pI830->output[i].enabled)
 	    pI830->output[i].dpms(pScrn, &pI830->output[i], DPMSModeOff);
     }
 
@@ -687,7 +687,7 @@ i830DisableUnusedFunctions(ScrnInfoPtr p
 	CARD32	    dspcntr, pipeconf, dpll;
 	char	    *pipe_name = pipe == 0 ? "A" : "B";
 
-	if (pI830Pipe->planeEnabled)
+	if (pI830Pipe->enabled)
 	    continue;
 	
 	dspcntr = INREG(dspcntr_reg);
@@ -730,7 +730,7 @@ i830PipeInUse (ScrnInfoPtr pScrn, int pi
     int	i;
     
     for (i = 0; i < pI830->num_outputs; i++)
-	if (!pI830->output[i].disabled && pI830->output[i].pipe == pipe)
+	if (pI830->output[i].enabled && pI830->output[i].pipe == pipe)
 	    return TRUE;
     return FALSE;
 }
@@ -756,14 +756,14 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
 #endif
 
     for (i = 0; i < pI830->availablePipes; i++)
-	pI830->pipes[i].planeEnabled = i830PipeInUse (pScrn, i);
+	pI830->pipes[i].enabled = i830PipeInUse (pScrn, i);
 
     for (i = 0; i < pI830->num_outputs; i++)
 	pI830->output[i].pre_set_mode(pScrn, &pI830->output[i], pMode);
 
     for (i = 0; i < pI830->availablePipes; i++)
     {
-	if (pI830->pipes[i].planeEnabled)
+	if (pI830->pipes[i].enabled)
 	    ok = i830PipeSetMode(pScrn, i830PipeFindClosestMode(pScrn, i,
 								pMode),
 				 i, TRUE);
@@ -786,7 +786,7 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
 	/* If we might have enabled/disabled some pipes, we need to reset
 	 * cloning mode support.
 	 */
-	if (pI830->pipes[0].planeEnabled && pI830->pipes[1].planeEnabled)
+	if (pI830->pipes[0].enabled && pI830->pipes[1].enabled)
 	    pI830->Clone = TRUE;
 	else
 	    pI830->Clone = FALSE;
@@ -830,25 +830,25 @@ i830DescribeOutputConfiguration(ScrnInfo
 
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "  Pipe %c is %s\n",
-		   'A' + i, pI830->pipes[i].planeEnabled ? "on" : "off");
+		   'A' + i, pI830->pipes[i].enabled ? "on" : "off");
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "  Display plane %c is now %s and connected to pipe %c.\n",
 		   'A' + i,
-		   pI830->pipes[i].planeEnabled ? "enabled" : "disabled",
+		   pI830->pipes[i].enabled ? "enabled" : "disabled",
 		   dspcntr & DISPPLANE_SEL_PIPE_MASK ? 'B' : 'A');
-	if (hw_pipe_enable != pI830->pipes[i].planeEnabled) {
+	if (hw_pipe_enable != pI830->pipes[i].enabled) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		       "  Hardware claims pipe %c is %s while software "
 		       "believes it is %s\n",
 		       'A' + i, hw_pipe_enable ? "on" : "off",
-		       pI830->pipes[i].planeEnabled ? "on" : "off");
+		       pI830->pipes[i].enabled ? "on" : "off");
 	}
-	if (hw_plane_enable != pI830->pipes[i].planeEnabled) {
+	if (hw_plane_enable != pI830->pipes[i].enabled) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		       "  Hardware claims plane %c is %s while software "
 		       "believes it is %s\n",
 		       'A' + i, hw_plane_enable ? "on" : "off",
-		       pI830->pipes[i].planeEnabled ? "on" : "off");
+		       pI830->pipes[i].enabled ? "on" : "off");
 	}
     }
 
@@ -875,7 +875,7 @@ i830DescribeOutputConfiguration(ScrnInfo
 
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "  Output %s is %sabled and connected to pipe %c\n",
-		   name, pI830->output[i].disabled ? "dis" : "en",
+		   name, pI830->output[i].enabled ? "en" : "dis",
 		   pI830->output[i].pipe == 0 ? 'A' : 'B');
     }
 }
@@ -915,7 +915,7 @@ i830GetLoadDetectPipe(ScrnInfoPtr pScrn,
     /* If the output is not marked disabled, check if it's already assigned
      * to an active pipe, and is alone on that pipe.  If so, we're done.
      */
-    if (!output->disabled) {
+    if (output->enabled) {
 	int pipeconf_reg = (output->pipe == 0) ? PIPEACONF : PIPEBCONF;
 
 	if (INREG(pipeconf_reg) & PIPEACONF_ENABLE) {
@@ -936,16 +936,8 @@ i830GetLoadDetectPipe(ScrnInfoPtr pScrn,
 	}
     }
 
-    for (i = 0; i < pI830->availablePipes; i++) {
-	pipe_available[i] = TRUE;
-    }
-
-    for (i = 0; i < pI830->num_outputs; i++) {
-	if (!pI830->output[i].disabled)
-	{
-	    pipe_available[pI830->output[i].pipe] = FALSE;
-	}
-    }
+    for (i = 0; i < pI830->availablePipes; i++)
+	pipe_available[i] = i830PipeInUse(pScrn, i);
 
     for (i = 0; i < pI830->availablePipes; i++) {
 	if (pipe_available[i])
@@ -957,7 +949,7 @@ i830GetLoadDetectPipe(ScrnInfoPtr pScrn,
     }
     output->load_detect_temp = TRUE;
     output->pipe = i;
-    output->disabled = FALSE;
+    output->enabled = TRUE;
 
     I830xf86SetModeCrtc(&mode, INTERLACE_HALVE_V);
 
@@ -970,7 +962,7 @@ void
 i830ReleaseLoadDetectPipe(ScrnInfoPtr pScrn, I830OutputPtr output)
 {
     if (output->load_detect_temp) {
-	output->disabled = TRUE;
+	output->enabled = FALSE;
 	i830DisableUnusedFunctions(pScrn);
 	output->load_detect_temp = FALSE;
     }
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 41ea21c..9e4ead0 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->pipes[1].planeEnabled)
+	    if (pI830->pipes[1].enabled)
 		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 75c3b0e..ab0af4e 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -572,7 +572,7 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
 	 dspsurf = DSPBSURF;
       }
 
-      if (pI830Pipe->planeEnabled == 0)
+      if (pI830Pipe->enabled == 0)
 	 continue;  
 
       pI830Pipe->gammaEnabled = 1;
@@ -1355,13 +1355,13 @@ I830PreInit(ScrnInfoPtr pScrn, int flags
     * we have better configuration support in the generic RandR code
     */
    for (i = 0; i < pI830->num_outputs; i++) {
-      pI830->output[i].disabled = TRUE;
+      pI830->output[i].enabled = FALSE;
 
       switch (pI830->output[i].type) {
       case I830_OUTPUT_LVDS:
 	 /* LVDS must always be on pipe B. */
 	 pI830->output[i].pipe = 1;
-	 pI830->output[i].disabled = FALSE;
+	 pI830->output[i].enabled = TRUE;
 	 break;
       case I830_OUTPUT_ANALOG:
       case I830_OUTPUT_DVO:
@@ -1370,10 +1370,10 @@ I830PreInit(ScrnInfoPtr pScrn, int flags
 	     OUTPUT_STATUS_DISCONNECTED) {
 	    if (!i830PipeInUse(pScrn, 0)) {
 	       pI830->output[i].pipe = 0;
-	       pI830->output[i].disabled = FALSE;
+	       pI830->output[i].enabled = TRUE;
 	    } else if (!i830PipeInUse(pScrn, 1)) {
 	       pI830->output[i].pipe = 1;
-	       pI830->output[i].disabled = FALSE;
+	       pI830->output[i].enabled = TRUE;
 	    }
 	 }
 	 break;
@@ -1384,7 +1384,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags
    }
 
    for (i = 0; i < pI830->availablePipes; i++) {
-      pI830->pipes[i].planeEnabled = i830PipeInUse(pScrn, i);
+      pI830->pipes[i].enabled = i830PipeInUse(pScrn, i);
    }
 
 #if 0
@@ -3210,7 +3210,7 @@ i830AdjustFrame(int scrnIndex, int x, in
    }
 
    for (i = 0; i < pI830->availablePipes; i++)
-      if (pI830->pipes[i].planeEnabled)
+      if (pI830->pipes[i].enabled)
 	 i830PipeSetBase(pScrn, i, x, y);
 }
 
@@ -3471,7 +3471,7 @@ I830SaveScreen(ScreenPtr pScreen, int mo
 	    base = DSPBADDR;
 	    surf = DSPBSURF;
         }
-        if (pI830->pipes[i].planeEnabled) {
+        if (pI830->pipes[i].enabled) {
 	   temp = INREG(ctrl);
 	   if (on)
 	      temp |= DISPLAY_PLANE_ENABLE;
@@ -3520,7 +3520,7 @@ I830DisplayPowerManagementSet(ScrnInfoPt
          ctrl = DSPBCNTR;
          base = DSPBADDR;
       }
-      if (pI830->pipes[i].planeEnabled) {
+      if (pI830->pipes[i].enabled) {
 	   temp = INREG(ctrl);
 	   if (PowerManagementMode == DPMSModeOn)
 	      temp |= DISPLAY_PLANE_ENABLE;
diff --git a/src/i830_randr.c b/src/i830_randr.c
index d2228cf..184bf01 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -501,7 +501,7 @@ I830RandRCrtcNotify (RRCrtcPtr	crtc)
     for (i = 0; i < pI830->num_outputs; i++)
     {
 	output = &pI830->output[i];
-	if (!output->disabled && output->pipe == pipe)
+	if (output->enabled && output->pipe == pipe)
 	{
 	    rrout = randrp->outputs[i];
 	    outputs[numOutputs++] = rrout;
@@ -548,7 +548,7 @@ I830RandRCrtcSet (ScreenPtr	pScreen,
 
     if (display_mode != randrp->modes[pipe])
     {
-	pI830Pipe->planeEnabled = mode != NULL;
+	pI830Pipe->enabled = mode != NULL;
 	if (display_mode)
 	{
 	    if (!i830PipeSetMode (pScrn, display_mode, pipe, TRUE))
@@ -652,7 +652,7 @@ I830RandRSetInfo12 (ScreenPtr pScreen)
 	    subpixel = SubPixelUnknown;
 	    break;
 	}
-	if (!output->disabled)
+	if (output->enabled)
 	{
 	    /* Can't flip outputs among crtcs yet */
 	    ncrtc = 1;
diff-tree ff77e9d84f2037b99a8e4ac55da0b0ac92ed6b9b (from 9b267014b55f49d9362c1d432d6ba19ddd0ad95d)
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Nov 8 19:53:31 2006 -0800

    Clean up i830_crt_detect_load() a bit more.
    
    ADPA might not have been set right in some cases (DPMS-off monitor, for
    example), and a wait for vsync that the bios does was missing.

diff --git a/src/i830_crt.c b/src/i830_crt.c
index 9287a20..68006f9 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -170,7 +170,7 @@ static Bool
 i830_crt_detect_load(ScrnInfoPtr pScrn, I830OutputPtr output)
 {
     I830Ptr pI830 = I830PTR(pScrn);
-    CARD32 adpa, pipeconf, bclrpat;
+    CARD32 save_adpa, adpa, pipeconf, bclrpat;
     CARD8 st00;
     int pipeconf_reg, bclrpat_reg, dpll_reg;
     int pipe;
@@ -186,17 +186,17 @@ i830_crt_detect_load(ScrnInfoPtr pScrn, 
 	dpll_reg = DPLL_B;
     }
 
-    /* Don't try this if the DPLL isn't running. */
-    if (!(INREG(dpll_reg) & DPLL_VCO_ENABLE))
-	return FALSE;
-
     adpa = INREG(ADPA);
+    save_adpa = adpa;
 
-    /* Enable CRT output if disabled. */
-    if (!(adpa & ADPA_DAC_ENABLE)) {
-	OUTREG(ADPA, adpa | ADPA_DAC_ENABLE |
-	       ((pipe == 1) ? ADPA_PIPE_B_SELECT : 0));
-    }
+    /* Enable CRT output. */
+    adpa |= ADPA_DAC_ENABLE;
+    if (pipe == 1)
+ 	adpa |= ADPA_PIPE_B_SELECT;
+    else
+ 	adpa &= ~ADPA_PIPE_B_SELECT;
+    adpa |= ADPA_VSYNC_CNTL_ENABLE | ADPA_HSYNC_CNTL_ENABLE;
+    OUTREG(ADPA, adpa);
 
     /* Set the border color to purple.  Maybe we should save/restore this
      * reg.
@@ -204,6 +204,8 @@ i830_crt_detect_load(ScrnInfoPtr pScrn, 
     bclrpat = INREG(bclrpat_reg);
     OUTREG(bclrpat_reg, 0x00500050);
 
+    i830WaitForVblank(pScrn);
+
     /* Force the border color through the active region */
     pipeconf = INREG(pipeconf_reg);
     OUTREG(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
@@ -214,7 +216,7 @@ i830_crt_detect_load(ScrnInfoPtr pScrn, 
     /* Restore previous settings */
     OUTREG(bclrpat_reg, bclrpat);
     OUTREG(pipeconf_reg, pipeconf);
-    OUTREG(ADPA, adpa);
+    OUTREG(ADPA, save_adpa);
 
     if (st00 & (1 << 4))
 	return TRUE;



More information about the xorg-commit mailing list