xf86-video-intel: Branch 'modesetting' - 3 commits - src/i830_display.c src/i830_driver.c src/i830.h src/i830_video.c

Eric Anholt anholt at kemper.freedesktop.org
Tue Dec 12 09:35:17 EET 2006


 src/i830.h         |   12 ----
 src/i830_display.c |   29 ++-------
 src/i830_driver.c  |   70 +-----------------------
 src/i830_video.c   |  154 +++++++++++++++++++++--------------------------------
 4 files changed, 74 insertions(+), 191 deletions(-)

New commits:
diff-tree c8c1fb64ccecfb88f9923ad65c9898aa44692260 (from 3f3791ba2ece8e8a7aa3a5676f5f6361862a292c)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Dec 11 16:02:29 2006 -0800

    Move the overlay mode switch status updates to when we enable/disable crtcs.
    
    This should help if we mode switch with randr during video playback, and also
    simplifies the code by moving the protection all to one place.

diff --git a/src/i830.h b/src/i830.h
index 9809f35..64a32dc 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -517,8 +517,7 @@ extern Bool I830DGAInit(ScreenPtr pScree
 
 #ifdef I830_XV
 extern void I830InitVideo(ScreenPtr pScreen);
-extern void I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode);
-extern void I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode);
+extern void i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on);
 #endif
 
 extern Bool I830AllocateRotatedBuffer(ScrnInfoPtr pScrn, const int flags);
diff --git a/src/i830_display.c b/src/i830_display.c
index b2d9e35..f05b5c7 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -511,8 +511,14 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mod
 	/* Enable the plane */
 	temp = INREG(dspcntr_reg);
 	OUTREG(dspcntr_reg, temp | DISPLAY_PLANE_ENABLE);
+
+	/* Give the overlay scaler a chance to enable if it's on this pipe */
+	i830_crtc_dpms_video(crtc, TRUE);
 	break;
     case DPMSModeOff:
+	/* Give the overlay scaler a chance to disable if it's on this pipe */
+	i830_crtc_dpms_video(crtc, FALSE);
+
 	/* Disable display plane */
 	temp = INREG(dspcntr_reg);
 	OUTREG(dspcntr_reg, temp & ~DISPLAY_PLANE_ENABLE);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 19f9426..46973e7 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2244,7 +2244,6 @@ RestoreHWState(ScrnInfoPtr pScrn)
    I830Ptr pI830 = I830PTR(pScrn);
    vgaHWPtr hwp = VGAHWPTR(pScrn);
    vgaRegPtr vgaReg = &hwp->SavedReg;
-   CARD32 temp;
    int i;
 
    DPRINTF(PFX, "RestoreHWState\n");
@@ -2259,19 +2258,11 @@ RestoreHWState(ScrnInfoPtr pScrn)
       output->funcs->dpms(output, DPMSModeOff);
    }
 
-   /* Disable display planes */
-   temp = INREG(DSPACNTR);
-   OUTREG(DSPACNTR, temp & ~DISPLAY_PLANE_ENABLE);
-   temp = INREG(DSPBCNTR);
-   OUTREG(DSPBCNTR, temp & ~DISPLAY_PLANE_ENABLE);
-
-   /* Next, disable display pipes */
-   temp = INREG(PIPEACONF);
-   OUTREG(PIPEACONF, temp & ~PIPEACONF_ENABLE);
-   temp = INREG(PIPEBCONF);
-   OUTREG(PIPEBCONF, temp & ~PIPEBCONF_ENABLE);
-
-   i830WaitForVblank(pScrn);
+   /* Disable pipes */
+   for (i = 0; i < pI830->xf86_config.num_crtc; i++) {
+      xf86CrtcPtr crtc = pI830->xf86_config.crtc[i];
+      crtc->funcs->dpms(crtc, DPMSModeOff);
+   }
 
    OUTREG(FPA0, pI830->saveFPA0);
    OUTREG(FPA1, pI830->saveFPA1);
@@ -3214,11 +3205,6 @@ I830LeaveVT(int scrnIndex, int flags)
 
    i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH);
 
-#ifdef I830_XV
-   /* Give the video overlay code a chance to shutdown. */
-   I830VideoSwitchModeBefore(pScrn, NULL);
-#endif
-
    if (!I830IsPrimary(pScrn)) {
    	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
 	if (!pI8301->GttBound) {
@@ -3319,10 +3305,6 @@ I830EnterVT(int scrnIndex, int flags)
 #ifdef XF86DRI
    I830DRISetVBlankInterrupt (pScrn, TRUE);
 #endif
-   
-#ifdef I830_XV
-   I830VideoSwitchModeAfter(pScrn, pScrn->currentMode);
-#endif
 
    ResetState(pScrn, TRUE);
    SetHWOperatingState(pScrn);
@@ -3396,11 +3378,6 @@ I830SwitchMode(int scrnIndex, DisplayMod
 
    DPRINTF(PFX, "I830SwitchMode: mode == %p\n", mode);
 
-#ifdef I830_XV
-   /* Give the video overlay code a chance to see the new mode. */
-   I830VideoSwitchModeBefore(pScrn, mode);
-#endif
-
    /* Sync the engine before mode switch */
    i830WaitSync(pScrn);
 
@@ -3434,18 +3411,8 @@ I830SwitchMode(int scrnIndex, DisplayMod
 	 xf86DrvMsg(scrnIndex, X_INFO,
 		    "Failed to restore previous mode (SwitchMode)\n");
       }
-
-#ifdef I830_XV
-      /* Give the video overlay code a chance to see the new mode. */
-      I830VideoSwitchModeAfter(pScrn, pI830->currentMode);
-#endif
    } else {
       pI830->currentMode = mode;
-
-#ifdef I830_XV
-      /* Give the video overlay code a chance to see the new mode. */
-      I830VideoSwitchModeAfter(pScrn, mode);
-#endif
    }
 
    return ret;
diff --git a/src/i830_video.c b/src/i830_video.c
index 3aad1aa..986d36a 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -738,10 +738,10 @@ I830SetupImageVideoOverlay(ScreenPtr pSc
 
    /*
     * Initialise pPriv->overlayOK.  Set it to TRUE here so that a warning will
-    * be generated if I830VideoSwitchModeAfter() sets it to FALSE.
+    * be generated if i830_crtc_dpms_video() sets it to FALSE during mode
+    * setup.
     */
    pPriv->overlayOK = TRUE;
-   I830VideoSwitchModeAfter(pScrn, pScrn->currentMode);
 
    pI830->BlockHandler = pScreen->BlockHandler;
    pScreen->BlockHandler = I830BlockHandler;
@@ -3511,95 +3511,77 @@ I830InitOffscreenImages(ScreenPtr pScree
 }
 
 void
-I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode)
+i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on)
 {
+   ScrnInfoPtr pScrn = crtc->scrn;
    I830Ptr pI830 = I830PTR(pScrn);
    I830PortPrivPtr pPriv;
+   I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
 
-   if (!pI830->adaptor) {
+   if (pI830->adaptor == NULL)
       return;
-   }
-
-   pPriv = GET_PORT_PRIVATE(pScrn);
 
-   if (!pPriv) {
-      xf86ErrorF("pPriv isn't set\n");
+   /* No overlay scaler on the 965. */
+   if (IS_I965G(pI830))
       return;
-   }
 
-   /* We stop the video when mode switching, just so we don't lockup
-    * the engine. The overlayOK will determine whether we can re-enable
-    * with the current video on completion of the mode switch.
-    */
-   I830StopVideo(pScrn, pPriv, TRUE);
-
-   pPriv->overlayOK = FALSE;
-
-   pPriv->oneLineMode = FALSE;
-}
-
-void
-I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   I830PortPrivPtr pPriv;
-   int size, hsize, vsize, active;
-
-   if (!pI830->adaptor) {
-      return;
-   }
    pPriv = GET_PORT_PRIVATE(pScrn);
-   if (!pPriv)
-      return;
-
-   pPriv->overlayOK = TRUE;
 
-   if (!IS_I965G(pI830)) {
-      if (pPriv->pipe == 0) {
-         if (INREG(PIPEACONF) & PIPEACONF_DOUBLE_WIDE) {
-            xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	    "Disabling XVideo output because Pipe A is in double-wide mode.\n");
-            pPriv->overlayOK = FALSE;
-         } else if (!pPriv->overlayOK) {
-            xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	    "Re-enabling XVideo output because Pipe A is now in single-wide mode.\n");
-            pPriv->overlayOK = TRUE;
-         }
-      }
-
-      if (pPriv->pipe == 1) {
-         if (INREG(PIPEBCONF) & PIPEBCONF_DOUBLE_WIDE) {
-            xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-   	    "Disabling XVideo output because Pipe B is in double-wide mode.\n");
-            pPriv->overlayOK = FALSE;
-         } else if (!pPriv->overlayOK) {
-            xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	    "Re-enabling XVideo output because Pipe B is now in single-wide mode.\n");
-            pPriv->overlayOK = TRUE;
-         }
-      }
-   }
+   /* Check if it's the pipe the overlay is on */
+   if (intel_crtc->pipe != pPriv->pipe)
+      return;
 
-   /* Check we have an LFP connected */
-   if (i830PipeHasType (pI830->xf86_config.crtc[pPriv->pipe], I830_OUTPUT_LVDS)) 
-   {
-      size = pPriv->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC);
-      hsize = (size >> 16) & 0x7FF;
-      vsize = size & 0x7FF;
-      active = pPriv->pipe ? (INREG(VTOTAL_B) & 0x7FF) : (INREG(VTOTAL_A) & 0x7FF);
+   if (on) {
+      int size, hsize, vsize, active;
+      int pipeconf_reg = pPriv->pipe == 0 ? PIPEACONF : PIPEBCONF;
+      char pipename = pPriv->pipe == 0 ? 'A' : 'B';
+
+      pPriv->overlayOK = TRUE;
+
+      if (INREG(pipeconf_reg) & PIPEACONF_DOUBLE_WIDE) {
+	 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		    "Disabling XVideo output because Pipe %c is in "
+		    "double-wide mode.\n", pipename);
+	 pPriv->overlayOK = FALSE;
+      } else if (!pPriv->overlayOK) {
+	 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		    "Re-enabling XVideo output because Pipe %c is now in "
+		    "single-wide mode.\n", pipename);
+	 pPriv->overlayOK = TRUE;
+      }
+
+      /* Check we have an LFP connected */
+      if (i830PipeHasType(pI830->xf86_config.crtc[pPriv->pipe],
+			  I830_OUTPUT_LVDS)) {
+	 size = pPriv->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC);
+	 hsize = (size >> 16) & 0x7FF;
+	 vsize = size & 0x7FF;
+	 int vtotal_reg = pPriv->pipe ? VTOTAL_A : VTOTAL_B;
+	 active = INREG(vtotal_reg) & 0x7FF;
+
+	 if (vsize < active && hsize > 1024)
+	    I830SetOneLineModeRatio(pScrn);
+
+	 if (pPriv->scaleRatio & 0xFFFE0000) {
+	    /* Possible bogus ratio, using in-accurate fallback */
+	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		       "Bogus panel fit register, Xvideo positioning may not "
+		       "be accurate.\n");
+	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		       "Using fallback ratio - was 0x%x, now 0x%x\n",
+		       pPriv->scaleRatio,
+		       (int)(((float)active * 65536)/(float)vsize));
 
-      if (vsize < active && hsize > 1024)
-         I830SetOneLineModeRatio(pScrn);
-   
-      if (pPriv->scaleRatio & 0xFFFE0000) {
-         /* Possible bogus ratio, using in-accurate fallback */
-         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	    "Bogus panel fit register, Xvideo positioning may not be accurate.\n");
-         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	    "Using fallback ratio - was 0x%x, now 0x%x\n", pPriv->scaleRatio, (int)(((float)active * 65536)/(float)vsize));
-   
-   
-         pPriv->scaleRatio = (int)(((float)active * 65536) / (float)vsize);
+	    pPriv->scaleRatio = (int)(((float)active * 65536) / (float)vsize);
+	 }
       }
+   } else {
+      /* We stop the video when mode switching, so we don't lock up
+       * the engine. The overlayOK will determine whether we can re-enable
+       * with the current video on completion of the mode switch.
+       */
+      I830StopVideo(pScrn, pPriv, TRUE);
+      pPriv->overlayOK = FALSE;
+      pPriv->oneLineMode = FALSE;
    }
 }
diff-tree 3f3791ba2ece8e8a7aa3a5676f5f6361862a292c (from c21baa5a3044eb66f2518b018dae07eadb989aa1)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Dec 11 15:20:15 2006 -0800

    Remove remnants of old savedCurrentMode hack.  Man, that was gross.

diff --git a/src/i830.h b/src/i830.h
index 2a7a1d8..9809f35 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -242,10 +242,6 @@ typedef struct _I830Rec {
    int cpp;
 
    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;
 
    I830EntPtr entityPrivate;	
    int init;
diff --git a/src/i830_display.c b/src/i830_display.c
index 6206243..b2d9e35 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -976,19 +976,6 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
 	       (int)(pMode->HDisplay * pMode->VDisplay *
 		     pMode->VRefresh / 1000000));
 
-    if (pI830->savedCurrentMode) {
-	/* We're done with the currentMode that the last randr probe had left
-	 * behind, so free it.
-	 */
-	xfree(pI830->savedCurrentMode->name);
-	xfree(pI830->savedCurrentMode);
-	pI830->savedCurrentMode = NULL;
-
-	/* If HW cursor currently showing, reset cursor state */
-	if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn)
-	    pI830->CursorInfoRec->ShowCursor(pScrn);
-    }
-
     i830DisableUnusedFunctions(pScrn);
 
     i830DescribeOutputConfiguration(pScrn);
diff-tree c21baa5a3044eb66f2518b018dae07eadb989aa1 (from b3865f34669319f449f2da8f87a4eef6ec8e7804)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Dec 11 15:15:01 2006 -0800

    Remove dead remnants of old clone mode support.

diff --git a/src/i830.h b/src/i830.h
index ce9b461..2a7a1d8 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -247,11 +247,6 @@ typedef struct _I830Rec {
     */
    DisplayModePtr savedCurrentMode;
 
-   Bool Clone;
-   int CloneRefresh;
-   int CloneHDisplay;
-   int CloneVDisplay;
-
    I830EntPtr entityPrivate;	
    int init;
 
diff --git a/src/i830_display.c b/src/i830_display.c
index 439c298..6206243 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -983,16 +983,6 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
 	xfree(pI830->savedCurrentMode->name);
 	xfree(pI830->savedCurrentMode);
 	pI830->savedCurrentMode = NULL;
-	    
-	/* If we might have enabled/disabled some pipes, we need to reset
-	 * cloning mode support.
-	 */
-	if (pI830->xf86_config.num_crtc >= 2 && 
-	    pI830->xf86_config.crtc[0]->enabled &&
-	    pI830->xf86_config.crtc[1]->enabled)
-	    pI830->Clone = TRUE;
-	else
-	    pI830->Clone = FALSE;
 
 	/* If HW cursor currently showing, reset cursor state */
 	if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 61ce8ad..19f9426 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -274,8 +274,6 @@ typedef enum {
    OPTION_DISPLAY_INFO,
    OPTION_DEVICE_PRESENCE,
    OPTION_MONITOR_LAYOUT,
-   OPTION_CLONE,
-   OPTION_CLONE_REFRESH,
    OPTION_CHECKDEVICES,
    OPTION_FIXEDPIPE,
    OPTION_ROTATE,
@@ -297,8 +295,6 @@ static OptionInfoRec I830Options[] = {
    {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_MONITOR_LAYOUT, "MonitorLayout", OPTV_ANYSTR,{0},	FALSE},
-   {OPTION_CLONE,	"Clone",	OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_CLONE_REFRESH,"CloneRefresh",OPTV_INTEGER,	{0},	FALSE},
    {OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN,	{0},	FALSE},
    {OPTION_FIXEDPIPE,   "FixedPipe",    OPTV_ANYSTR, 	{0},	FALSE},
    {OPTION_ROTATE,      "Rotate",       OPTV_ANYSTR,    {0},    FALSE},
@@ -1387,23 +1383,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags
        i830_crtc_init(pScrn, i);
    }
 
-   if (xf86ReturnOptValBool(pI830->Options, OPTION_CLONE, FALSE)) {
-      if (num_pipe == 1) {
-         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 
- 		 "Can't enable Clone Mode because this is a single pipe device\n");
-         PreInitCleanup(pScrn);
-         return FALSE;
-      }
-      if (pI830->entityPrivate) {
-         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 
- 		 "Can't enable Clone Mode because second head is configured\n");
-         PreInitCleanup(pScrn);
-         return FALSE;
-      }
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling Clone Mode\n");
-      pI830->Clone = TRUE;
-   }
-
    SaveHWState(pScrn);
    /* Do an initial detection of the outputs while none are configured on yet.
     * This will give us some likely legitimate response for later if both
@@ -3240,12 +3219,6 @@ I830LeaveVT(int scrnIndex, int flags)
    I830VideoSwitchModeBefore(pScrn, NULL);
 #endif
 
-   if (pI830->Clone) {
-      /* Ensure we don't try and setup modes on a clone head */
-      pI830->CloneHDisplay = 0;
-      pI830->CloneVDisplay = 0;
-   }
-
    if (!I830IsPrimary(pScrn)) {
    	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
 	if (!pI8301->GttBound) {
diff --git a/src/i830_video.c b/src/i830_video.c
index a3bfda8..3aad1aa 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -954,7 +954,7 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
       overlay->OCLRC1 = pPriv->saturation;
       overlay->OCMD &= ~OVERLAY_ENABLE;
       OVERLAY_UPDATE;
-   } else if (pI830->Clone && attribute == xvPipe) {
+   } else if (attribute == xvPipe) {
       if ((value < 0) || (value > 1))
          return BadValue;
       pPriv->pipe = value;
@@ -3554,18 +3554,6 @@ I830VideoSwitchModeAfter(ScrnInfoPtr pSc
 
    pPriv->overlayOK = TRUE;
 
-#if 0
-   /* XXX Must choose pipe wisely */
-   /* ensure pipe is updated on mode switch */
-   if (!pI830->Clone) {
-      if (pPriv->pipe != pI830->pipe) {
-         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-	   "Changing XVideo pipe (%d to %d).\n", pPriv->pipe, pI830->pipe);
-         pPriv->pipe = pI830->pipe;
-      }
-   }
-#endif
-
    if (!IS_I965G(pI830)) {
       if (pPriv->pipe == 0) {
          if (INREG(PIPEACONF) & PIPEACONF_DOUBLE_WIDE) {



More information about the xorg-commit mailing list